Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/tests/SelfTest/UsageTests/Generators.tests.cpp
diff options
context:
space:
mode:
authorMartin Hořeňovský2026-01-12 14:10:25 +0100
committerMartin Hořeňovský2026-01-12 14:27:49 +0100
commit44c597f0742b491399994afa00070b99d3ef2885 (patch)
treedbb0581d1bf101f4423f43b1e1d0ed150ed48ddb /tests/SelfTest/UsageTests/Generators.tests.cpp
parent6aedc79870e7b9122b11810abe195f8cc70fbaa5 (diff)
downloadcatch3-44c597f0742b491399994afa00070b99d3ef2885.tar.gz
Add Concat generator for combining multiple generators
Diffstat (limited to 'tests/SelfTest/UsageTests/Generators.tests.cpp')
-rw-r--r--tests/SelfTest/UsageTests/Generators.tests.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/SelfTest/UsageTests/Generators.tests.cpp b/tests/SelfTest/UsageTests/Generators.tests.cpp
index f04cf4f0..b03192cf 100644
--- a/tests/SelfTest/UsageTests/Generators.tests.cpp
+++ b/tests/SelfTest/UsageTests/Generators.tests.cpp
@@ -321,3 +321,16 @@ TEST_CASE( "GENERATE can combine literals and generators", "[generators]" ) {
random( -100, 100 ) ) ) );
REQUIRE( i % 2 == 0 );
}
+
+TEST_CASE( "cat generator", "[generators][concat]" ) {
+ SECTION("Simple usage") {
+ const int input = GENERATE( cat( value( 0 ) ), cat( value( 1 ), value( 2 ) ) );
+ REQUIRE( input < 3 );
+ }
+ SECTION( "Used in map" ) {
+ const int input = GENERATE(
+ map( []( int i ) { return i * 2; },
+ cat( value( 1 ), take( 4, random( 10, 10'000'000 ) ) ) ) );
+ REQUIRE( input % 2 == 0 );
+ }
+}