1 #ifndef DOCTEST_COMPATIBILITY 2 #define DOCTEST_COMPATIBILITY 3 4 #define DOCTEST_CONFIG_VOID_CAST_EXPRESSIONS 5 #define DOCTEST_THREAD_LOCAL // enable single-threaded builds on XCode 6/7 - https://github.com/onqtam/doctest/issues/172 6 #include "doctest.h" 7 8 // Catch doesn't require a semicolon after CAPTURE but doctest does 9 #undef CAPTURE 10 #define CAPTURE(x) DOCTEST_CAPTURE(x); 11 12 // Sections from Catch are called Subcases in doctest and don't work with std::string by default 13 #undef SUBCASE 14 #define SECTION(x) DOCTEST_SUBCASE(x) 15 16 // convenience macro around INFO since it doesn't support temporaries (it is optimized to avoid allocations for runtime speed) 17 #define INFO_WITH_TEMP_IMPL(x, var_name) const auto var_name = x; INFO(var_name) // lvalue! 18 #define INFO_WITH_TEMP(x) INFO_WITH_TEMP_IMPL(x, DOCTEST_ANONYMOUS(DOCTEST_STD_STRING_)) 19 20 // doctest doesn't support THROWS_WITH for std::string out of the box (has to include <string>...) 21 #define CHECK_THROWS_WITH_STD_STR_IMPL(expr, str, var_name) \ 22 do { \ 23 std::string var_name = str; \ 24 CHECK_THROWS_WITH(expr, var_name.c_str()); \ 25 } while (false) 26 #define CHECK_THROWS_WITH_STD_STR(expr, str) \ 27 CHECK_THROWS_WITH_STD_STR_IMPL(expr, str, DOCTEST_ANONYMOUS(DOCTEST_STD_STRING_)) 28 29 // included here because for some tests in the json repository private is defined as 30 // public and if no STL header is included before that then in the json include when STL 31 // stuff is included the MSVC STL complains (errors) that C++ keywords are being redefined 32 #include <iosfwd> 33 34 // Catch does this by default 35 using doctest::Approx; 36 37 #endif 38