8 #ifndef TESTING_LOGGER_HPP_INCLUDED
9 #define TESTING_LOGGER_HPP_INCLUDED 1
27 static void check(
bool assertion, std::string description);
32 template <
typename Function>
33 static void checkSafely(Function assertionFn, std::string description)
36 check(assertionFn(), description);
38 catch (std::exception& exn) {
39 exn_fail(&exn, exn.what(), description);
41 catch (
const char* cstring) {
42 exn_fail(
nullptr, cstring, description);
45 exn_fail(
nullptr,
"", description);
49 bool summarize(
bool verbose =
false);
61 static void exn_fail(std::exception* exn, std::string what,
62 std::string description);
64 std::map<std::string, AssertInfo> assertions_;
65 using const_iter = std::map<std::string, AssertInfo>::const_iterator;
66 using iter = std::map<std::string, AssertInfo>::iterator;
67 std::string testName_;
75 #define affirm(isTrue) \
76 TestingLogger::checkSafely([&]{ return isTrue; }, \
77 std::string(__FILE__) + ":" + std::to_string(__LINE__) \
80 #endif // TESTING_LOGGER_HPP_INCLUDED
Definition: testing-logger.hpp:56
Definition: testing-logger.hpp:23