summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-02-11 18:32:53 +0300
committerAndrei Karas <akaras@inbox.ru>2012-02-11 18:32:53 +0300
commit1e255ec19ececda196874f751a81682169cf64c3 (patch)
treea972041a56d46ec4beb04141946b73091fbbca95 /src/main.cpp
parentc14086d6a08fb2ea644eec9fafa0374604c98991 (diff)
downloadplus-1e255ec19ececda196874f751a81682169cf64c3.tar.gz
plus-1e255ec19ececda196874f751a81682169cf64c3.tar.bz2
plus-1e255ec19ececda196874f751a81682169cf64c3.tar.xz
plus-1e255ec19ececda196874f751a81682169cf64c3.zip
Add support for gtest framework.
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index dc87ca9e0..f30e7bc62 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -35,6 +35,10 @@
#include "utils/stringutils.h"
#include "utils/xml.h"
+#ifdef UNITTESTS
+#include <gtest/gtest.h>
+#endif
+
#ifdef __MINGW32__
#include <windows.h>
#endif
@@ -210,6 +214,8 @@ static void parseOptions(int argc, char *argv[], Client::Options &options)
extern "C" char const *_nl_locale_name_default(void);
#endif
+#ifndef UNITTESTS
+// main for normal game usage
int main(int argc, char *argv[])
{
#if defined(__MINGW32__)
@@ -262,3 +268,14 @@ int main(int argc, char *argv[])
return client.testsExec();
}
}
+
+#else
+
+// main for unit testing
+int main(int argc, char **argv)
+{
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
+
+#endif