Fix and extend tests for composing generic matchers

This commit is contained in:
Martin Hořeňovský 2020-03-28 22:01:17 +01:00
parent ca5af2e85b
commit f7d7aa9eb2
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
8 changed files with 120 additions and 47 deletions

View File

@ -41,7 +41,7 @@ namespace Matchers {
template<std::size_t N> template<std::size_t N>
std::array<void const*, N+1> array_cat(void const* lhs, std::array<void const*, N> && rhs) { std::array<void const*, N+1> array_cat(void const* lhs, std::array<void const*, N> && rhs) {
std::array<void const*, N+1> arr{lhs}; std::array<void const*, N + 1> arr{ {lhs} };
std::copy_n(rhs.begin(), N, arr.begin() + 1); std::copy_n(rhs.begin(), N, arr.begin() + 1);
return arr; return arr;
} }
@ -129,6 +129,7 @@ namespace Matchers {
} }
std::array<void const*, sizeof...(MatcherTs)> m_matchers; std::array<void const*, sizeof...(MatcherTs)> m_matchers;
}; };

View File

@ -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: 3 == 3
ToStringGeneral.tests.cpp:<line number>: passed: c == i for: 4 == 4 ToStringGeneral.tests.cpp:<line number>: passed: c == i for: 4 == 4
ToStringGeneral.tests.cpp:<line number>: passed: c == i for: 5 == 5 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: 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: 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: 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() && 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: 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::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> >::value' 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() for: 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) 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() || MatcherD()), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD> >::value' 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() || 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: 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: 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: 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' Matchers.tests.cpp:<line number>: passed: with 1 message: 'std::is_same< decltype(!!MatcherA()), MatcherA const& >::value'

View File

@ -1381,5 +1381,5 @@ due to unexpected exception with message:
=============================================================================== ===============================================================================
test cases: 331 | 257 passed | 70 failed | 4 failed as expected 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

View File

@ -2287,23 +2287,34 @@ Matchers.tests.cpp:<line number>
Matchers.tests.cpp:<line number>: PASSED: Matchers.tests.cpp:<line number>: PASSED:
with message: 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::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC> >::value
Matchers.tests.cpp:<line number>: PASSED: Matchers.tests.cpp:<line number>: PASSED:
REQUIRE_THAT( 1, MatcherA() && MatcherB() && MatcherC() ) REQUIRE_THAT( 1, (MatcherA() && MatcherB()) && MatcherC() )
with expansion: with expansion:
1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T)
1 ) 1 )
Matchers.tests.cpp:<line number>: PASSED: Matchers.tests.cpp:<line number>: PASSED:
with message: with message:
std::is_same< decltype(MatcherA() && MatcherB() && MatcherC() && MatcherD()), std::is_same< decltype(MatcherA() && (MatcherB() && MatcherC())), Catch::
Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC, Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC> >::value
MatcherD> >::value
Matchers.tests.cpp:<line number>: PASSED: Matchers.tests.cpp:<line number>: PASSED:
REQUIRE_THAT( 1, MatcherA() && MatcherB() && MatcherC() && MatcherD() ) 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()) )
with expansion: with expansion:
1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T)
1 and equals: true ) 1 and equals: true )
@ -2316,23 +2327,34 @@ Matchers.tests.cpp:<line number>
Matchers.tests.cpp:<line number>: PASSED: Matchers.tests.cpp:<line number>: PASSED:
with message: 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::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> >::value
Matchers.tests.cpp:<line number>: PASSED: Matchers.tests.cpp:<line number>: PASSED:
REQUIRE_THAT( 1, MatcherA() || MatcherB() || MatcherC() ) REQUIRE_THAT( 1, (MatcherA() || MatcherB()) || MatcherC() )
with expansion: with expansion:
1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1
) )
Matchers.tests.cpp:<line number>: PASSED: Matchers.tests.cpp:<line number>: PASSED:
with message: with message:
std::is_same< decltype(MatcherA() || MatcherB() || MatcherC() || MatcherD()), std::is_same< decltype(MatcherA() || (MatcherB() || MatcherC())), Catch::
Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC, Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> >::value
MatcherD> >::value
Matchers.tests.cpp:<line number>: PASSED: Matchers.tests.cpp:<line number>: PASSED:
REQUIRE_THAT( 1, MatcherA() || MatcherB() || MatcherC() || MatcherD() ) 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
Matchers.tests.cpp:<line number>: PASSED:
REQUIRE_THAT( 1, (MatcherA() || MatcherB()) || (MatcherC() || MatcherD()) )
with expansion: with expansion:
1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1
or equals: true ) or equals: true )
@ -14626,5 +14648,5 @@ Misc.tests.cpp:<line number>: PASSED:
=============================================================================== ===============================================================================
test cases: 331 | 241 passed | 86 failed | 4 failed as expected 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

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuitesloose text artifact <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> <properties>
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/> <property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/>
<property name="random-seed" value="1"/> <property name="random-seed" value="1"/>

View File

