#include "test_main.h" namespace testing { std::vector& registry() { static std::vector r; return r; } int& failures() { static int n = 0; return n; } void report_failure(const char* file, int line, const std::string& expr) { ++failures(); std::fprintf(stderr, " FAIL %s:%d: %s\n", file, line, expr.c_str()); } } // namespace testing int main() { int ran = 0; for (const auto& c : testing::registry()) { const int before = testing::failures(); c.fn(); ++ran; if (testing::failures() != before) std::fprintf(stderr, " in test %s\n", c.name); } std::printf("%d tests, %d failures\n", ran, testing::failures()); return testing::failures() == 0 ? 0 : 1; }