mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-23 11:43:29 +01:00
Removed vestigal ComparatorT template arg to MatcherBase
This commit is contained in:
parent
b74d4ca96d
commit
3537b7858f
@ -43,13 +43,13 @@ namespace Matchers {
|
|||||||
virtual bool match( PtrT* arg ) const = 0;
|
virtual bool match( PtrT* arg ) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename ObjectT, typename ComparatorT = ObjectT>
|
template<typename T>
|
||||||
struct MatcherBase : MatcherUntypedBase, MatcherMethod<ObjectT> {
|
struct MatcherBase : MatcherUntypedBase, MatcherMethod<T> {
|
||||||
|
|
||||||
|
|
||||||
MatchAllOf<ComparatorT> operator && ( MatcherBase const& other ) const;
|
MatchAllOf<T> operator && ( MatcherBase const& other ) const;
|
||||||
MatchAnyOf<ComparatorT> operator || ( MatcherBase const& other ) const;
|
MatchAnyOf<T> operator || ( MatcherBase const& other ) const;
|
||||||
MatchNotOf<ComparatorT> operator ! () const;
|
MatchNotOf<T> operator ! () const;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename ArgT>
|
template<typename ArgT>
|
||||||
@ -133,17 +133,17 @@ namespace Matchers {
|
|||||||
MatcherBase<ArgT> const& m_underlyingMatcher;
|
MatcherBase<ArgT> const& m_underlyingMatcher;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename ObjectT, typename ComparatorT>
|
template<typename T>
|
||||||
MatchAllOf<ComparatorT> MatcherBase<ObjectT, ComparatorT>::operator && ( MatcherBase const& other ) const {
|
MatchAllOf<T> MatcherBase<T>::operator && ( MatcherBase const& other ) const {
|
||||||
return MatchAllOf<ComparatorT>() && *this && other;
|
return MatchAllOf<T>() && *this && other;
|
||||||
}
|
}
|
||||||
template<typename ObjectT, typename ComparatorT>
|
template<typename T>
|
||||||
MatchAnyOf<ComparatorT> MatcherBase<ObjectT, ComparatorT>::operator || ( MatcherBase const& other ) const {
|
MatchAnyOf<T> MatcherBase<T>::operator || ( MatcherBase const& other ) const {
|
||||||
return MatchAnyOf<ComparatorT>() || *this || other;
|
return MatchAnyOf<T>() || *this || other;
|
||||||
}
|
}
|
||||||
template<typename ObjectT, typename ComparatorT>
|
template<typename T>
|
||||||
MatchNotOf<ComparatorT> MatcherBase<ObjectT, ComparatorT>::operator ! () const {
|
MatchNotOf<T> MatcherBase<T>::operator ! () const {
|
||||||
return MatchNotOf<ComparatorT>( *this );
|
return MatchNotOf<T>( *this );
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Impl
|
} // namespace Impl
|
||||||
|
@ -16,7 +16,7 @@ namespace Matchers {
|
|||||||
namespace Vector {
|
namespace Vector {
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct ContainsElementMatcher : MatcherBase<std::vector<T>, T> {
|
struct ContainsElementMatcher : MatcherBase<std::vector<T>> {
|
||||||
|
|
||||||
ContainsElementMatcher(T const &comparator) : m_comparator( comparator) {}
|
ContainsElementMatcher(T const &comparator) : m_comparator( comparator) {}
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ namespace Matchers {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct ContainsMatcher : MatcherBase<std::vector<T>, std::vector<T> > {
|
struct ContainsMatcher : MatcherBase<std::vector<T>> {
|
||||||
|
|
||||||
ContainsMatcher(std::vector<T> const &comparator) : m_comparator( comparator ) {}
|
ContainsMatcher(std::vector<T> const &comparator) : m_comparator( comparator ) {}
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ namespace Matchers {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct EqualsMatcher : MatcherBase<std::vector<T>, std::vector<T> > {
|
struct EqualsMatcher : MatcherBase<std::vector<T>> {
|
||||||
|
|
||||||
EqualsMatcher(std::vector<T> const &comparator) : m_comparator( comparator ) {}
|
EqualsMatcher(std::vector<T> const &comparator) : m_comparator( comparator ) {}
|
||||||
|
|
||||||
|
@ -1004,5 +1004,5 @@ with expansion:
|
|||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 188 | 137 passed | 47 failed | 4 failed as expected
|
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
|
||||||
|
|
||||||
|
@ -6317,6 +6317,19 @@ PASSED:
|
|||||||
with expansion:
|
with expansion:
|
||||||
{ } Contains: { }
|
{ } Contains: { }
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Vector matchers
|
||||||
|
Contains (element), composed
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
MatchersTests.cpp:<line number>
|
||||||
|
...............................................................................
|
||||||
|
|
||||||
|
MatchersTests.cpp:<line number>:
|
||||||
|
PASSED:
|
||||||
|
CHECK_THAT( v, VectorContains( 1 ) && VectorContains( 2 ) )
|
||||||
|
with expansion:
|
||||||
|
{ 1, 2, 3 } ( Contains: 1 and Contains: 2 )
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Vector matchers
|
Vector matchers
|
||||||
Equals
|
Equals
|
||||||
@ -7891,5 +7904,5 @@ PASSED:
|
|||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
test cases: 188 | 135 passed | 49 failed | 4 failed as expected
|
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
|
||||||
|
|
||||||
|
@ -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="15" failures="85" tests="939" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
<testsuite name="<exe-name>" errors="15" failures="85" tests="940" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||||
<testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="#1005: Comparing pointer to int and long (NULL can be either on various systems)" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="#1005: Comparing pointer to int and long (NULL can be either on various systems)" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="#1027" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="#1027" time="{duration}"/>
|
||||||
@ -580,6 +580,7 @@ ExceptionTests.cpp:<line number>
|
|||||||
<testcase classname="<exe-name>.global" name="Variadic macros/Section with one argument" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="Variadic macros/Section with one argument" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="Vector matchers/Contains (element)" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="Vector matchers/Contains (element)" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="Vector matchers/Contains (vector)" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="Vector matchers/Contains (vector)" time="{duration}"/>
|
||||||
|
<testcase classname="<exe-name>.global" name="Vector matchers/Contains (element), composed" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="Vector matchers/Equals" time="{duration}"/>
|
<testcase classname="<exe-name>.global" name="Vector matchers/Equals" time="{duration}"/>
|
||||||
<testcase classname="<exe-name>.global" name="Vector matchers that fail/Contains (element)" time="{duration}">
|
<testcase classname="<exe-name>.global" name="Vector matchers that fail/Contains (element)" time="{duration}">
|
||||||
<failure message="{ 1, 2, 3 } Contains: -1" type="CHECK_THAT">
|
<failure message="{ 1, 2, 3 } Contains: -1" type="CHECK_THAT">
|
||||||
|
@ -7161,6 +7161,17 @@ Message from section two
|
|||||||
</Expression>
|
</Expression>
|
||||||
<OverallResults successes="4" failures="0" expectedFailures="0"/>
|
<OverallResults successes="4" failures="0" expectedFailures="0"/>
|
||||||
</Section>
|
</Section>
|
||||||
|
<Section name="Contains (element), composed" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||||
|
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||||
|
<Original>
|
||||||
|
v, VectorContains( 1 ) && VectorContains( 2 )
|
||||||
|
</Original>
|
||||||
|
<Expanded>
|
||||||
|
{ 1, 2, 3 } ( Contains: 1 and Contains: 2 )
|
||||||
|
</Expanded>
|
||||||
|
</Expression>
|
||||||
|
<OverallResults successes="1" failures="0" expectedFailures="0"/>
|
||||||
|
</Section>
|
||||||
<Section name="Equals" filename="projects/<exe-name>/MatchersTests.cpp" >
|
<Section name="Equals" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||||
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
<Expression success="true" type="CHECK_THAT" filename="projects/<exe-name>/MatchersTests.cpp" >
|
||||||
<Original>
|
<Original>
|
||||||
@ -8753,7 +8764,7 @@ loose text artifact
|
|||||||
</Section>
|
</Section>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
</TestCase>
|
</TestCase>
|
||||||
<OverallResults successes="818" failures="100" expectedFailures="21"/>
|
<OverallResults successes="819" failures="100" expectedFailures="21"/>
|
||||||
</Group>
|
</Group>
|
||||||
<OverallResults successes="818" failures="99" expectedFailures="21"/>
|
<OverallResults successes="819" failures="99" expectedFailures="21"/>
|
||||||
</Catch>
|
</Catch>
|
||||||
|
@ -122,6 +122,9 @@ TEST_CASE( "Vector matchers", "[matchers][vector]" ) {
|
|||||||
CHECK_THAT( v, Contains( empty) );
|
CHECK_THAT( v, Contains( empty) );
|
||||||
CHECK_THAT( empty, Contains( empty) );
|
CHECK_THAT( empty, Contains( empty) );
|
||||||
}
|
}
|
||||||
|
SECTION( "Contains (element), composed" ) {
|
||||||
|
CHECK_THAT( v, VectorContains( 1 ) && VectorContains( 2 ) );
|
||||||
|
}
|
||||||
|
|
||||||
SECTION( "Equals" ) {
|
SECTION( "Equals" ) {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user