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
More tests for MapGenerator
- Commit
56024c04e42172d53a1672b9af6a538afdb79801- Author
- Martin Hořeňovský ·
- Parents
edfed6c04eb3
Changes
tests/SelfTest/Baselines/automake.sw.approved.txt | 1 + .../Baselines/automake.sw.multi.approved.txt | 1 + tests/SelfTest/Baselines/compact.sw.approved.txt | 25 ++- .../Baselines/compact.sw.multi.approved.txt | 25 ++- tests/SelfTest/Baselines/console.std.approved.txt | 4 +- tests/SelfTest/Baselines/console.sw.approved.txt | 91 ++++++++- .../Baselines/console.sw.multi.approved.txt | 91 ++++++++- tests/SelfTest/Baselines/junit.sw.approved.txt | 5 +- .../SelfTest/Baselines/junit.sw.multi.approved.txt | 5 +- tests/SelfTest/Baselines/sonarqube.sw.approved.txt | 3 + .../Baselines/sonarqube.sw.multi.approved.txt | 3 + tests/SelfTest/Baselines/tap.sw.approved.txt | 36 +++- tests/SelfTest/Baselines/tap.sw.multi.approved.txt | 36 +++- tests/SelfTest/Baselines/teamcity.sw.approved.txt | 2 + .../Baselines/teamcity.sw.multi.approved.txt | 2 + tests/SelfTest/Baselines/xml.sw.approved.txt | 211 ++++++++++++++++----- tests/SelfTest/Baselines/xml.sw.multi.approved.txt | 211 ++++++++++++++++----- .../IntrospectiveTests/GeneratorsImpl.tests.cpp | 76 ++++++-- 18 files changed, 673 insertions(+), 155 deletions(-) diff --git a/tests/SelfTest/Baselines/automake.sw.approved.txt b/tests/SelfTest/Baselines/automake.sw.approved.txt index 557f58f9..f5c2fa97 100644 --- a/tests/SelfTest/Baselines/automake.sw.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.approved.txt @@ -193,6 +193,7 @@ Nor would this :test-result: PASS Less-than inequalities with different epsilons :test-result: PASS ManuallyRegistered :test-result: PASS MapGenerator can be skipped forward efficiently +:test-result: PASS MapGenerator can handle not default constructible types :test-result: PASS Matchers can be (AllOf) composed with the && operator :test-result: PASS Matchers can be (AnyOf) composed with the || operator :test-result: PASS Matchers can be composed with both && and || diff --git a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt index 1d3bc6a1..973e2f53 100644 --- a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt @@ -191,6 +191,7 @@ :test-result: PASS Less-than inequalities with different epsilons :test-result: PASS ManuallyRegistered :test-result: PASS MapGenerator can be skipped forward efficiently +:test-result: PASS MapGenerator can handle not default constructible types :test-result: PASS Matchers can be (AllOf) composed with the && operator :test-result: PASS Matchers can be (AnyOf) composed with the || operator :test-result: PASS Matchers can be composed with both && and || diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt index 61328ce6..e4258ecb 100644 --- a/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -1260,14 +1260,27 @@ Approx.tests.cpp:<line number>: passed: d <= Approx( 1.22 ).epsilon(0.1) for: 1. Approx( 1.21999999999999997 ) Misc.tests.cpp:<line number>: passed: with 1 message: 'was called' GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 0 for: 0 == 0 +GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 0 for: 0 == 0 +GeneratorsImpl.tests.cpp:<line number>: passed: map_generator.get() == 3 for: 3 == 3 +GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: map_generator.get() == 3 for: 3 == 3 +GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 0 for: 0 == 0 +GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 0 for: 0 == 0 GeneratorsImpl.tests.cpp:<line number>: passed: map_generator.get() == 4 for: 4 == 4 -GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == map_calls_1 + 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 1 for: 1 == 1 GeneratorsImpl.tests.cpp:<line number>: passed: map_generator.get() == 4 for: 4 == 4 -GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == map_calls_1 + 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 1 for: 1 == 1 GeneratorsImpl.tests.cpp:<line number>: passed: map_generator.get() == 6 for: 6 == 6 -GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == map_calls_2 + 1 for: 2 == 2 +GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 2 for: 2 == 2 GeneratorsImpl.tests.cpp:<line number>: passed: map_generator.skipToNthElement( 7 ) -GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == map_calls_2 + 1 for: 2 == 2 +GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 2 for: 2 == 2 +GeneratorsImpl.tests.cpp:<line number>: passed: map_generator.get().m_i == 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: map_generator.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: map_generator.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: map_generator.get().m_i == 3 for: 3 == 3 Matchers.tests.cpp:<line number>: passed: testStringForMatching(), ContainsSubstring( "string" ) && ContainsSubstring( "abc" ) && ContainsSubstring( "substring" ) && ContainsSubstring( "contains" ) for: "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" and contains: "substring" and contains: "contains" ) Matchers.tests.cpp:<line number>: passed: testStringForMatching(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "random" ) for: "this string contains 'abc' as a substring" ( contains: "string" or contains: "different" or contains: "random" ) Matchers.tests.cpp:<line number>: passed: testStringForMatching2(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "random" ) for: "some completely different text that contains one common word" ( contains: "string" or contains: "different" or contains: "random" ) @@ -2984,7 +2997,7 @@ InternalBenchmark.tests.cpp:<line number>: passed: med == 18. for: 18.0 == 18.0 InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0 Misc.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: passed: -test cases: 449 | 329 passed | 96 failed | 6 skipped | 18 failed as expected -assertions: 2400 | 2199 passed | 158 failed | 43 failed as expected +test cases: 450 | 330 passed | 96 failed | 6 skipped | 18 failed as expected +assertions: 2413 | 2212 passed | 158 failed | 43 failed as expected diff --git a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt index 4b32eb63..19309e5a 100644 --- a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt @@ -1258,14 +1258,27 @@ Approx.tests.cpp:<line number>: passed: d <= Approx( 1.22 ).epsilon(0.1) for: 1. Approx( 1.21999999999999997 ) Misc.tests.cpp:<line number>: passed: with 1 message: 'was called' GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 0 for: 0 == 0 +GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 0 for: 0 == 0 +GeneratorsImpl.tests.cpp:<line number>: passed: map_generator.get() == 3 for: 3 == 3 +GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: map_generator.get() == 3 for: 3 == 3 +GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 0 for: 0 == 0 +GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 0 for: 0 == 0 GeneratorsImpl.tests.cpp:<line number>: passed: map_generator.get() == 4 for: 4 == 4 -GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == map_calls_1 + 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 1 for: 1 == 1 GeneratorsImpl.tests.cpp:<line number>: passed: map_generator.get() == 4 for: 4 == 4 -GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == map_calls_1 + 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 1 for: 1 == 1 GeneratorsImpl.tests.cpp:<line number>: passed: map_generator.get() == 6 for: 6 == 6 -GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == map_calls_2 + 1 for: 2 == 2 +GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 2 for: 2 == 2 GeneratorsImpl.tests.cpp:<line number>: passed: map_generator.skipToNthElement( 7 ) -GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == map_calls_2 + 1 for: 2 == 2 +GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == 2 for: 2 == 2 +GeneratorsImpl.tests.cpp:<line number>: passed: map_generator.get().m_i == 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:<line number>: passed: map_generator.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: map_generator.next() for: true +GeneratorsImpl.tests.cpp:<line number>: passed: map_generator.get().m_i == 3 for: 3 == 3 Matchers.tests.cpp:<line number>: passed: testStringForMatching(), ContainsSubstring( "string" ) && ContainsSubstring( "abc" ) && ContainsSubstring( "substring" ) && ContainsSubstring( "contains" ) for: "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" and contains: "substring" and contains: "contains" ) Matchers.tests.cpp:<line number>: passed: testStringForMatching(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "random" ) for: "this string contains 'abc' as a substring" ( contains: "string" or contains: "different" or contains: "random" ) Matchers.tests.cpp:<line number>: passed: testStringForMatching2(), ContainsSubstring( "string" ) || ContainsSubstring( "different" ) || ContainsSubstring( "random" ) for: "some completely different text that contains one common word" ( contains: "string" or contains: "different" or contains: "random" ) @@ -2973,7 +2986,7 @@ InternalBenchmark.tests.cpp:<line number>: passed: med == 18. for: 18.0 == 18.0 InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0 Misc.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: passed: -test cases: 449 | 329 passed | 96 failed | 6 skipped | 18 failed as expected -assertions: 2400 | 2199 passed | 158 failed | 43 failed as expected +test cases: 450 | 330 passed | 96 failed | 6 skipped | 18 failed as expected +assertions: 2413 | 2212 passed | 158 failed | 43 failed as expected diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt index 7773dea3..c890017e 100644 --- a/tests/SelfTest/Baselines/console.std.approved.txt +++ b/tests/SelfTest/Baselines/console.std.approved.txt @@ -1743,6 +1743,6 @@ due to unexpected exception with message: Why would you throw a std::string? =============================================================================== -test cases: 449 | 347 passed | 76 failed | 7 skipped | 19 failed as expected -assertions: 2378 | 2199 passed | 136 failed | 43 failed as expected +test cases: 450 | 348 passed | 76 failed | 7 skipped | 19 failed as expected +assertions: 2391 | 2212 passed | 136 failed | 43 failed as expected diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt index de8be563..9024aa34 100644 --- a/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.approved.txt @@ -8255,10 +8255,58 @@ with message: ------------------------------------------------------------------------------- MapGenerator can be skipped forward efficiently + via calls to next() ------------------------------------------------------------------------------- GeneratorsImpl.tests.cpp:<line number> ............................................................................... +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_calls == 0 ) +with expansion: + 0 == 0 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_calls == 0 ) +with expansion: + 0 == 0 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_generator.get() == 3 ) +with expansion: + 3 == 3 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_calls == 1 ) +with expansion: + 1 == 1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_generator.get() == 3 ) +with expansion: + 3 == 3 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_calls == 1 ) +with expansion: + 1 == 1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_calls == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +MapGenerator can be skipped forward efficiently + via calls to skipToNthElement() +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_calls == 0 ) +with expansion: + 0 == 0 + GeneratorsImpl.tests.cpp:<line number>: PASSED: REQUIRE( map_calls == 0 ) with expansion: @@ -8270,7 +8318,7 @@ with expansion: 4 == 4 GeneratorsImpl.tests.cpp:<line number>: PASSED: - REQUIRE( map_calls == map_calls_1 + 1 ) + REQUIRE( map_calls == 1 ) with expansion: 1 == 1 @@ -8280,7 +8328,12 @@ with expansion: 4 == 4 GeneratorsImpl.tests.cpp:<line number>: PASSED: - REQUIRE( map_calls == map_calls_1 + 1 ) + REQUIRE( map_calls == 1 ) +with expansion: + 1 == 1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_calls == 1 ) with expansion: 1 == 1 @@ -8290,7 +8343,7 @@ with expansion: 6 == 6 GeneratorsImpl.tests.cpp:<line number>: PASSED: - REQUIRE( map_calls == map_calls_2 + 1 ) + REQUIRE( map_calls == 2 ) with expansion: 2 == 2 @@ -8298,10 +8351,36 @@ GeneratorsImpl.tests.cpp:<line number>: PASSED: REQUIRE_THROWS( map_generator.skipToNthElement( 7 ) ) GeneratorsImpl.tests.cpp:<line number>: PASSED: - REQUIRE( map_calls == map_calls_2 + 1 ) + REQUIRE( map_calls == 2 ) with expansion: 2 == 2 +------------------------------------------------------------------------------- +MapGenerator can handle not default constructible types +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_generator.get().m_i == 1 ) +with expansion: + 1 == 1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_generator.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_generator.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_generator.get().m_i == 3 ) +with expansion: + 3 == 3 + ------------------------------------------------------------------------------- Matchers can be (AllOf) composed with the && operator ------------------------------------------------------------------------------- @@ -20034,6 +20113,6 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: =============================================================================== -test cases: 449 | 329 passed | 96 failed | 6 skipped | 18 failed as expected -assertions: 2400 | 2199 passed | 158 failed | 43 failed as expected +test cases: 450 | 330 passed | 96 failed | 6 skipped | 18 failed as expected +assertions: 2413 | 2212 passed | 158 failed | 43 failed as expected diff --git a/tests/SelfTest/Baselines/console.sw.multi.approved.txt b/tests/SelfTest/Baselines/console.sw.multi.approved.txt index 0598bd09..f4c6dc10 100644 --- a/tests/SelfTest/Baselines/console.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.multi.approved.txt @@ -8253,10 +8253,58 @@ with message: ------------------------------------------------------------------------------- MapGenerator can be skipped forward efficiently + via calls to next() ------------------------------------------------------------------------------- GeneratorsImpl.tests.cpp:<line number> ............................................................................... +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_calls == 0 ) +with expansion: + 0 == 0 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_calls == 0 ) +with expansion: + 0 == 0 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_generator.get() == 3 ) +with expansion: + 3 == 3 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_calls == 1 ) +with expansion: + 1 == 1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_generator.get() == 3 ) +with expansion: + 3 == 3 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_calls == 1 ) +with expansion: + 1 == 1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_calls == 1 ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +MapGenerator can be skipped forward efficiently + via calls to skipToNthElement() +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_calls == 0 ) +with expansion: + 0 == 0 + GeneratorsImpl.tests.cpp:<line number>: PASSED: REQUIRE( map_calls == 0 ) with expansion: @@ -8268,7 +8316,7 @@ with expansion: 4 == 4 GeneratorsImpl.tests.cpp:<line number>: PASSED: - REQUIRE( map_calls == map_calls_1 + 1 ) + REQUIRE( map_calls == 1 ) with expansion: 1 == 1 @@ -8278,7 +8326,12 @@ with expansion: 4 == 4 GeneratorsImpl.tests.cpp:<line number>: PASSED: - REQUIRE( map_calls == map_calls_1 + 1 ) + REQUIRE( map_calls == 1 ) +with expansion: + 1 == 1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_calls == 1 ) with expansion: 1 == 1 @@ -8288,7 +8341,7 @@ with expansion: 6 == 6 GeneratorsImpl.tests.cpp:<line number>: PASSED: - REQUIRE( map_calls == map_calls_2 + 1 ) + REQUIRE( map_calls == 2 ) with expansion: 2 == 2 @@ -8296,10 +8349,36 @@ GeneratorsImpl.tests.cpp:<line number>: PASSED: REQUIRE_THROWS( map_generator.skipToNthElement( 7 ) ) GeneratorsImpl.tests.cpp:<line number>: PASSED: - REQUIRE( map_calls == map_calls_2 + 1 ) + REQUIRE( map_calls == 2 ) with expansion: 2 == 2 +------------------------------------------------------------------------------- +MapGenerator can handle not default constructible types +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp:<line number> +............................................................................... + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_generator.get().m_i == 1 ) +with expansion: + 1 == 1 + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_generator.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_generator.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:<line number>: PASSED: + REQUIRE( map_generator.get().m_i == 3 ) +with expansion: + 3 == 3 + ------------------------------------------------------------------------------- Matchers can be (AllOf) composed with the && operator ------------------------------------------------------------------------------- @@ -20023,6 +20102,6 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: =============================================================================== -test cases: 449 | 329 passed | 96 failed | 6 skipped | 18 failed as expected -assertions: 2400 | 2199 passed | 158 failed | 43 failed as expected +test cases: 450 | 330 passed | 96 failed | 6 skipped | 18 failed as expected +assertions: 2413 | 2212 passed | 158 failed | 43 failed as expected diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt index 3f302f98..59622d9d 100644 --- a/tests/SelfTest/Baselines/junit.sw.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <testsuitesloose text artifact > - <testsuite name="<exe-name>" errors="17" failures="141" skipped="12" tests="2412" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> + <testsuite name="<exe-name>" errors="17" failures="141" skipped="12" tests="2425" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <properties> <property name="random-seed" value="1"/> <property name="filters" value=""*" ~[!nonportable] ~[!benchmark] ~[approvals]"/> @@ -1031,6 +1031,9 @@ at Condition.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Less-than inequalities with different epsilons" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="ManuallyRegistered" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="MapGenerator can be skipped forward efficiently" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="MapGenerator can be skipped forward efficiently/via calls to next()" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="MapGenerator can be skipped forward efficiently/via calls to skipToNthElement()" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="MapGenerator can handle not default constructible types" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Matchers can be (AllOf) composed with the && operator" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Matchers can be (AnyOf) composed with the || operator" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Matchers can be composed with both && and ||" time="{duration}" status="run"/> diff --git a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt index e624506c..0f136363 100644 --- a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <testsuites> - <testsuite name="<exe-name>" errors="17" failures="141" skipped="12" tests="2412" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> + <testsuite name="<exe-name>" errors="17" failures="141" skipped="12" tests="2425" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <properties> <property name="random-seed" value="1"/> <property name="filters" value=""*" ~[!nonportable] ~[!benchmark] ~[approvals]"/> @@ -1030,6 +1030,9 @@ at Condition.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Less-than inequalities with different epsilons" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="ManuallyRegistered" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="MapGenerator can be skipped forward efficiently" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="MapGenerator can be skipped forward efficiently/via calls to next()" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="MapGenerator can be skipped forward efficiently/via calls to skipToNthElement()" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="MapGenerator can handle not default constructible types" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Matchers can be (AllOf) composed with the && operator" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Matchers can be (AnyOf) composed with the || operator" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Matchers can be composed with both && and ||" time="{duration}" status="run"/> diff --git a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt index ee6ad309..fa472c71 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt @@ -206,6 +206,9 @@ at AssertionHandler.tests.cpp:<line number> <testCase name="Generators internals/Range/Negative manual step/Integer/Slightly over end" duration="{duration}"/> <testCase name="Generators internals/Range/Negative manual step/Integer/Slightly under end" duration="{duration}"/> <testCase name="MapGenerator can be skipped forward efficiently" duration="{duration}"/> + <testCase name="MapGenerator can be skipped forward efficiently/via calls to next()" duration="{duration}"/> + <testCase name="MapGenerator can be skipped forward efficiently/via calls to skipToNthElement()" duration="{duration}"/> + <testCase name="MapGenerator can handle not default constructible types" duration="{duration}"/> <testCase name="RandomGenerator reports itself as infinite - float" duration="{duration}"/> <testCase name="RandomGenerator reports itself as infinite - int" duration="{duration}"/> <testCase name="RandomGenerator reports itself as infinite - long double" duration="{duration}"/> diff --git a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt index 119782fe..3e970f26 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt @@ -205,6 +205,9 @@ at AssertionHandler.tests.cpp:<line number> <testCase name="Generators internals/Range/Negative manual step/Integer/Slightly over end" duration="{duration}"/> <testCase name="Generators internals/Range/Negative manual step/Integer/Slightly under end" duration="{duration}"/> <testCase name="MapGenerator can be skipped forward efficiently" duration="{duration}"/> + <testCase name="MapGenerator can be skipped forward efficiently/via calls to next()" duration="{duration}"/> + <testCase name="MapGenerator can be skipped forward efficiently/via calls to skipToNthElement()" duration="{duration}"/> + <testCase name="MapGenerator can handle not default constructible types" duration="{duration}"/> <testCase name="RandomGenerator reports itself as infinite - float" duration="{duration}"/> <testCase name="RandomGenerator reports itself as infinite - int" duration="{duration}"/> <testCase name="RandomGenerator reports itself as infinite - long double" duration="{duration}"/> diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt index e5f640e2..b6e218e3 100644 --- a/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -2063,21 +2063,47 @@ ok {test-number} - with 1 message: 'was called' # MapGenerator can be skipped forward efficiently ok {test-number} - map_calls == 0 for: 0 == 0 # MapGenerator can be skipped forward efficiently +ok {test-number} - map_calls == 0 for: 0 == 0 +# MapGenerator can be skipped forward efficiently +ok {test-number} - map_generator.get() == 3 for: 3 == 3 +# MapGenerator can be skipped forward efficiently +ok {test-number} - map_calls == 1 for: 1 == 1 +# MapGenerator can be skipped forward efficiently +ok {test-number} - map_generator.get() == 3 for: 3 == 3 +# MapGenerator can be skipped forward efficiently +ok {test-number} - map_calls == 1 for: 1 == 1 +# MapGenerator can be skipped forward efficiently +ok {test-number} - map_calls == 1 for: 1 == 1 +# MapGenerator can be skipped forward efficiently +ok {test-number} - map_calls == 0 for: 0 == 0 +# MapGenerator can be skipped forward efficiently +ok {test-number} - map_calls == 0 for: 0 == 0 +# MapGenerator can be skipped forward efficiently ok {test-number} - map_generator.get() == 4 for: 4 == 4 # MapGenerator can be skipped forward efficiently -ok {test-number} - map_calls == map_calls_1 + 1 for: 1 == 1 +ok {test-number} - map_calls == 1 for: 1 == 1 # MapGenerator can be skipped forward efficiently ok {test-number} - map_generator.get() == 4 for: 4 == 4 # MapGenerator can be skipped forward efficiently -ok {test-number} - map_calls == map_calls_1 + 1 for: 1 == 1 +ok {test-number} - map_calls == 1 for: 1 == 1 +# MapGenerator can be skipped forward efficiently +ok {test-number} - map_calls == 1 for: 1 == 1 # MapGenerator can be skipped forward efficiently ok {test-number} - map_generator.get() == 6 for: 6 == 6 # MapGenerator can be skipped forward efficiently -ok {test-number} - map_calls == map_calls_2 + 1 for: 2 == 2 +ok {test-number} - map_calls == 2 for: 2 == 2 # MapGenerator can be skipped forward efficiently ok {test-number} - map_generator.skipToNthElement( 7 ) # MapGenerator can be skipped forward efficiently -ok {test-number} - map_calls == map_calls_2 + 1 for: 2 == 2 +ok {test-number} - map_calls == 2 for: 2 == 2 +# MapGenerator can handle not default constructible types +ok {test-number} - map_generator.get().m_i == 1 for: 1 == 1 +# MapGenerator can handle not default constructible types +ok {test-number} - map_generator.next() for: true +# MapGenerator can handle not default constructible types +ok {test-number} - map_generator.next() for: true +# MapGenerator can handle not default constructible types +ok {test-number} - map_generator.get().m_i == 3 for: 3 == 3 # Matchers can be (AllOf) composed with the && operator ok {test-number} - testStringForMatching(), ContainsSubstring( "string" ) && ContainsSubstring( "abc" ) && ContainsSubstring( "substring" ) && ContainsSubstring( "contains" ) for: "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" and contains: "substring" and contains: "contains" ) # Matchers can be (AnyOf) composed with the || operator @@ -4819,5 +4845,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2412 +1..2425 diff --git a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt index 4e64b316..2defcecc 100644 --- a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt @@ -2061,21 +2061,47 @@ ok {test-number} - with 1 message: 'was called' # MapGenerator can be skipped forward efficiently ok {test-number} - map_calls == 0 for: 0 == 0 # MapGenerator can be skipped forward efficiently +ok {test-number} - map_calls == 0 for: 0 == 0 +# MapGenerator can be skipped forward efficiently +ok {test-number} - map_generator.get() == 3 for: 3 == 3 +# MapGenerator can be skipped forward efficiently +ok {test-number} - map_calls == 1 for: 1 == 1 +# MapGenerator can be skipped forward efficiently +ok {test-number} - map_generator.get() == 3 for: 3 == 3 +# MapGenerator can be skipped forward efficiently +ok {test-number} - map_calls == 1 for: 1 == 1 +# MapGenerator can be skipped forward efficiently +ok {test-number} - map_calls == 1 for: 1 == 1 +# MapGenerator can be skipped forward efficiently +ok {test-number} - map_calls == 0 for: 0 == 0 +# MapGenerator can be skipped forward efficiently +ok {test-number} - map_calls == 0 for: 0 == 0 +# MapGenerator can be skipped forward efficiently ok {test-number} - map_generator.get() == 4 for: 4 == 4 # MapGenerator can be skipped forward efficiently -ok {test-number} - map_calls == map_calls_1 + 1 for: 1 == 1 +ok {test-number} - map_calls == 1 for: 1 == 1 # MapGenerator can be skipped forward efficiently ok {test-number} - map_generator.get() == 4 for: 4 == 4 # MapGenerator can be skipped forward efficiently -ok {test-number} - map_calls == map_calls_1 + 1 for: 1 == 1 +ok {test-number} - map_calls == 1 for: 1 == 1 +# MapGenerator can be skipped forward efficiently +ok {test-number} - map_calls == 1 for: 1 == 1 # MapGenerator can be skipped forward efficiently ok {test-number} - map_generator.get() == 6 for: 6 == 6 # MapGenerator can be skipped forward efficiently -ok {test-number} - map_calls == map_calls_2 + 1 for: 2 == 2 +ok {test-number} - map_calls == 2 for: 2 == 2 # MapGenerator can be skipped forward efficiently ok {test-number} - map_generator.skipToNthElement( 7 ) # MapGenerator can be skipped forward efficiently -ok {test-number} - map_calls == map_calls_2 + 1 for: 2 == 2 +ok {test-number} - map_calls == 2 for: 2 == 2 +# MapGenerator can handle not default constructible types +ok {test-number} - map_generator.get().m_i == 1 for: 1 == 1 +# MapGenerator can handle not default constructible types +ok {test-number} - map_generator.next() for: true +# MapGenerator can handle not default constructible types +ok {test-number} - map_generator.next() for: true +# MapGenerator can handle not default constructible types +ok {test-number} - map_generator.get().m_i == 3 for: 3 == 3 # Matchers can be (AllOf) composed with the && operator ok {test-number} - testStringForMatching(), ContainsSubstring( "string" ) && ContainsSubstring( "abc" ) && ContainsSubstring( "substring" ) && ContainsSubstring( "contains" ) for: "this string contains 'abc' as a substring" ( contains: "string" and contains: "abc" and contains: "substring" and contains: "contains" ) # Matchers can be (AnyOf) composed with the || operator @@ -4808,5 +4834,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2412 +1..2425 diff --git a/tests/SelfTest/Baselines/teamcity.sw.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.approved.txt index ccd012ba..57344d01 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.approved.txt @@ -476,6 +476,8 @@ ##teamcity[testFinished name='ManuallyRegistered' duration="{duration}"] ##teamcity[testStarted name='MapGenerator can be skipped forward efficiently'] ##teamcity[testFinished name='MapGenerator can be skipped forward efficiently' duration="{duration}"] +##teamcity[testStarted name='MapGenerator can handle not default constructible types'] +##teamcity[testFinished name='MapGenerator can handle not default constructible types' duration="{duration}"] ##teamcity[testStarted name='Matchers can be (AllOf) composed with the && operator'] ##teamcity[testFinished name='Matchers can be (AllOf) composed with the && operator' duration="{duration}"] ##teamcity[testStarted name='Matchers can be (AnyOf) composed with the |||| operator'] diff --git a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt index f89bcde6..9634d705 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt @@ -476,6 +476,8 @@ ##teamcity[testFinished name='ManuallyRegistered' duration="{duration}"] ##teamcity[testStarted name='MapGenerator can be skipped forward efficiently'] ##teamcity[testFinished name='MapGenerator can be skipped forward efficiently' duration="{duration}"] +##teamcity[testStarted name='MapGenerator can handle not default constructible types'] +##teamcity[testFinished name='MapGenerator can handle not default constructible types' duration="{duration}"] ##teamcity[testStarted name='Matchers can be (AllOf) composed with the && operator'] ##teamcity[testFinished name='Matchers can be (AllOf) composed with the && operator' duration="{duration}"] ##teamcity[testStarted name='Matchers can be (AnyOf) composed with the |||| operator'] diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt index f104f74b..ed263d43 100644 --- a/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -9925,41 +9925,162 @@ Approx( 1.21999999999999997 ) <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="MapGenerator can be skipped forward efficiently" tags="[generators][map]" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="via calls to next()" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_generator.get() == 3 + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_generator.get() == 3 + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="7" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="via calls to skipToNthElement()" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_generator.get() == 4 + </Original> + <Expanded> + 4 == 4 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_generator.get() == 4 + </Original> + <Expanded> + 4 == 4 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_generator.get() == 6 + </Original> + <Expanded> + 6 == 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_generator.skipToNthElement( 7 ) + </Original> + <Expanded> + map_generator.skipToNthElement( 7 ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <OverallResults successes="11" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="MapGenerator can handle not default constructible types" tags="[generators][map]" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Original> - map_calls == 0 - </Original> - <Expanded> - 0 == 0 - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > - <Original> - map_generator.get() == 4 - </Original> - <Expanded> - 4 == 4 - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > - <Original> - map_calls == map_calls_1 + 1 - </Original> - <Expanded> - 1 == 1 - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > - <Original> - map_generator.get() == 4 - </Original> - <Expanded> - 4 == 4 - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > - <Original> - map_calls == map_calls_1 + 1 + map_generator.get().m_i == 1 </Original> <Expanded> 1 == 1 @@ -9967,34 +10088,26 @@ Approx( 1.21999999999999997 ) </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Original> - map_generator.get() == 6 + map_generator.next() </Original> <Expanded> - 6 == 6 + true </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Original> - map_calls == map_calls_2 + 1 + map_generator.next() </Original> <Expanded> - 2 == 2 - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > - <Original> - map_generator.skipToNthElement( 7 ) - </Original> - <Expanded> - map_generator.skipToNthElement( 7 ) + true </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Original> - map_calls == map_calls_2 + 1 + map_generator.get().m_i == 3 </Original> <Expanded> - 2 == 2 + 3 == 3 </Expanded> </Expression> <OverallResult success="true" skips="0"/> @@ -23245,6 +23358,6 @@ Approx( -1.95996398454005449 ) </Section> <OverallResult success="true" skips="0"/> </TestCase> - <OverallResults successes="2199" failures="158" expectedFailures="43" skips="12"/> - <OverallResultsCases successes="329" failures="96" expectedFailures="18" skips="6"/> + <OverallResults successes="2212" failures="158" expectedFailures="43" skips="12"/> + <OverallResultsCases successes="330" failures="96" expectedFailures="18" skips="6"/> </Catch2TestRun> diff --git a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt index 5b993e9b..ea955701 100644 --- a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt @@ -9925,41 +9925,162 @@ Approx( 1.21999999999999997 ) <OverallResult success="true" skips="0"/> </TestCase> <TestCase name="MapGenerator can be skipped forward efficiently" tags="[generators][map]" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Section name="via calls to next()" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_generator.get() == 3 + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_generator.get() == 3 + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="7" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <Section name="via calls to skipToNthElement()" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 0 + </Original> + <Expanded> + 0 == 0 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_generator.get() == 4 + </Original> + <Expanded> + 4 == 4 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_generator.get() == 4 + </Original> + <Expanded> + 4 == 4 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 1 + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_generator.get() == 6 + </Original> + <Expanded> + 6 == 6 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_generator.skipToNthElement( 7 ) + </Original> + <Expanded> + map_generator.skipToNthElement( 7 ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > + <Original> + map_calls == 2 + </Original> + <Expanded> + 2 == 2 + </Expanded> + </Expression> + <OverallResults successes="11" failures="0" expectedFailures="0" skipped="false"/> + </Section> + <OverallResult success="true" skips="0"/> + </TestCase> + <TestCase name="MapGenerator can handle not default constructible types" tags="[generators][map]" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Original> - map_calls == 0 - </Original> - <Expanded> - 0 == 0 - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > - <Original> - map_generator.get() == 4 - </Original> - <Expanded> - 4 == 4 - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > - <Original> - map_calls == map_calls_1 + 1 - </Original> - <Expanded> - 1 == 1 - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > - <Original> - map_generator.get() == 4 - </Original> - <Expanded> - 4 == 4 - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > - <Original> - map_calls == map_calls_1 + 1 + map_generator.get().m_i == 1 </Original> <Expanded> 1 == 1 @@ -9967,34 +10088,26 @@ Approx( 1.21999999999999997 ) </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Original> - map_generator.get() == 6 + map_generator.next() </Original> <Expanded> - 6 == 6 + true </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Original> - map_calls == map_calls_2 + 1 + map_generator.next() </Original> <Expanded> - 2 == 2 - </Expanded> - </Expression> - <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > - <Original> - map_generator.skipToNthElement( 7 ) - </Original> - <Expanded> - map_generator.skipToNthElement( 7 ) + true </Expanded> </Expression> <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" > <Original> - map_calls == map_calls_2 + 1 + map_generator.get().m_i == 3 </Original> <Expanded> - 2 == 2 + 3 == 3 </Expanded> </Expression> <OverallResult success="true" skips="0"/> @@ -23244,6 +23357,6 @@ Approx( -1.95996398454005449 ) </Section> <OverallResult success="true" skips="0"/> </TestCase> - <OverallResults successes="2199" failures="158" expectedFailures="43" skips="12"/> - <OverallResultsCases successes="329" failures="96" expectedFailures="18" skips="6"/> + <OverallResults successes="2212" failures="158" expectedFailures="43" skips="12"/> + <OverallResultsCases successes="330" failures="96" expectedFailures="18" skips="6"/> </Catch2TestRun> diff --git a/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp b/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp index 297c67a9..2c87b0e5 100644 --- a/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp @@ -708,25 +708,46 @@ TEST_CASE("MapGenerator can be skipped forward efficiently", return i; }; - MapGenerator<int, int, decltype(map_func)> map_generator( map_func, values( { 0, 1, 2, 3, 4, 5, 6 } ) ); - REQUIRE( map_calls == 0 ); - const int map_calls_1 = map_calls; - - map_generator.skipToNthElement( 4 ); - REQUIRE( map_generator.get() == 4 ); - REQUIRE( map_calls == map_calls_1 + 1 ); - - map_generator.skipToNthElement( 4 ); - REQUIRE( map_generator.get() == 4 ); - REQUIRE( map_calls == map_calls_1 + 1 ); - - const int map_calls_2 = map_calls; - map_generator.skipToNthElement( 6 ); - REQUIRE( map_generator.get() == 6 ); - REQUIRE( map_calls == map_calls_2 + 1 ); - - REQUIRE_THROWS( map_generator.skipToNthElement( 7 ) ); - REQUIRE( map_calls == map_calls_2 + 1 ); + SECTION( "via calls to next()" ) { + MapGenerator<int, int, decltype( map_func )> map_generator( + map_func, values( { 0, 1, 2, 3, 4, 5, 6 } ) ); + REQUIRE( map_calls == 0 ); + + map_generator.next(); + map_generator.next(); + map_generator.next(); + REQUIRE( map_calls == 0 ); + REQUIRE( map_generator.get() == 3 ); + REQUIRE( map_calls == 1 ); + REQUIRE( map_generator.get() == 3 ); + REQUIRE( map_calls == 1 ); + + map_generator.next(); + REQUIRE( map_calls == 1 ); + } + SECTION("via calls to skipToNthElement()") { + MapGenerator<int, int, decltype( map_func )> map_generator( + map_func, values( { 0, 1, 2, 3, 4, 5, 6 } ) ); + REQUIRE( map_calls == 0 ); + + map_generator.skipToNthElement( 3 ); + map_generator.skipToNthElement( 4 ); + REQUIRE( map_calls == 0 ); + REQUIRE( map_generator.get() == 4 ); + REQUIRE( map_calls == 1 ); + + map_generator.skipToNthElement( 4 ); + REQUIRE( map_generator.get() == 4 ); + REQUIRE( map_calls == 1 ); + + map_generator.skipToNthElement( 6 ); + REQUIRE( map_calls == 1 ); + REQUIRE( map_generator.get() == 6 ); + REQUIRE( map_calls == 2 ); + + REQUIRE_THROWS( map_generator.skipToNthElement( 7 ) ); + REQUIRE( map_calls == 2 ); + } } TEST_CASE( "Generator adapters properly handle isFinite", @@ -791,3 +812,20 @@ TEMPLATE_TEST_CASE( "RandomGenerator reports itself as infinite", long double) { REQUIRE_FALSE( Catch::Generators::random( TestType{ 0 }, TestType{ 100 } ).isFinite() ); } + +namespace { + struct NotDefaultConstructible { + int m_i; + explicit NotDefaultConstructible( int i ): m_i( i ){} + }; +} + +TEST_CASE( "MapGenerator can handle not default constructible types", + "[generators][map]" ) { + using namespace Catch::Generators; + auto map_generator = map( []( int i ) { return NotDefaultConstructible( i ); }, values({1, 2, 3})); + REQUIRE( map_generator.get().m_i == 1 ); + REQUIRE( map_generator.next() ); + REQUIRE( map_generator.next() ); + REQUIRE( map_generator.get().m_i == 3 ); +}