8#ifndef TWOBLUECUBES_CATCH_MATCHERS_HPP_INCLUDED
9#define TWOBLUECUBES_CATCH_MATCHERS_HPP_INCLUDED
20 template<
typename ArgT>
struct MatchAllOf;
21 template<
typename ArgT>
struct MatchAnyOf;
22 template<
typename ArgT>
struct MatchNotOf;
24 class MatcherUntypedBase {
38# pragma clang diagnostic push
39# pragma clang diagnostic ignored "-Wnon-virtual-dtor"
42 template<
typename ObjectT>
44 virtual bool match( ObjectT
const& arg )
const = 0;
48# pragma clang diagnostic pop
60 template<
typename ArgT>
62 bool match( ArgT
const& arg )
const override {
64 if (!matcher->match(arg))
70 std::string description;
71 description.reserve( 4 +
m_matchers.size()*32 );
78 description +=
" and ";
79 description += matcher->toString();
92 template<
typename ArgT>
95 bool match( ArgT
const& arg )
const override {
97 if (matcher->match(arg))
103 std::string description;
104 description.reserve( 4 +
m_matchers.size()*32 );
111 description +=
" or ";
112 description += matcher->toString();
126 template<
typename ArgT>
131 bool match( ArgT
const& arg )
const override {
158using namespace Matchers;
MatcherUntypedBase & operator=(MatcherUntypedBase const &)=delete
std::string toString() const
virtual std::string describe() const =0
std::string m_cachedToString
MatcherUntypedBase(MatcherUntypedBase const &)=default
virtual ~MatcherUntypedBase()
MatcherUntypedBase()=default
MatchAllOf< ArgT > & operator&&(MatcherBase< ArgT > const &other)
std::vector< MatcherBase< ArgT > const * > m_matchers
std::string describe() const override
bool match(ArgT const &arg) const override
std::vector< MatcherBase< ArgT > const * > m_matchers
std::string describe() const override
MatchAnyOf< ArgT > & operator||(MatcherBase< ArgT > const &other)
bool match(ArgT const &arg) const override
bool match(ArgT const &arg) const override
MatchNotOf(MatcherBase< ArgT > const &underlyingMatcher)
std::string describe() const override
MatcherBase< ArgT > const & m_underlyingMatcher
MatchNotOf< T > operator!() const
MatchAnyOf< T > operator||(MatcherBase const &other) const
MatchAllOf< T > operator&&(MatcherBase const &other) const
virtual bool match(ObjectT const &arg) const =0