Add test showing literals and complex generators in one GENERATE

This commit is contained in:
Martin Hořeňovský
2023-12-10 16:38:48 +01:00
parent 21d2da23bc
commit 9a1e73568c
18 changed files with 223 additions and 21 deletions

View File

@@ -305,9 +305,19 @@ namespace {
} // namespace
TEST_CASE( "#2615 - Throwing in constructor generator fails test case but does not abort", "[!shouldfail]" ) {
TEST_CASE( "#2615 - Throwing in constructor generator fails test case but does not abort",
"[!shouldfail][regression][generators]" ) {
// this should fail the test case, but not abort the application
auto sample = GENERATE( make_test_generator() );
// this assertion shouldn't trigger
REQUIRE( sample == 0 );
}
TEST_CASE( "GENERATE can combine literals and generators", "[generators]" ) {
auto i = GENERATE( 2,
4,
take( 2,
filter( []( int val ) { return val % 2 == 0; },
random( -100, 100 ) ) ) );
REQUIRE( i % 2 == 0 );
}