forked from catchorg/Catch2
Add Concat generator for combining multiple generators
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user