Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/tests/SelfTest/UsageTests
diff options
context:
space:
mode:
authorMartin Hořeňovský2020-03-28 22:01:17 +0100
committerMartin Hořeňovský2020-03-29 14:03:12 +0200
commitf7d7aa9eb2dd612fa976edd658407551129d9e49 (patch)
tree2c0277e82ea6057e7e77fb3671c675f5425f6378 /tests/SelfTest/UsageTests
parentca5af2e85b864ef15e584bc010581491f6be57a7 (diff)
downloadcatch3-f7d7aa9eb2dd612fa976edd658407551129d9e49.tar.gz
Fix and extend tests for composing generic matchers
Diffstat (limited to 'tests/SelfTest/UsageTests')
-rw-r--r--tests/SelfTest/UsageTests/Matchers.tests.cpp38
1 files changed, 30 insertions, 8 deletions
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]") {