diff options
| author | Martin Hořeňovský | 2023-12-10 16:38:48 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2023-12-10 18:32:45 +0100 |
| commit | 9a1e73568c86644bda84d2d8c719955a050bb3e3 (patch) | |
| tree | 75d7c6de4376580b6ad5c2877e939a7f0cb4189b /tests/SelfTest/UsageTests/Generators.tests.cpp | |
| parent | 21d2da23bc952f99cc400c00c38f7fff45e3da34 (diff) | |
| download | catch3-9a1e73568c86644bda84d2d8c719955a050bb3e3.tar.gz | |
Add test showing literals and complex generators in one GENERATE
Diffstat (limited to 'tests/SelfTest/UsageTests/Generators.tests.cpp')
| -rw-r--r-- | tests/SelfTest/UsageTests/Generators.tests.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/SelfTest/UsageTests/Generators.tests.cpp b/tests/SelfTest/UsageTests/Generators.tests.cpp index 8e2c387a..f04cf4f0 100644 --- a/tests/SelfTest/UsageTests/Generators.tests.cpp +++ b/tests/SelfTest/UsageTests/Generators.tests.cpp @@ -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 ); +} |