diff options
Diffstat (limited to 'zencore/include')
| -rw-r--r-- | zencore/include/zencore/testing.h | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/zencore/include/zencore/testing.h b/zencore/include/zencore/testing.h index 80aebc26e..faa4eef6c 100644 --- a/zencore/include/zencore/testing.h +++ b/zencore/include/zencore/testing.h @@ -4,6 +4,36 @@ #include <zencore/zencore.h> +#ifdef ZEN_TEST_WITH_RUNNER +# define CATCH_CONFIG_RUNNER +# define DOCTEST_CONFIG_IMPLEMENT +#endif + +#ifndef ZEN_USE_CATCH2 +# define ZEN_USE_CATCH2 0 +#endif + #if ZEN_WITH_TESTS -# include <doctest/doctest.h> +# if ZEN_USE_CATCH2 +# include <catch2/catch.hpp> +# define SUBCASE(x) SECTION(x) +# define CHECK_EQ(x, y) CHECK((x) == (y)) +# define CHECK_MESSAGE(x, y) CHECK(x) +# define ZEN_RUN_TESTS(argC, argV) Catch::Session().run(argC, argV) +# else +# include <doctest/doctest.h> +# define ZEN_RUN_TESTS(argC, argV) doctest::Context(argc, argv).run() +inline auto +Approx(auto Value) +{ + return doctest::Approx(Value); +} +# endif +#else +# define ZEN_RUN_TESTS(argC, argV) +#endif + +#ifdef ZEN_TEST_WITH_RUNNER +# undef CATCH_CONFIG_RUNNER +# undef DOCTEST_CONFIG_IMPLEMENT #endif |