diff options
| author | Martin Hořeňovský | 2020-10-20 12:46:31 +0200 |
|---|---|---|
| committer | GitHub | 2020-10-20 12:46:31 +0200 |
| commit | b6a3e2e26b8afabd9a8a89a353662eda9b67097e (patch) | |
| tree | 95bb37846fbbd982a92267b8521fcdc7131596da /tests | |
| parent | 4b2bc8757c6d5a95e163b8a54a122d4c95b84310 (diff) | |
| parent | 6ffac61719934b9a6815267e680045813a125db5 (diff) | |
| download | catch3-b6a3e2e26b8afabd9a8a89a353662eda9b67097e.tar.gz | |
Merge pull request #2058 from catchorg/devel-generators-cache
Fix types in generators: decay types, properly constrain forwarding
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp b/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp index 169cac82..848bb1d9 100644 --- a/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp @@ -358,3 +358,33 @@ TEST_CASE("Multiple random generators in one test case output different values", REQUIRE(same < 200); } } + +TEST_CASE("#2040 - infinite compilation recursion in GENERATE with MSVC", "[generators][compilation][approvals]") { + int x = 42; + auto test = GENERATE_COPY(1, x, 2 * x); + CHECK(test < 100); +} + +namespace { + static bool always_true(int) { + return true; + } + + static bool is_even(int n) { + return n % 2 == 0; + } + + static bool is_multiple_of_3(int n) { + return n % 3 == 0; + } +} + +TEST_CASE("GENERATE handles function (pointers)", "[generators][compilation][approvals]") { + auto f = GENERATE(always_true, is_even, is_multiple_of_3); + REQUIRE(f(6)); +} + +TEST_CASE("GENERATE decays arrays", "[generators][compilation][approvals]") { + auto str = GENERATE("abc", "def", "gh"); + STATIC_REQUIRE(std::is_same<decltype(str), const char*>::value); +} |