mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Fix and extend tests for composing generic matchers
This commit is contained in:
@@ -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() && 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>
|
||||
>::value);
|
||||
|
||||
REQUIRE_THAT(1, MatcherA() && MatcherB() && MatcherC() && MatcherD());
|
||||
REQUIRE_THAT(1, (MatcherA() && MatcherB()) && (MatcherC() && MatcherD()));
|
||||
}
|
||||
|
||||
TEST_CASE("Combining MatchNotOfGeneric does not nest", "[matchers][templated]") {
|
||||
|
Reference in New Issue
Block a user