Added API in lightweight_test to obtain the number of test failures.

The new API allows to check if the number of check failures satisfies
a certain condition. The report_errors function returns test_report,
which allows to obtain the error count. It also protects against
unintended comparisons to the error count, which was a misconception
before.

Also added a get_error_count function to explicitly query for the current
number of errors.
This commit is contained in:
Andrey Semashev committed 2019-06-26 22:48:28 +03:00
1 parent 6871034931
commit 78c87b848c
6 files changed
+101 -11

No files matched your search

+2 -2
View File
@@ -77,8 +77,8 @@ run lightweight_test_test3.cpp ;
run lightweight_test_test4.cpp ;
run lightweight_test_test5.cpp ;
run-fail lightweight_test_all_eq_test.cpp ;
run-fail lightweight_test_all_with_fail.cpp ;
run lightweight_test_all_eq_test.cpp ;
run lightweight_test_all_with_fail.cpp ;
run-fail lightweight_test_fail.cpp ;
run-fail lightweight_test_fail2.cpp ;
+1 -1
View File
@@ -120,5 +120,5 @@ int main()
++test_cases;
}
return boost::report_errors() == test_cases;
return boost::report_errors().error_count() == test_cases ? 0 : 1;
}
+1 -1
View File
@@ -101,5 +101,5 @@ int main()
test_cases += fail_vector();
test_cases += fail_tolerance_predicate();
return boost::report_errors() == test_cases;
return boost::report_errors().error_count() == test_cases ? 0 : 1;
}
+1 -1
View File
@@ -64,5 +64,5 @@ int main()
#endif
return boost::report_errors() == expected;
return boost::report_errors().error_count() == expected ? 0 : 1;
}