diff options
| author | Martin Hořeňovský | 2020-03-28 22:01:17 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2020-03-29 14:03:12 +0200 |
| commit | f7d7aa9eb2dd612fa976edd658407551129d9e49 (patch) | |
| tree | 2c0277e82ea6057e7e77fb3671c675f5425f6378 /tests/SelfTest | |
| parent | ca5af2e85b864ef15e584bc010581491f6be57a7 (diff) | |
| download | catch3-f7d7aa9eb2dd612fa976edd658407551129d9e49.tar.gz | |
Fix and extend tests for composing generic matchers
Diffstat (limited to 'tests/SelfTest')
| -rw-r--r-- | tests/SelfTest/Baselines/compact.sw.approved.txt | 20 | ||||
| -rw-r--r-- | tests/SelfTest/Baselines/console.std.approved.txt | 2 | ||||
| -rw-r--r-- | tests/SelfTest/Baselines/console.sw.approved.txt | 48 | ||||
| -rw-r--r-- | tests/SelfTest/Baselines/junit.sw.approved.txt | 2 | ||||
| -rw-r--r-- | tests/SelfTest/Baselines/tap.sw.approved.txt | 26 | ||||
| -rw-r--r-- | tests/SelfTest/Baselines/xml.sw.approved.txt | 28 | ||||
| -rw-r--r-- | tests/SelfTest/UsageTests/Matchers.tests.cpp | 38 |
7 files changed, 118 insertions, 46 deletions
diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt index 8ae9d726..95bb91ee 100644 --- a/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -283,14 +283,18 @@ ToStringGeneral.tests.cpp:<line number>: passed: c == i for: 2 == 2 ToStringGeneral.tests.cpp:<line number>: passed: c == i for: 3 == 3 ToStringGeneral.tests.cpp:<line number>: passed: c == i for: 4 == 4 ToStringGeneral.tests.cpp:<line number>: passed: c == i for: 5 == 5 -Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype(MatcherA() && MatcherB() && MatcherC()), Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC> >::value' -Matchers.tests.cpp:<line number>: passed: 1, MatcherA() && MatcherB() && MatcherC() for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) -Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype(MatcherA() && MatcherB() && MatcherC() && MatcherD()), Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD> >::value' -Matchers.tests.cpp:<line number>: passed: 1, MatcherA() && MatcherB() && MatcherC() && MatcherD() for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 and equals: true ) -Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype(MatcherA() || MatcherB() || MatcherC()), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> >::value' -Matchers.tests.cpp:<line number>: passed: 1, MatcherA() || MatcherB() || MatcherC() for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) -Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype(MatcherA() || MatcherB() || MatcherC() || MatcherD()), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD> >::value' -Matchers.tests.cpp:<line number>: passed: 1, MatcherA() || MatcherB() || MatcherC() || MatcherD() for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 or equals: true ) +Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype((MatcherA() && MatcherB()) && MatcherC()), Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC> >::value' +Matchers.tests.cpp:<line number>: passed: 1, (MatcherA() && MatcherB()) && MatcherC() for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) +Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype(MatcherA() && (MatcherB() && MatcherC())), Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC> >::value' +Matchers.tests.cpp:<line number>: passed: 1, MatcherA() && (MatcherB() && MatcherC()) for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) +Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype((MatcherA() && MatcherB()) && (MatcherC() && MatcherD())), Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD> >::value' +Matchers.tests.cpp:<line number>: passed: 1, (MatcherA() && MatcherB()) && (MatcherC() && MatcherD()) for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 and equals: true ) +Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype((MatcherA() || MatcherB()) || MatcherC()), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> >::value' +Matchers.tests.cpp:<line number>: passed: 1, (MatcherA() || MatcherB()) || MatcherC() for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) +Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype(MatcherA() || (MatcherB() || MatcherC())), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> >::value' +Matchers.tests.cpp:<line number>: passed: 1, MatcherA() || (MatcherB() || MatcherC()) for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) +Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype((MatcherA() || MatcherB()) || (MatcherC() || MatcherD())), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD> >::value' +Matchers.tests.cpp:<line number>: passed: 1, (MatcherA() || MatcherB()) || (MatcherC() || MatcherD()) for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 or equals: true ) Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype(!MatcherA()), Catch::Matchers::Detail::MatchNotOfGeneric<MatcherA> >::value' Matchers.tests.cpp:<line number>: passed: 0, !MatcherA() for: 0 not equals: (int) 1 or (float) 1.0f Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype(!!MatcherA()), MatcherA const& >::value' diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt index ab80cb77..234837e4 100644 --- a/tests/SelfTest/Baselines/console.std.approved.txt +++ b/tests/SelfTest/Baselines/console.std.approved.txt @@ -1381,5 +1381,5 @@ due to unexpected exception with message: =============================================================================== test cases: 331 | 257 passed | 70 failed | 4 failed as expected -assertions: 1868 | 1716 passed | 131 failed | 21 failed as expected +assertions: 1872 | 1720 passed | 131 failed | 21 failed as expected diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt index 0df71623..9516b0b8 100644 --- a/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.approved.txt @@ -2287,23 +2287,34 @@ Matchers.tests.cpp:<line number> Matchers.tests.cpp:<line number>: PASSED: with message: - std::is_same< decltype(MatcherA() && MatcherB() && MatcherC()), Catch:: + std::is_same< decltype((MatcherA() && MatcherB()) && MatcherC()), Catch:: Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC> >::value Matchers.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( 1, MatcherA() && MatcherB() && MatcherC() ) + REQUIRE_THAT( 1, (MatcherA() && MatcherB()) && MatcherC() ) with expansion: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) Matchers.tests.cpp:<line number>: PASSED: with message: - std::is_same< decltype(MatcherA() && MatcherB() && MatcherC() && MatcherD()), - Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC, - MatcherD> >::value + std::is_same< decltype(MatcherA() && (MatcherB() && MatcherC())), Catch:: + Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC> >::value + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1, MatcherA() && (MatcherB() && MatcherC()) ) +with expansion: + 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) + 1 ) + +Matchers.tests.cpp:<line number>: PASSED: +with message: + std::is_same< decltype((MatcherA() && MatcherB()) && (MatcherC() && MatcherD + ())), Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, + MatcherC, MatcherD> >::value Matchers.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( 1, MatcherA() && MatcherB() && MatcherC() && MatcherD() ) + REQUIRE_THAT( 1, (MatcherA() && MatcherB()) && (MatcherC() && MatcherD()) ) with expansion: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 and equals: true ) @@ -2316,23 +2327,34 @@ Matchers.tests.cpp:<line number> Matchers.tests.cpp:<line number>: PASSED: with message: - std::is_same< decltype(MatcherA() || MatcherB() || MatcherC()), Catch:: + std::is_same< decltype((MatcherA() || MatcherB()) || MatcherC()), Catch:: + Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> >::value + +Matchers.tests.cpp:<line number>: PASSED: + REQUIRE_THAT( 1, (MatcherA() || MatcherB()) || MatcherC() ) +with expansion: + 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 + ) + +Matchers.tests.cpp:<line number>: PASSED: +with message: + std::is_same< decltype(MatcherA() || (MatcherB() || MatcherC())), Catch:: Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> >::value Matchers.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( 1, MatcherA() || MatcherB() || MatcherC() ) + REQUIRE_THAT( 1, MatcherA() || (MatcherB() || MatcherC()) ) with expansion: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) Matchers.tests.cpp:<line number>: PASSED: with message: - std::is_same< decltype(MatcherA() || MatcherB() || MatcherC() || MatcherD()), - Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC, - MatcherD> >::value + std::is_same< decltype((MatcherA() || MatcherB()) || (MatcherC() || MatcherD + ())), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, + MatcherC, MatcherD> >::value Matchers.tests.cpp:<line number>: PASSED: - REQUIRE_THAT( 1, MatcherA() || MatcherB() || MatcherC() || MatcherD() ) + REQUIRE_THAT( 1, (MatcherA() || MatcherB()) || (MatcherC() || MatcherD()) ) with expansion: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 or equals: true ) @@ -14626,5 +14648,5 @@ Misc.tests.cpp:<line number>: PASSED: =============================================================================== test cases: 331 | 241 passed | 86 failed | 4 failed as expected -assertions: 1885 | 1716 passed | 148 failed | 21 failed as expected +assertions: 1889 | 1720 passed | 148 failed | 21 failed as expected diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt index 08e14692..de0e9c6b 100644 --- a/tests/SelfTest/Baselines/junit.sw.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <testsuitesloose text artifact > - <testsuite name="<exe-name>" errors="17" failures="132" tests="1886" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> + <testsuite name="<exe-name>" errors="17" failures="132" tests="1890" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <properties> <property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/> <property name="random-seed" value="1"/> diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt index fc186d97..0168d313 100644 --- a/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -565,21 +565,29 @@ ok {test-number} - c == i for: 4 == 4 # Character pretty printing ok {test-number} - c == i for: 5 == 5 # Combining MatchAllOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype(MatcherA() && MatcherB() && MatcherC()), Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC> >::value' +ok {test-number} - with 1 message: 'std::is_same< decltype((MatcherA() && MatcherB()) && MatcherC()), Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC> >::value' # Combining MatchAllOfGeneric does not nest -ok {test-number} - 1, MatcherA() && MatcherB() && MatcherC() for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) +ok {test-number} - 1, (MatcherA() && MatcherB()) && MatcherC() for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) # Combining MatchAllOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype(MatcherA() && MatcherB() && MatcherC() && MatcherD()), Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD> >::value' +ok {test-number} - with 1 message: 'std::is_same< decltype(MatcherA() && (MatcherB() && MatcherC())), Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC> >::value' # Combining MatchAllOfGeneric does not nest -ok {test-number} - 1, MatcherA() && MatcherB() && MatcherC() && MatcherD() for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 and equals: true ) +ok {test-number} - 1, MatcherA() && (MatcherB() && MatcherC()) for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) +# Combining MatchAllOfGeneric does not nest +ok {test-number} - with 1 message: 'std::is_same< decltype((MatcherA() && MatcherB()) && (MatcherC() && MatcherD())), Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD> >::value' +# Combining MatchAllOfGeneric does not nest +ok {test-number} - 1, (MatcherA() && MatcherB()) && (MatcherC() && MatcherD()) for: 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 and equals: true ) +# Combining MatchAnyOfGeneric does not nest +ok {test-number} - with 1 message: 'std::is_same< decltype((MatcherA() || MatcherB()) || MatcherC()), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> >::value' +# Combining MatchAnyOfGeneric does not nest +ok {test-number} - 1, (MatcherA() || MatcherB()) || MatcherC() for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) # Combining MatchAnyOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype(MatcherA() || MatcherB() || MatcherC()), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> >::value' +ok {test-number} - with 1 message: 'std::is_same< decltype(MatcherA() || (MatcherB() || MatcherC())), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> >::value' # Combining MatchAnyOfGeneric does not nest -ok {test-number} - 1, MatcherA() || MatcherB() || MatcherC() for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) +ok {test-number} - 1, MatcherA() || (MatcherB() || MatcherC()) for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) # Combining MatchAnyOfGeneric does not nest -ok {test-number} - with 1 message: 'std::is_same< decltype(MatcherA() || MatcherB() || MatcherC() || MatcherD()), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD> >::value' +ok {test-number} - with 1 message: 'std::is_same< decltype((MatcherA() || MatcherB()) || (MatcherC() || MatcherD())), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD> >::value' # Combining MatchAnyOfGeneric does not nest -ok {test-number} - 1, MatcherA() || MatcherB() || MatcherC() || MatcherD() for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 or equals: true ) +ok {test-number} - 1, (MatcherA() || MatcherB()) || (MatcherC() || MatcherD()) for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 or equals: true ) # Combining MatchNotOfGeneric does not nest ok {test-number} - with 1 message: 'std::is_same< decltype(!MatcherA()), Catch::Matchers::Detail::MatchNotOfGeneric<MatcherA> >::value' # Combining MatchNotOfGeneric does not nest @@ -3762,5 +3770,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..1877 +1..1881 diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt index 0a9a0255..b1c59382 100644 --- a/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -2613,7 +2613,7 @@ Nor would this <TestCase name="Combining MatchAllOfGeneric does not nest" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Original> - 1, MatcherA() && MatcherB() && MatcherC() + 1, (MatcherA() && MatcherB()) && MatcherC() </Original> <Expanded> 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) @@ -2621,7 +2621,15 @@ Nor would this </Expression> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Original> - 1, MatcherA() && MatcherB() && MatcherC() && MatcherD() + 1, MatcherA() && (MatcherB() && MatcherC()) + </Original> + <Expanded> + 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1, (MatcherA() && MatcherB()) && (MatcherC() && MatcherD()) </Original> <Expanded> 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 and equals: true ) @@ -2632,7 +2640,15 @@ Nor would this <TestCase name="Combining MatchAnyOfGeneric does not nest" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Original> - 1, MatcherA() || MatcherB() || MatcherC() + 1, (MatcherA() || MatcherB()) || MatcherC() + </Original> + <Expanded> + 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > + <Original> + 1, MatcherA() || (MatcherB() || MatcherC()) </Original> <Expanded> 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) @@ -2640,7 +2656,7 @@ Nor would this </Expression> <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Original> - 1, MatcherA() || MatcherB() || MatcherC() || MatcherD() + 1, (MatcherA() || MatcherB()) || (MatcherC() || MatcherD()) </Original> <Expanded> 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 or equals: true ) @@ -17541,7 +17557,7 @@ loose text artifact </Section> <OverallResult success="true"/> </TestCase> - <OverallResults successes="1716" failures="149" expectedFailures="21"/> + <OverallResults successes="1720" failures="149" expectedFailures="21"/> </Group> - <OverallResults successes="1716" failures="148" expectedFailures="21"/> + <OverallResults successes="1720" failures="148" expectedFailures="21"/> </Catch> diff --git a/tests/SelfTest/UsageTests/Matchers.tests.cpp b/tests/SelfTest/UsageTests/Matchers.tests.cpp index 15c6e4cf..2efc4397 100644 --- a/tests/SelfTest/UsageTests/Matchers.tests.cpp +++ b/tests/SelfTest/UsageTests/Matchers.tests.cpp @@ -678,35 +678,57 @@ namespace { namespace MatchersTests { } TEST_CASE("Combining MatchAnyOfGeneric does not nest", "[matchers][templated]") { + // MatchAnyOfGeneric LHS + some matcher RHS STATIC_REQUIRE(std::is_same< - decltype(MatcherA() || MatcherB() || MatcherC()), + decltype((MatcherA() || MatcherB()) || MatcherC()), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> >::value); - REQUIRE_THAT(1, MatcherA() || MatcherB() || MatcherC()); + REQUIRE_THAT(1, (MatcherA() || MatcherB()) || MatcherC()); + // some matcher LHS + MatchAnyOfGeneric RHS STATIC_REQUIRE(std::is_same< - decltype(MatcherA() || MatcherB() || MatcherC() || MatcherD()), + decltype(MatcherA() || (MatcherB() || MatcherC())), + Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> + >::value); + + REQUIRE_THAT(1, MatcherA() || (MatcherB() || MatcherC())); + + + // MatchAnyOfGeneric LHS + MatchAnyOfGeneric RHS + STATIC_REQUIRE(std::is_same< + decltype((MatcherA() || MatcherB()) || (MatcherC() || MatcherD())), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD> >::value); - REQUIRE_THAT(1, MatcherA() || MatcherB() || MatcherC() || MatcherD()); + REQUIRE_THAT(1, (MatcherA() || MatcherB()) || (MatcherC() || MatcherD())); } TEST_CASE("Combining MatchAllOfGeneric does not nest", "[matchers][templated]") { + // MatchAllOfGeneric lhs + some matcher RHS STATIC_REQUIRE(std::is_same< - decltype(MatcherA() && MatcherB() && MatcherC()), + decltype((MatcherA() && MatcherB()) && MatcherC()), Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC> >::value); - REQUIRE_THAT(1, MatcherA() && MatcherB() && MatcherC()); + REQUIRE_THAT(1, (MatcherA() && MatcherB()) && MatcherC()); + + // some matcher LHS + MatchAllOfGeneric RSH + STATIC_REQUIRE(std::is_same< + decltype(MatcherA() && (MatcherB() && MatcherC())), + Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC> + >::value); + + REQUIRE_THAT(1, MatcherA() && (MatcherB() && MatcherC())); + + // MatchAllOfGeneric LHS + MatchAllOfGeneric RHS STATIC_REQUIRE(std::is_same< - decltype(MatcherA() && MatcherB() && MatcherC() && MatcherD()), + decltype((MatcherA() && MatcherB()) && (MatcherC() && MatcherD())), Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD> >::value); - REQUIRE_THAT(1, MatcherA() && MatcherB() && MatcherC() && MatcherD()); + REQUIRE_THAT(1, (MatcherA() && MatcherB()) && (MatcherC() && MatcherD())); } TEST_CASE("Combining MatchNotOfGeneric does not nest", "[matchers][templated]") { |