forked from catchorg/Catch2
MapGenerator only calls mapping function if the result is used
Previously the mapping was eager on construction and calls to `next()`. This was fine when generators were always exhausted fully, but with the new generator filtering, we might not want to call the map function eagerly; rather we want to call it only once, after the generator is moved to the target element.
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include <catch2/generators/catch_generators.hpp>
|
||||
#include <catch2/internal/catch_meta.hpp>
|
||||
#include <catch2/internal/catch_move_and_forward.hpp>
|
||||
#include <catch2/internal/catch_optional.hpp>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
@@ -182,7 +183,7 @@ namespace Generators {
|
||||
GeneratorWrapper<U> m_generator;
|
||||
Func m_function;
|
||||
// To avoid returning dangling reference, we have to save the values
|
||||
T m_cache;
|
||||
mutable Optional<T> m_cache;
|
||||
|
||||
void skipToNthElementImpl( std::size_t n ) override {
|
||||
for ( size_t curr = GeneratorUntypedBase::currentElementIndex();
|
||||
@@ -202,19 +203,16 @@ namespace Generators {
|
||||
template <typename F2 = Func>
|
||||
MapGenerator(F2&& function, GeneratorWrapper<U>&& generator) :
|
||||
m_generator(CATCH_MOVE(generator)),
|
||||
m_function(CATCH_FORWARD(function)),
|
||||
m_cache(m_function(m_generator.get()))
|
||||
m_function(CATCH_FORWARD(function))
|
||||
{}
|
||||
|
||||
T const& get() const override {
|
||||
return m_cache;
|
||||
if ( !m_cache ) { m_cache = m_function( m_generator.get() ); }
|
||||
return *m_cache;
|
||||
}
|
||||
bool next() override {
|
||||
const auto success = m_generator.next();
|
||||
if (success) {
|
||||
m_cache = m_function(m_generator.get());
|
||||
}
|
||||
return success;
|
||||
m_cache.reset();
|
||||
return m_generator.next();
|
||||
}
|
||||
|
||||
bool isFinite() const override { return m_generator.isFinite(); }
|
||||
|
||||
@@ -1259,14 +1259,15 @@ 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_generator.get() == 4 for: 4 == 4
|
||||
GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == map_calls_1 + 1 for: 2 == 2
|
||||
GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == map_calls_1 + 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: 2 == 2
|
||||
GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == map_calls_1 + 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: 3 == 3
|
||||
GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == map_calls_2 + 1 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: 3 == 3
|
||||
GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == map_calls_2 + 1 for: 2 == 2
|
||||
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,6 +2985,6 @@ 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: 2399 | 2198 passed | 158 failed | 43 failed as expected
|
||||
assertions: 2400 | 2199 passed | 158 failed | 43 failed as expected
|
||||
|
||||
|
||||
|
||||
@@ -1257,14 +1257,15 @@ 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_generator.get() == 4 for: 4 == 4
|
||||
GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == map_calls_1 + 1 for: 2 == 2
|
||||
GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == map_calls_1 + 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: 2 == 2
|
||||
GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == map_calls_1 + 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: 3 == 3
|
||||
GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == map_calls_2 + 1 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: 3 == 3
|
||||
GeneratorsImpl.tests.cpp:<line number>: passed: map_calls == map_calls_2 + 1 for: 2 == 2
|
||||
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,6 +2974,6 @@ 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: 2399 | 2198 passed | 158 failed | 43 failed as expected
|
||||
assertions: 2400 | 2199 passed | 158 failed | 43 failed as expected
|
||||
|
||||
|
||||
|
||||
@@ -1744,5 +1744,5 @@ due to unexpected exception with message:
|
||||
|
||||
===============================================================================
|
||||
test cases: 449 | 347 passed | 76 failed | 7 skipped | 19 failed as expected
|
||||
assertions: 2377 | 2198 passed | 136 failed | 43 failed as expected
|
||||
assertions: 2378 | 2199 passed | 136 failed | 43 failed as expected
|
||||
|
||||
|
||||
@@ -8260,14 +8260,9 @@ GeneratorsImpl.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( map_generator.get() == 4 )
|
||||
REQUIRE( map_calls == 0 )
|
||||
with expansion:
|
||||
4 == 4
|
||||
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( map_calls == map_calls_1 + 1 )
|
||||
with expansion:
|
||||
2 == 2
|
||||
0 == 0
|
||||
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( map_generator.get() == 4 )
|
||||
@@ -8277,7 +8272,17 @@ with expansion:
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( map_calls == map_calls_1 + 1 )
|
||||
with expansion:
|
||||
2 == 2
|
||||
1 == 1
|
||||
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( map_generator.get() == 4 )
|
||||
with expansion:
|
||||
4 == 4
|
||||
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( map_calls == map_calls_1 + 1 )
|
||||
with expansion:
|
||||
1 == 1
|
||||
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( map_generator.get() == 6 )
|
||||
@@ -8287,7 +8292,7 @@ with expansion:
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( map_calls == map_calls_2 + 1 )
|
||||
with expansion:
|
||||
3 == 3
|
||||
2 == 2
|
||||
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE_THROWS( map_generator.skipToNthElement( 7 ) )
|
||||
@@ -8295,7 +8300,7 @@ GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( map_calls == map_calls_2 + 1 )
|
||||
with expansion:
|
||||
3 == 3
|
||||
2 == 2
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Matchers can be (AllOf) composed with the && operator
|
||||
@@ -20030,5 +20035,5 @@ Misc.tests.cpp:<line number>: PASSED:
|
||||
|
||||
===============================================================================
|
||||
test cases: 449 | 329 passed | 96 failed | 6 skipped | 18 failed as expected
|
||||
assertions: 2399 | 2198 passed | 158 failed | 43 failed as expected
|
||||
assertions: 2400 | 2199 passed | 158 failed | 43 failed as expected
|
||||
|
||||
|
||||
@@ -8258,14 +8258,9 @@ GeneratorsImpl.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( map_generator.get() == 4 )
|
||||
REQUIRE( map_calls == 0 )
|
||||
with expansion:
|
||||
4 == 4
|
||||
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( map_calls == map_calls_1 + 1 )
|
||||
with expansion:
|
||||
2 == 2
|
||||
0 == 0
|
||||
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( map_generator.get() == 4 )
|
||||
@@ -8275,7 +8270,17 @@ with expansion:
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( map_calls == map_calls_1 + 1 )
|
||||
with expansion:
|
||||
2 == 2
|
||||
1 == 1
|
||||
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( map_generator.get() == 4 )
|
||||
with expansion:
|
||||
4 == 4
|
||||
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( map_calls == map_calls_1 + 1 )
|
||||
with expansion:
|
||||
1 == 1
|
||||
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( map_generator.get() == 6 )
|
||||
@@ -8285,7 +8290,7 @@ with expansion:
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( map_calls == map_calls_2 + 1 )
|
||||
with expansion:
|
||||
3 == 3
|
||||
2 == 2
|
||||
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE_THROWS( map_generator.skipToNthElement( 7 ) )
|
||||
@@ -8293,7 +8298,7 @@ GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
GeneratorsImpl.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( map_calls == map_calls_2 + 1 )
|
||||
with expansion:
|
||||
3 == 3
|
||||
2 == 2
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Matchers can be (AllOf) composed with the && operator
|
||||
@@ -20019,5 +20024,5 @@ Misc.tests.cpp:<line number>: PASSED:
|
||||
|
||||
===============================================================================
|
||||
test cases: 449 | 329 passed | 96 failed | 6 skipped | 18 failed as expected
|
||||
assertions: 2399 | 2198 passed | 158 failed | 43 failed as expected
|
||||
assertions: 2400 | 2199 passed | 158 failed | 43 failed as expected
|
||||
|
||||
|
||||
@@ -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="2411" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<testsuite name="<exe-name>" errors="17" failures="141" skipped="12" tests="2412" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<properties>
|
||||
<property name="random-seed" value="1"/>
|
||||
<property name="filters" value=""*" ~[!nonportable] ~[!benchmark] ~[approvals]"/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuites>
|
||||
<testsuite name="<exe-name>" errors="17" failures="141" skipped="12" tests="2411" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<testsuite name="<exe-name>" errors="17" failures="141" skipped="12" tests="2412" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<properties>
|
||||
<property name="random-seed" value="1"/>
|
||||
<property name="filters" value=""*" ~[!nonportable] ~[!benchmark] ~[approvals]"/>
|
||||
|
||||
@@ -2061,21 +2061,23 @@ ok {test-number} - d <= Approx( 1.22 ).epsilon(0.1) for: 1.22999999999999998 <=
|
||||
# ManuallyRegistered
|
||||
ok {test-number} - with 1 message: 'was called'
|
||||
# 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: 2 == 2
|
||||
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: 2 == 2
|
||||
ok {test-number} - map_calls == map_calls_1 + 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
|
||||
# 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: 3 == 3
|
||||
ok {test-number} - map_calls == map_calls_2 + 1 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: 3 == 3
|
||||
ok {test-number} - map_calls == map_calls_2 + 1 for: 2 == 2
|
||||
# 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
|
||||
@@ -4817,5 +4819,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
|
||||
ok {test-number} -
|
||||
# xmlentitycheck
|
||||
ok {test-number} -
|
||||
1..2411
|
||||
1..2412
|
||||
|
||||
|
||||
@@ -2059,21 +2059,23 @@ ok {test-number} - d <= Approx( 1.22 ).epsilon(0.1) for: 1.22999999999999998 <=
|
||||
# ManuallyRegistered
|
||||
ok {test-number} - with 1 message: 'was called'
|
||||
# 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: 2 == 2
|
||||
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: 2 == 2
|
||||
ok {test-number} - map_calls == map_calls_1 + 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
|
||||
# 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: 3 == 3
|
||||
ok {test-number} - map_calls == map_calls_2 + 1 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: 3 == 3
|
||||
ok {test-number} - map_calls == map_calls_2 + 1 for: 2 == 2
|
||||
# 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
|
||||
@@ -4806,5 +4808,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
|
||||
ok {test-number} -
|
||||
# xmlentitycheck
|
||||
ok {test-number} -
|
||||
1..2411
|
||||
1..2412
|
||||
|
||||
|
||||
@@ -9927,18 +9927,10 @@ Approx( 1.21999999999999997 )
|
||||
<TestCase name="MapGenerator can be skipped forward efficiently" 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_generator.get() == 4
|
||||
map_calls == 0
|
||||
</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>
|
||||
2 == 2
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" >
|
||||
@@ -9954,7 +9946,23 @@ Approx( 1.21999999999999997 )
|
||||
map_calls == map_calls_1 + 1
|
||||
</Original>
|
||||
<Expanded>
|
||||
2 == 2
|
||||
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
|
||||
</Original>
|
||||
<Expanded>
|
||||
1 == 1
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" >
|
||||
@@ -9970,7 +9978,7 @@ Approx( 1.21999999999999997 )
|
||||
map_calls == map_calls_2 + 1
|
||||
</Original>
|
||||
<Expanded>
|
||||
3 == 3
|
||||
2 == 2
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" >
|
||||
@@ -9986,7 +9994,7 @@ Approx( 1.21999999999999997 )
|
||||
map_calls == map_calls_2 + 1
|
||||
</Original>
|
||||
<Expanded>
|
||||
3 == 3
|
||||
2 == 2
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true" skips="0"/>
|
||||
@@ -23237,6 +23245,6 @@ Approx( -1.95996398454005449 )
|
||||
</Section>
|
||||
<OverallResult success="true" skips="0"/>
|
||||
</TestCase>
|
||||
<OverallResults successes="2198" failures="158" expectedFailures="43" skips="12"/>
|
||||
<OverallResults successes="2199" failures="158" expectedFailures="43" skips="12"/>
|
||||
<OverallResultsCases successes="329" failures="96" expectedFailures="18" skips="6"/>
|
||||
</Catch2TestRun>
|
||||
|
||||
@@ -9927,18 +9927,10 @@ Approx( 1.21999999999999997 )
|
||||
<TestCase name="MapGenerator can be skipped forward efficiently" 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_generator.get() == 4
|
||||
map_calls == 0
|
||||
</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>
|
||||
2 == 2
|
||||
0 == 0
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" >
|
||||
@@ -9954,7 +9946,23 @@ Approx( 1.21999999999999997 )
|
||||
map_calls == map_calls_1 + 1
|
||||
</Original>
|
||||
<Expanded>
|
||||
2 == 2
|
||||
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
|
||||
</Original>
|
||||
<Expanded>
|
||||
1 == 1
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" >
|
||||
@@ -9970,7 +9978,7 @@ Approx( 1.21999999999999997 )
|
||||
map_calls == map_calls_2 + 1
|
||||
</Original>
|
||||
<Expanded>
|
||||
3 == 3
|
||||
2 == 2
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/GeneratorsImpl.tests.cpp" >
|
||||
@@ -9986,7 +9994,7 @@ Approx( 1.21999999999999997 )
|
||||
map_calls == map_calls_2 + 1
|
||||
</Original>
|
||||
<Expanded>
|
||||
3 == 3
|
||||
2 == 2
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true" skips="0"/>
|
||||
@@ -23236,6 +23244,6 @@ Approx( -1.95996398454005449 )
|
||||
</Section>
|
||||
<OverallResult success="true" skips="0"/>
|
||||
</TestCase>
|
||||
<OverallResults successes="2198" failures="158" expectedFailures="43" skips="12"/>
|
||||
<OverallResults successes="2199" failures="158" expectedFailures="43" skips="12"/>
|
||||
<OverallResultsCases successes="329" failures="96" expectedFailures="18" skips="6"/>
|
||||
</Catch2TestRun>
|
||||
|
||||
@@ -709,6 +709,7 @@ TEST_CASE("MapGenerator can be skipped forward efficiently",
|
||||
};
|
||||
|
||||
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 );
|
||||
|
||||
Reference in New Issue
Block a user