From 3537b7858f54730f501e24d17582603c0d0d7d0b Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Mon, 13 Nov 2017 10:06:26 +0000 Subject: [PATCH] Removed vestigal ComparatorT template arg to MatcherBase --- include/internal/catch_matchers.h | 28 +++++++++---------- include/internal/catch_matchers_vector.h | 6 ++-- .../Baselines/console.std.approved.txt | 2 +- .../Baselines/console.sw.approved.txt | 15 +++++++++- .../SelfTest/Baselines/junit.sw.approved.txt | 3 +- .../SelfTest/Baselines/xml.sw.approved.txt | 15 ++++++++-- projects/SelfTest/MatchersTests.cpp | 3 ++ 7 files changed, 50 insertions(+), 22 deletions(-) diff --git a/include/internal/catch_matchers.h b/include/internal/catch_matchers.h index 8c15d425..f2e3aee9 100644 --- a/include/internal/catch_matchers.h +++ b/include/internal/catch_matchers.h @@ -43,13 +43,13 @@ namespace Matchers { virtual bool match( PtrT* arg ) const = 0; }; - template - struct MatcherBase : MatcherUntypedBase, MatcherMethod { + template + struct MatcherBase : MatcherUntypedBase, MatcherMethod { - MatchAllOf operator && ( MatcherBase const& other ) const; - MatchAnyOf operator || ( MatcherBase const& other ) const; - MatchNotOf operator ! () const; + MatchAllOf operator && ( MatcherBase const& other ) const; + MatchAnyOf operator || ( MatcherBase const& other ) const; + MatchNotOf operator ! () const; }; template @@ -133,17 +133,17 @@ namespace Matchers { MatcherBase const& m_underlyingMatcher; }; - template - MatchAllOf MatcherBase::operator && ( MatcherBase const& other ) const { - return MatchAllOf() && *this && other; + template + MatchAllOf MatcherBase::operator && ( MatcherBase const& other ) const { + return MatchAllOf() && *this && other; } - template - MatchAnyOf MatcherBase::operator || ( MatcherBase const& other ) const { - return MatchAnyOf() || *this || other; + template + MatchAnyOf MatcherBase::operator || ( MatcherBase const& other ) const { + return MatchAnyOf() || *this || other; } - template - MatchNotOf MatcherBase::operator ! () const { - return MatchNotOf( *this ); + template + MatchNotOf MatcherBase::operator ! () const { + return MatchNotOf( *this ); } } // namespace Impl diff --git a/include/internal/catch_matchers_vector.h b/include/internal/catch_matchers_vector.h index ae2741b1..84ffab87 100644 --- a/include/internal/catch_matchers_vector.h +++ b/include/internal/catch_matchers_vector.h @@ -16,7 +16,7 @@ namespace Matchers { namespace Vector { template - struct ContainsElementMatcher : MatcherBase, T> { + struct ContainsElementMatcher : MatcherBase> { ContainsElementMatcher(T const &comparator) : m_comparator( comparator) {} @@ -37,7 +37,7 @@ namespace Matchers { }; template - struct ContainsMatcher : MatcherBase, std::vector > { + struct ContainsMatcher : MatcherBase> { ContainsMatcher(std::vector const &comparator) : m_comparator( comparator ) {} @@ -67,7 +67,7 @@ namespace Matchers { }; template - struct EqualsMatcher : MatcherBase, std::vector > { + struct EqualsMatcher : MatcherBase> { EqualsMatcher(std::vector const &comparator) : m_comparator( comparator ) {} diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index 823e7668..38d1f12a 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -1004,5 +1004,5 @@ with expansion: =============================================================================== test cases: 188 | 137 passed | 47 failed | 4 failed as expected -assertions: 939 | 822 passed | 96 failed | 21 failed as expected +assertions: 940 | 823 passed | 96 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index 3b3e06e9..9b4d9abc 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -6317,6 +6317,19 @@ PASSED: with expansion: { } Contains: { } +------------------------------------------------------------------------------- +Vector matchers + Contains (element), composed +------------------------------------------------------------------------------- +MatchersTests.cpp: +............................................................................... + +MatchersTests.cpp:: +PASSED: + CHECK_THAT( v, VectorContains( 1 ) && VectorContains( 2 ) ) +with expansion: + { 1, 2, 3 } ( Contains: 1 and Contains: 2 ) + ------------------------------------------------------------------------------- Vector matchers Equals @@ -7891,5 +7904,5 @@ PASSED: =============================================================================== test cases: 188 | 135 passed | 49 failed | 4 failed as expected -assertions: 938 | 818 passed | 99 failed | 21 failed as expected +assertions: 939 | 819 passed | 99 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index 5744b3bd..fff51dd5 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ - + @@ -580,6 +580,7 @@ ExceptionTests.cpp: + diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index a00e937d..67d6eff0 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -7161,6 +7161,17 @@ Message from section two +
+ + + v, VectorContains( 1 ) && VectorContains( 2 ) + + + { 1, 2, 3 } ( Contains: 1 and Contains: 2 ) + + + +
@@ -8753,7 +8764,7 @@ loose text artifact
- + - + diff --git a/projects/SelfTest/MatchersTests.cpp b/projects/SelfTest/MatchersTests.cpp index ce4ea0cd..f1da1b36 100644 --- a/projects/SelfTest/MatchersTests.cpp +++ b/projects/SelfTest/MatchersTests.cpp @@ -122,6 +122,9 @@ TEST_CASE( "Vector matchers", "[matchers][vector]" ) { CHECK_THAT( v, Contains( empty) ); CHECK_THAT( empty, Contains( empty) ); } + SECTION( "Contains (element), composed" ) { + CHECK_THAT( v, VectorContains( 1 ) && VectorContains( 2 ) ); + } SECTION( "Equals" ) {