int run() { // for each testcase for (test_suite::const_iterator b = m_ts.begin(), e = m_ts.end(); b != e; ++b) { test_case const& tc = *b; set_checkpoint(tc.file, tc.func, tc.line); get_reporter().test_case_begin(); #ifndef TEST_HAS_NO_EXCEPTIONS try { #endif tc.invoke(); #ifndef TEST_HAS_NO_EXCEPTIONS } catch (...) { test_outcome o; o.type = failure_type::uncaught_exception; o.file = get_checkpoint().file; o.func = get_checkpoint().func; o.line = get_checkpoint().line; o.expression = ""; o.message = ""; get_reporter().report(o); } #endif get_reporter().test_case_end(); } auto exit_code = get_reporter().failure_count() ? EXIT_FAILURE : EXIT_SUCCESS; if (exit_code == EXIT_FAILURE) get_reporter().print_summary(m_ts.name()); return exit_code; }
int run() { // for each testcase for (auto & tc : m_ts) { set_checkpoint(tc.file, tc.func, tc.line); get_reporter().test_case_begin(); try { tc.invoke(); } catch (...) { test_outcome o; o.type = failure_type::uncaught_exception; o.file = get_checkpoint().file; o.func = get_checkpoint().func; o.line = get_checkpoint().line; o.expression = ""; o.message = ""; get_reporter().report(o); } get_reporter().test_case_end(); } get_reporter().print_summary(m_ts.name()); // return 0 if no failures, 1 otherwise. return get_reporter().failure_count() ? EXIT_FAILURE : EXIT_SUCCESS; }