Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
Catch::Matchers::Vector::EqualsMatcher< T > Struct Template Reference

#include <catch_matchers_vector.h>

Inheritance diagram for Catch::Matchers::Vector::EqualsMatcher< T >:
Collaboration diagram for Catch::Matchers::Vector::EqualsMatcher< T >:

Public Member Functions

 EqualsMatcher (std::vector< T > const &comparator)
 
bool match (std::vector< T > const &v) const override
 
std::string describe () const override
 
 EqualsMatcher (std::vector< T > const &comparator)
 
bool match (std::vector< T > const &v) const override
 
std::string describe () const override
 
- Public Member Functions inherited from Catch::Matchers::Impl::MatcherBase< T >
MatchAllOf< Toperator&& (MatcherBase const &other) const
 
MatchAnyOf< Toperator|| (MatcherBase const &other) const
 
MatchNotOf< Toperator! () const
 
MatchAllOf< Toperator&& (MatcherBase const &other) const
 
MatchAnyOf< Toperator|| (MatcherBase const &other) const
 
MatchNotOf< Toperator! () const
 
- Public Member Functions inherited from Catch::Matchers::Impl::MatcherUntypedBase
 MatcherUntypedBase ()=default
 
 MatcherUntypedBase (MatcherUntypedBase const &)=default
 
MatcherUntypedBaseoperator= (MatcherUntypedBase const &)=delete
 
std::string toString () const
 
 MatcherUntypedBase ()=default
 
 MatcherUntypedBase (MatcherUntypedBase const &)=default
 
MatcherUntypedBaseoperator= (MatcherUntypedBase const &)=delete
 
std::string toString () const
 
- Public Member Functions inherited from Catch::Matchers::Impl::MatcherMethod< T >
virtual bool match (T const &arg) const=0
 
virtual bool match (T const &arg) const=0
 

Public Attributes

std::vector< T > const & m_comparator
 

Additional Inherited Members

- Protected Member Functions inherited from Catch::Matchers::Impl::MatcherUntypedBase
virtual ~MatcherUntypedBase ()
 
virtual ~MatcherUntypedBase ()
 
- Protected Attributes inherited from Catch::Matchers::Impl::MatcherUntypedBase
std::string m_cachedToString
 

Detailed Description

template<typename T>
struct Catch::Matchers::Vector::EqualsMatcher< T >

Definition at line 3256 of file catch.hpp.

Constructor & Destructor Documentation

◆ EqualsMatcher() [1/2]

template<typename T >
Catch::Matchers::Vector::EqualsMatcher< T >::EqualsMatcher ( std::vector< T > const & comparator)
inline

Definition at line 74 of file catch_matchers_vector.h.

74: m_comparator( comparator ) {}

◆ EqualsMatcher() [2/2]

template<typename T >
Catch::Matchers::Vector::EqualsMatcher< T >::EqualsMatcher ( std::vector< T > const & comparator)
inline

Definition at line 3258 of file catch.hpp.

3258: m_comparator( comparator ) {}

Member Function Documentation

◆ describe() [1/2]

template<typename T >
std::string Catch::Matchers::Vector::EqualsMatcher< T >::describe ( ) const
inlineoverridevirtual

Implements Catch::Matchers::Impl::MatcherUntypedBase.

Definition at line 88 of file catch_matchers_vector.h.

88 {
89 return "Equals: " + ::Catch::Detail::stringify( m_comparator );
90 }
std::string stringify(const T &e)
Here is the call graph for this function:

◆ describe() [2/2]

template<typename T >
std::string Catch::Matchers::Vector::EqualsMatcher< T >::describe ( ) const
inlineoverridevirtual

Implements Catch::Matchers::Impl::MatcherUntypedBase.

Definition at line 3272 of file catch.hpp.

3272 {
3273 return "Equals: " + ::Catch::Detail::stringify( m_comparator );
3274 }
Here is the call graph for this function:

◆ match() [1/2]

template<typename T >
bool Catch::Matchers::Vector::EqualsMatcher< T >::match ( std::vector< T > const & v) const
inlineoverride

Definition at line 76 of file catch_matchers_vector.h.

76 {
77 // !TBD: This currently works if all elements can be compared using !=
78 // - a more general approach would be via a compare template that defaults
79 // to using !=. but could be specialised for, e.g. std::vector<T> etc
80 // - then just call that directly
81 if (m_comparator.size() != v.size())
82 return false;
83 for (std::size_t i = 0; i < v.size(); ++i)
84 if (m_comparator[i] != v[i])
85 return false;
86 return true;
87 }

◆ match() [2/2]

template<typename T >
bool Catch::Matchers::Vector::EqualsMatcher< T >::match ( std::vector< T > const & v) const
inlineoverride

Definition at line 3260 of file catch.hpp.

3260 {
3261 // !TBD: This currently works if all elements can be compared using !=
3262 // - a more general approach would be via a compare template that defaults
3263 // to using !=. but could be specialised for, e.g. std::vector<T> etc
3264 // - then just call that directly
3265 if (m_comparator.size() != v.size())
3266 return false;
3267 for (std::size_t i = 0; i < v.size(); ++i)
3268 if (m_comparator[i] != v[i])
3269 return false;
3270 return true;
3271 }

Member Data Documentation

◆ m_comparator

template<typename T >
std::vector< T > const & Catch::Matchers::Vector::EqualsMatcher< T >::m_comparator

Definition at line 91 of file catch_matchers_vector.h.


The documentation for this struct was generated from the following files: