catch3
Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.
Clonegit clone https://git.progmasoft.com/catch3
Add test for !shouldfail and failed benchmarks
- Commit
1cbbc5d2cbac7f497fa5e2128f6779ee2e5fb510- Author
- Martin Hořeňovský ·
- Parents
7f3297f7e81c
Changes
tests/CMakeLists.txt | 10 ++++++++++ tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 750547c0..7f7c32fe 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -359,6 +359,16 @@ set_tests_properties("Benchmarking::FailureReporting::FailMacro" FAIL_REGULAR_EXPRESSION "successes=\"1\"" ) +add_test(NAME "Benchmarking::FailureReporting::ShouldFailIsRespected" + COMMAND + $<TARGET_FILE:SelfTest> "Failing benchmark respects should-fail" +) +set_tests_properties("Benchmarking::FailureReporting::ShouldFailIsRespected" + PROPERTIES + PASS_REGULAR_EXPRESSION "1 failed as expected" +) + + if (CATCH_USE_VALGRIND) add_test(NAME ValgrindRunTests COMMAND valgrind --leak-check=full --error-exitcode=1 $<TARGET_FILE:SelfTest>) add_test(NAME ValgrindListTests COMMAND valgrind --leak-check=full --error-exitcode=1 $<TARGET_FILE:SelfTest> --list-tests --verbosity high) diff --git a/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp b/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp index b2250415..19fa8f95 100644 --- a/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/InternalBenchmark.tests.cpp @@ -433,3 +433,8 @@ TEST_CASE("Failing benchmarks", "[!benchmark][.approvals]") { }; } } + +TEST_CASE( "Failing benchmark respects should-fail", + "[!shouldfail][!benchmark][.approvals]" ) { + BENCHMARK( "Asserting benchmark" ) { REQUIRE( 1 == 2 ); }; +}