aboutsummaryrefslogtreecommitdiff
path: root/zencore-test/zencore-test.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-09-20 10:15:12 +0200
committerStefan Boberg <[email protected]>2021-09-20 10:15:12 +0200
commit8d3024a7e09246e44bf6d9ea14a36e6b03032e85 (patch)
treec18c2536d108378e5cddcac21398efd8d28e437d /zencore-test/zencore-test.cpp
parentAdded testing.h to wrap doctest.h (diff)
downloadzen-8d3024a7e09246e44bf6d9ea14a36e6b03032e85.tar.xz
zen-8d3024a7e09246e44bf6d9ea14a36e6b03032e85.zip
It's not possible to compile out tests
Tests are now compiled in if `ZEN_WITH_TESTS=1`, and compiled out if not. Compiling tests out reduces the footprint of the resulting executables quite significantly.
Diffstat (limited to 'zencore-test/zencore-test.cpp')
-rw-r--r--zencore-test/zencore-test.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/zencore-test/zencore-test.cpp b/zencore-test/zencore-test.cpp
index 7242a30ec..cd4ce3e0a 100644
--- a/zencore-test/zencore-test.cpp
+++ b/zencore-test/zencore-test.cpp
@@ -4,20 +4,22 @@
#include <zencore/logging.h>
#include <zencore/zencore.h>
-#define DOCTEST_CONFIG_IMPLEMENT
-#include <doctest/doctest.h>
-#undef DOCTEST_CONFIG_IMPLEMENT
+#if ZEN_WITH_TESTS
+# define DOCTEST_CONFIG_IMPLEMENT
+# include <zencore/testing.h>
+# undef DOCTEST_CONFIG_IMPLEMENT
+#endif
-void
-forceLinkTests()
+int
+main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[])
{
+#if ZEN_WITH_TESTS
zen::zencore_forcelinktests();
-}
-int
-main(int argc, char* argv[])
-{
zen::logging::InitializeLogging();
return doctest::Context(argc, argv).run();
+#else
+ return 0;
+#endif
}