@ -565,21 +565,29 @@ ok {test-number} - c == i for: 4 == 4
# Character pretty printing # Character pretty printing
ok {test-number} - c == i for: 5 == 5 ok {test-number} - c == i for: 5 == 5
# Combining MatchAllOfGeneric does not nest # 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 # 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 # 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 # 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 # 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 # 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 # 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())), Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> >::value'
# Combining MatchAnyOfGeneric does not nest # 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()) 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'
# 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 )
# Combining MatchNotOfGeneric does not nest # Combining MatchNotOfGeneric does not nest
ok {test-number} - with 1 message: 'std::is_same< decltype(!MatcherA()), Catch::Matchers::Detail::MatchNotOfGeneric<MatcherA> >::value' ok {test-number} - with 1 message: 'std::is_same< decltype(!MatcherA()), Catch::Matchers::Detail::MatchNotOfGeneric<MatcherA> >::value'
# Combining MatchNotOfGeneric does not nest # Combining MatchNotOfGeneric does not nest
@ -3762,5 +3770,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
ok {test-number} - ok {test-number} -
# xmlentitycheck # xmlentitycheck
ok {test-number} - ok {test-number} -
1..1877 1..1881

View File

@ -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" > <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" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" >
<Original> <Original>
1, MatcherA() &amp;&amp; MatcherB() &amp;&amp; MatcherC() 1, (MatcherA() &amp;&amp; MatcherB()) &amp;&amp; MatcherC()
</Original> </Original>
<Expanded> <Expanded>
1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 ) 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>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" >
<Original> <Original>
1, MatcherA() &amp;&amp; MatcherB() &amp;&amp; MatcherC() &amp;&amp; MatcherD() 1, MatcherA() &amp;&amp; (MatcherB() &amp;&amp; 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() &amp;&amp; MatcherB()) &amp;&amp; (MatcherC() &amp;&amp; MatcherD())
</Original> </Original>
<Expanded> <Expanded>
1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 and equals: true ) 1 ( equals: (int) 1 or (float) 1.0f and equals: (long long) 1 and equals: (T) 1 and equals: true )
@ -2632,7 +2640,7 @@ Nor would this
<TestCase name="Combining MatchAnyOfGeneric does not nest" tags="[matchers][templated]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <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" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" >
<Original> <Original>
1, MatcherA() || MatcherB() || MatcherC() 1, (MatcherA() || MatcherB()) || MatcherC()
</Original> </Original>
<Expanded> <Expanded>
1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 ) 1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 )
@ -2640,7 +2648,15 @@ Nor would this
</Expression> </Expression>
<Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" >
<Original> <Original>
1, MatcherA() || MatcherB() || MatcherC() || MatcherD() 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() || MatcherD())
</Original> </Original>
<Expanded> <Expanded>
1 ( equals: (int) 1 or (float) 1.0f or equals: (long long) 1 or equals: (T) 1 or equals: true ) 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> </Section>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<OverallResults successes="1716" failures="149" expectedFailures="21"/> <OverallResults successes="1720" failures="149" expectedFailures="21"/>
</Group> </Group>
<OverallResults successes="1716" failures="148" expectedFailures="21"/> <OverallResults successes="1720" failures="148" expectedFailures="21"/>
</Catch> </Catch>

View File

@ -678,35 +678,57 @@ namespace { namespace MatchersTests {
} }
TEST_CASE("Combining MatchAnyOfGeneric does not nest", "[matchers][templated]") { TEST_CASE("Combining MatchAnyOfGeneric does not nest", "[matchers][templated]") {
// MatchAnyOfGeneric LHS + some matcher RHS
STATIC_REQUIRE(std::is_same< STATIC_REQUIRE(std::is_same<
decltype(MatcherA() || MatcherB() || MatcherC()), decltype((MatcherA() || MatcherB()) || MatcherC()),
Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC> Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC>
>::value); >::value);
REQUIRE_THAT(1, MatcherA() || MatcherB() || MatcherC()); REQUIRE_THAT(1, (MatcherA() || MatcherB()) || MatcherC());
// some matcher LHS + MatchAnyOfGeneric RHS
STATIC_REQUIRE(std::is_same< 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> Catch::Matchers::Detail::MatchAnyOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD>
>::value); >::value);
REQUIRE_THAT(1, MatcherA() || MatcherB() || MatcherC() || MatcherD()); REQUIRE_THAT(1, (MatcherA() || MatcherB()) || (MatcherC() || MatcherD()));
} }
TEST_CASE("Combining MatchAllOfGeneric does not nest", "[matchers][templated]") { TEST_CASE("Combining MatchAllOfGeneric does not nest", "[matchers][templated]") {
// MatchAllOfGeneric lhs + some matcher RHS
STATIC_REQUIRE(std::is_same< STATIC_REQUIRE(std::is_same<
decltype(MatcherA() && MatcherB() && MatcherC()), decltype((MatcherA() && MatcherB()) && MatcherC()),
Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC> Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC>
>::value); >::value);
REQUIRE_THAT(1, MatcherA() && MatcherB() && MatcherC()); REQUIRE_THAT(1, (MatcherA() && MatcherB()) && MatcherC());
// some matcher LHS + MatchAllOfGeneric RSH
STATIC_REQUIRE(std::is_same< STATIC_REQUIRE(std::is_same<
decltype(MatcherA() && MatcherB() && MatcherC() && MatcherD()), 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())),
Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD> Catch::Matchers::Detail::MatchAllOfGeneric<MatcherA, MatcherB, MatcherC, MatcherD>
>::value); >::value);
REQUIRE_THAT(1, MatcherA() && MatcherB() && MatcherC() && MatcherD()); REQUIRE_THAT(1, (MatcherA() && MatcherB()) && (MatcherC() && MatcherD()));
} }
TEST_CASE("Combining MatchNotOfGeneric does not nest", "[matchers][templated]") { TEST_CASE("Combining MatchNotOfGeneric does not nest", "[matchers][templated]") {