mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-02 05:15:39 +02:00
Add test showing literals and complex generators in one GENERATE
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
|
Reference in New Issue
Block a user