diff options
| author | Martin Hořeňovský | 2026-02-15 20:44:17 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2026-02-15 20:44:21 +0100 |
| commit | 056e4fe88d5a779fef221a0d5f105d7a16be9c7a (patch) | |
| tree | 9c1157871d2dee88fe8eb7362c9924cd42711324 /tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp | |
| parent | 3a0cf7e75fdc571ff9ed25303fb268665f6260c0 (diff) | |
| download | catch3-056e4fe88d5a779fef221a0d5f105d7a16be9c7a.tar.gz | |
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.
Diffstat (limited to 'tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp')
| -rw-r--r-- | tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp b/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp index c415686b..297c67a9 100644 --- a/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp @@ -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 ); |