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

#include <catch_matchers_vector.h>

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

Public Member Functions

 ContainsMatcher (std::vector< T > const &comparator)
 
bool match (std::vector< T > const &v) const override
 
std::string describe () const override
 
 ContainsMatcher (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::ContainsMatcher< T >

Definition at line 3226 of file catch.hpp.

Constructor & Destructor Documentation

◆ ContainsMatcher() [1/2]

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

Definition at line 44 of file catch_matchers_vector.h.

44: m_comparator( comparator ) {}

◆ ContainsMatcher() [2/2]

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

Definition at line 3228 of file catch.hpp.

3228: m_comparator( comparator ) {}

Member Function Documentation

◆ describe() [1/2]

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

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

Definition at line 64 of file catch_matchers_vector.h.

64 {
65 return "Contains: " + ::Catch::Detail::stringify( m_comparator );
66 }
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::ContainsMatcher< T >::describe ( ) const
inlineoverridevirtual

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

Definition at line 3248 of file catch.hpp.

3248 {
3249 return "Contains: " + ::Catch::Detail::stringify( m_comparator );
3250 }
Here is the call graph for this function:

◆ match() [1/2]

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

Definition at line 46 of file catch_matchers_vector.h.

46 {
47 // !TBD: see note in EqualsMatcher
48 if (m_comparator.size() > v.size())
49 return false;
50 for (auto const& comparator : m_comparator) {
51 auto present = false;
52 for (const auto& el : v) {
53 if (el == comparator) {
54 present = true;
55 break;
56 }
57 }
58 if (!present) {
59 return false;
60 }
61 }
62 return true;
63 }

◆ match() [2/2]

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

Definition at line 3230 of file catch.hpp.

3230 {
3231 // !TBD: see note in EqualsMatcher
3232 if (m_comparator.size() > v.size())
3233 return false;
3234 for (auto const& comparator : m_comparator) {
3235 auto present = false;
3236 for (const auto& el : v) {
3237 if (el == comparator) {
3238 present = true;
3239 break;
3240 }
3241 }
3242 if (!present) {
3243 return false;
3244 }
3245 }
3246 return true;
3247 }

Member Data Documentation

◆ m_comparator

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

Definition at line 68 of file catch_matchers_vector.h.


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