15 #ifndef INCG_IRIS_IUTEST_MATCHER_HPP_23746E00_1A4B_4778_91AD_45C6DEFEEFA7_ 
   16 #define INCG_IRIS_IUTEST_MATCHER_HPP_23746E00_1A4B_4778_91AD_45C6DEFEEFA7_ 
   18 #if IUTEST_HAS_MATCHERS 
   26 #define IUTEST_TEST_THAT(actual, matcher, on_failure)                   \ 
   27     IUTEST_AMBIGUOUS_ELSE_BLOCKER_                                      \ 
   28     if( ::iutest::AssertionResult iutest_ar = matcher(actual) ) {       \ 
   30         on_failure(::iutest::detail::MatcherAssertionFailureMessage(    \ 
   31             ::iutest::PrintToString(actual).c_str(), #matcher, iutest_ar)) 
   46 inline ::std::string MatcherAssertionFailureMessage(
const char* actual, 
const char* matcher_str
 
   47                                                     , 
const AssertionResult& ar)
 
   49     iu_global_format_stringstream strm;
 
   50     strm << 
"error: Expected: " << matcher_str
 
   51         << 
"\n  Actual: " << actual
 
   52         << 
"\nWhich is: " << ar.message();
 
   59 IUTEST_PRAGMA_ASSIGNMENT_OPERATOR_COULD_NOT_GENERATE_WARN_DISABLE_BEGIN()
 
   66     IMatcher& operator=(
const IMatcher&);
 
   69     struct is_matcher : 
public iutest_type_traits::is_base_of<IMatcher, T> {};
 
   72     IMatcher(
const IMatcher&) {}
 
   73     virtual ~IMatcher() {}
 
   74     virtual ::std::string WhichIs() 
const = 0;
 
   77 #if !defined(IUTEST_NO_SFINAE) 
   79 inline typename detail::enable_if_t< IMatcher::is_matcher<T>, iu_ostream>::type& operator << (iu_ostream& os, 
const T& m)
 
   81     return os << m.WhichIs();
 
   84 inline iu_ostream& operator << (iu_ostream& os, 
const IMatcher& m)
 
   86     return os << m.WhichIs();
 
   95 #define IIUT_DECL_COMPARE_MATCHER(name, op)  \ 
   96     template<typename T>class IUTEST_PP_CAT(name, Matcher): public IMatcher{    \ 
   97     public: explicit IUTEST_PP_CAT(name, Matcher)(const T& v) : m_expected(v) {}\ 
   98     ::std::string WhichIs() const IUTEST_CXX_OVERRIDE {                         \ 
   99         iu_global_format_stringstream strm;                                     \ 
  100         strm << #name ": " << m_expected; return strm.str();                    \ 
  102     template<typename U>AssertionResult operator ()(const U& actual) const {    \ 
  103         if( actual op m_expected ) return AssertionSuccess();                   \ 
  104         return AssertionFailure() << WhichIs();                                 \ 
  106     private: const T& m_expected;                                               \ 
  109 #define IIUT_DECL_COMPARE_MATCHER2(name, op) \ 
  110     class IUTEST_PP_CAT(Twofold, IUTEST_PP_CAT(name, Matcher)): public IMatcher{        \ 
  111     public: ::std::string WhichIs() const IUTEST_CXX_OVERRIDE { return #name; }         \ 
  112     template<typename T, typename U>AssertionResult operator ()                         \ 
  113         (const T& actual, const U& expected) const {                                    \ 
  114         if( actual op expected ) return AssertionSuccess();                             \ 
  115         return AssertionFailure() << WhichIs() << ": " << actual << " vs " << expected; \ 
  120 IUTEST_PRAGMA_WARN_PUSH()
 
  121 IUTEST_PRAGMA_WARN_DISABLE_SIGN_COMPARE()
 
  123 IIUT_DECL_COMPARE_MATCHER(
Ne, !=);
 
  124 IIUT_DECL_COMPARE_MATCHER(
Le, <=);
 
  125 IIUT_DECL_COMPARE_MATCHER(
Lt, < );
 
  126 IIUT_DECL_COMPARE_MATCHER(
Ge, >=);
 
  127 IIUT_DECL_COMPARE_MATCHER(
Gt, > );
 
  129 IIUT_DECL_COMPARE_MATCHER2(
Eq, ==);
 
  130 IIUT_DECL_COMPARE_MATCHER2(
Ne, !=);
 
  131 IIUT_DECL_COMPARE_MATCHER2(
Le, <=);
 
  132 IIUT_DECL_COMPARE_MATCHER2(
Lt, < );
 
  133 IIUT_DECL_COMPARE_MATCHER2(
Ge, >=);
 
  134 IIUT_DECL_COMPARE_MATCHER2(
Gt, > );
 
  136 IUTEST_PRAGMA_WARN_POP()
 
  138 #undef IIUT_DECL_COMPARE_MATCHER 
  139 #undef IIUT_DECL_COMPARE_MATCHER2 
  141 #define IIUT_DECL_STR_COMPARE_MATCHER(name)  \ 
  142     template<typename T>class IUTEST_PP_CAT(name, Matcher): public IMatcher {   \ 
  143     public: IUTEST_PP_CAT(name, Matcher)(const T& value) : m_expected(value) {} \ 
  144     template<typename U>AssertionResult operator ()(const U& actual) const {    \ 
  145         if( internal::IUTEST_PP_CAT(name, Helper)::Compare(                     \ 
  146             actual, m_expected) ) { return AssertionSuccess(); }                \ 
  147         return AssertionFailure() << WhichIs();                                 \ 
  149     ::std::string WhichIs() const IUTEST_CXX_OVERRIDE {                         \ 
  150         iu_global_format_stringstream strm; strm << #name ": " << m_expected;   \ 
  154     const T& m_expected;                                                        \ 
  157 IIUT_DECL_STR_COMPARE_MATCHER(
StrEq);
 
  158 IIUT_DECL_STR_COMPARE_MATCHER(
StrNe);
 
  159 IIUT_DECL_STR_COMPARE_MATCHER(
StrCaseEq);
 
  160 IIUT_DECL_STR_COMPARE_MATCHER(
StrCaseNe);
 
  162 #undef IIUT_DECL_COMPARE_MATCHER 
  171 class IsNullMatcher : 
public IMatcher
 
  175     AssertionResult operator ()(
const U* actual)
 const 
  192 class NotNullMatcher : 
public IMatcher
 
  196     AssertionResult operator ()(
const U* actual)
 const 
  214 class FloatingPointEqMatcher : 
public IMatcher
 
  217     explicit FloatingPointEqMatcher(
const T& value) : m_expected(value) {}
 
  221     AssertionResult operator ()(
const U& actual)
 const 
  223         floating_point<T> f2(actual);
 
  224         if( m_expected.AlmostEquals(f2) )
 
  233         iu_global_format_stringstream strm;
 
  238     floating_point<T> m_expected;
 
  245 class NanSensitiveFloatingPointEqMatcher : 
public IMatcher
 
  248     explicit NanSensitiveFloatingPointEqMatcher(
const T& value) : m_expected(value) {}
 
  252     AssertionResult operator ()(
const U& actual)
 const 
  254         floating_point<T> f2(actual);
 
  255         if( m_expected.NanSensitiveAlmostEquals(f2) )
 
  264         iu_global_format_stringstream strm;
 
  269     floating_point<T> m_expected;
 
  276 class FloatingPointNearMatcher : 
public IMatcher
 
  279     explicit FloatingPointNearMatcher(
const T& value, 
const T& abs_error)
 
  280         : m_expected(value), m_max_abs_error(abs_error) {}
 
  284     AssertionResult operator ()(
const U& actual)
 const 
  286         floating_point<T> a(actual);
 
  287         if( m_expected.AlmostNear(a, m_max_abs_error) )
 
  296         iu_global_format_stringstream strm;
 
  297         strm << 
"Near: " << 
PrintToString(m_expected) << 
"(abs error <= " << m_max_abs_error << 
")";
 
  301     floating_point<T> m_expected;
 
  309 class NanSensitiveFloatingPointNearMatcher : 
public IMatcher
 
  312     explicit NanSensitiveFloatingPointNearMatcher(
const T& value, 
const T& abs_error)
 
  313         : m_expected(value), m_max_abs_error(abs_error) {}
 
  317     AssertionResult operator ()(
const U& actual)
 const 
  319         floating_point<T> a(actual);
 
  320         if( m_expected.NanSensitiveAlmostNear(a, m_max_abs_error) )
 
  329         iu_global_format_stringstream strm;
 
  330         strm << 
"NanSensitive Near: " << 
PrintToString(m_expected) << 
"(abs error <= " << m_max_abs_error << 
")";
 
  334     floating_point<T> m_expected;
 
  342 class StartsWithMatcher : 
public IMatcher
 
  345     explicit StartsWithMatcher(T str) : m_expected(str) {}
 
  349     AssertionResult operator ()(
const U& actual)
 const 
  361         iu_global_format_stringstream strm;
 
  362         strm << 
"StartsWith: " << m_expected;
 
  366     static bool StartsWith(
const char* actual, 
const char* start)
 
  368         return strstr(actual, start) == actual;
 
  370     static bool StartsWith(const ::std::string& actual, 
const char* start)
 
  372         const char* p = actual.c_str();
 
  375     static bool StartsWith(
const char* actual, const ::std::string& start)
 
  377         const char* p = start.c_str();
 
  380     static bool StartsWith(const ::std::string& actual, const ::std::string& start)
 
  382         const char* p = start.c_str();
 
  393 class HasSubstrMatcher : 
public IMatcher
 
  396     explicit HasSubstrMatcher(T expected) : m_expected(expected) {}
 
  399     AssertionResult operator ()(
const U& actual)
 const 
  411         iu_global_format_stringstream strm;
 
  412         strm << 
"HasSubstr: " << m_expected;
 
  416     static bool HasSubstr(
const char* actual, 
const char* expected)
 
  418         return strstr(actual, expected) != NULL;
 
  420     static bool HasSubstr(const ::std::string& actual, 
const char* expected)
 
  422         const char* p = actual.c_str();
 
  425     static bool HasSubstr(
const char* actual, const ::std::string& expected)
 
  427         const char* p = expected.c_str();
 
  430     static bool HasSubstr(const ::std::string& actual, const ::std::string& expected)
 
  432         const char* p = expected.c_str();
 
  444 class EndsWithMatcher : 
public IMatcher
 
  447     explicit EndsWithMatcher(T str) : m_expected(str) {}
 
  451     AssertionResult operator ()(
const U& actual)
 const 
  463         iu_global_format_stringstream strm;
 
  464         strm << 
"EndsWith: " << m_expected;
 
  468     static bool EndsWith(
const char* actual, 
const char* end)
 
  470         const size_t len = strlen(end);
 
  471         const size_t actual_len = strlen(actual);
 
  472         if( len > actual_len )
 
  476         const char* p = actual + actual_len - 1;
 
  477         const char* q = end + len - 1;
 
  478         for( 
size_t i=0; i < len; ++i, --p, --q )
 
  487     static bool EndsWith(const ::std::string& actual, 
const char* end)
 
  489         const char* p = actual.c_str();
 
  492     static bool EndsWith(
const char* actual, const ::std::string& end)
 
  494         const char* p = end.c_str();
 
  497     static bool EndsWith(const ::std::string& actual, const ::std::string& end)
 
  499         const char* p = end.c_str();
 
  510 class EqMatcher : 
public IMatcher
 
  513     explicit EqMatcher(
const T& expected) : m_expected(expected) {}
 
  517     AssertionResult operator ()(
const U& actual)
 const 
  519         if( 
Equals(actual, m_expected) )
 
  529         iu_global_format_stringstream strm;
 
  530         strm << 
"Eq: " << m_expected;
 
  534     template<
typename A, 
typename B>
 
  535     static bool Equals(
const A& actual, 
const B& expected)
 
  537 IUTEST_PRAGMA_WARN_PUSH()
 
  538 IUTEST_PRAGMA_WARN_DISABLE_SIGN_COMPARE()
 
  539         return actual == expected;
 
  540 IUTEST_PRAGMA_WARN_POP()
 
  542     static 
bool Equals(const 
char* actual, const 
char* expected)
 
  544         return strcmp(actual, expected) == 0;
 
  546     static bool Equals(const ::std::string& actual, 
const char* expected)
 
  548         const char* p = actual.c_str();
 
  549         return Equals(p, expected);
 
  551     static bool Equals(const ::std::string& actual, const ::std::string& expected)
 
  553         const char* p = expected.c_str();
 
  564 class TypedEqMatcher : 
public EqMatcher<T>
 
  567     explicit TypedEqMatcher(T expected) : EqMatcher<T>(m_expected), m_expected(expected) {}
 
  569     AssertionResult operator ()(
const T& actual)
 
  571         return EqMatcher<T>::operator ()(actual);
 
  574     AssertionResult operator ()(
const U&) 
const;
 
  583 #if !defined(IUTEST_NO_SFINAE) 
  586 T& CastToMatcher(T& matcher
 
  587     , 
typename detail::enable_if_t< IMatcher::is_matcher<T> >::type*& = detail::enabler::value)
 
  593 EqMatcher<T> CastToMatcher(
const T& value
 
  594     , 
typename detail::disable_if_t< IMatcher::is_matcher<T> >::type*& = detail::enabler::value)
 
  596     return EqMatcher<T>(value);
 
  602 T& CastToMatcher(T& matcher)
 
  614 class ContainsMatcher : 
public IMatcher
 
  617     explicit ContainsMatcher(
const T& expected) : m_expected(expected) {}
 
  621     AssertionResult operator ()(
const U& actual)
 
  624         if( 
Contains(begin(actual), end(actual)) )
 
  634         iu_global_format_stringstream strm;
 
  635         strm << 
"Contains: " << m_expected;
 
  639     template<
typename Ite>
 
  642         for( Ite it = begin; it != end; ++it )
 
  644             if( CastToMatcher(m_expected)(*it) )
 
  656 #if IUTEST_HAS_MATCHER_EACH 
  662 class EachMatcher : 
public IMatcher
 
  665     explicit EachMatcher(
const T& expected) : m_expected(expected) {}
 
  669     AssertionResult operator ()(
const U& actual)
 
  672         if( 
Each(begin(actual), end(actual)) )
 
  682         iu_global_format_stringstream strm;
 
  683         strm << 
"Each: " << m_expected;
 
  687     template<
typename Ite>
 
  688     bool Each(Ite begin, Ite end)
 
  690         for( Ite it = begin; it != end; ++it )
 
  692             if( !CastToMatcher(m_expected)(*it) )
 
  710 class ContainerEqMatcher : 
public IMatcher
 
  713     explicit ContainerEqMatcher(
const T& expected) : m_expected(expected) {}
 
  717     AssertionResult operator ()(
const U& actual)
 
  720         if( Check(begin(m_expected), end(m_expected)
 
  721             , begin(actual), end(actual)) )
 
  731         iu_global_format_stringstream strm;
 
  733         strm << 
" (" << m_whichIs << 
")";
 
  737     template<
typename Ite1, 
typename Ite2>
 
  738     bool Check(Ite1 b1, Ite1 e1, Ite2 b2, Ite2 e2)
 
  743         for( elem=0; b1 != e1 && b2 != e2; ++b1, ++b2, ++elem )
 
  745             if( !internal::backward::EqHelper<false>::Compare(
"", 
"", *b1, *b2) )
 
  748                 ar << 
"\nMismatch in a position " << elem << 
": " 
  749                     << ::iutest::internal::FormatForComparisonFailureMessage(*b1, *b2)
 
  750                     << 
" vs " << ::iutest::internal::FormatForComparisonFailureMessage(*b2, *b1);
 
  753         if( b1 != e1 || b2 != e2 )
 
  755             const size_t elem1 = elem + ::std::distance(b1, e1);
 
  756             const size_t elem2 = elem + ::std::distance(b2, e2);
 
  758             ar << 
"\nMismatch element : " << elem1 << 
" vs " << elem2;
 
  760         m_whichIs = ar.GetString();
 
  766     ::std::string m_whichIs;
 
  770 #if IUTEST_HAS_MATCHER_POINTWISE 
  775 template<
typename M, 
typename T>
 
  776 class PointwiseMatcher : 
public IMatcher
 
  779     PointwiseMatcher(
const M& matcher, 
const T& expected)
 
  780         : m_matcher(matcher), m_expected(expected) {}
 
  784     AssertionResult operator ()(
const U& actual)
 
  787         if( Check(begin(m_expected), end(m_expected)
 
  788             , begin(actual), end(actual)) )
 
  798         iu_global_format_stringstream strm;
 
  799         strm << 
"Pointwise: " << m_matcher << 
": " << 
PrintToString(m_expected);
 
  800         strm << 
" (" << m_whichIs << 
")";
 
  804     template<
typename Ite1, 
typename Ite2>
 
  805     bool Check(Ite1 b1, Ite1 e1, Ite2 b2, Ite2 e2)
 
  810         for( elem=0; b1 != e1 && b2 != e2; ++b1, ++b2, ++elem )
 
  812             const AssertionResult r = m_matcher(*b2, *b1);
 
  816                 ar << 
"\nMismatch in a position " << elem << 
": " << r.message();
 
  819         if( b1 != e1 || b2 != e2 )
 
  821             const size_t elem1 = elem + ::std::distance(b1, e1);
 
  822             const size_t elem2 = elem + ::std::distance(b2, e2);
 
  824             ar << 
"\nMismatch element : " << elem1 << 
" vs " << elem2;
 
  826         m_whichIs = ar.GetString();
 
  833     ::std::string m_whichIs;
 
  841 class IsEmptyMatcher : 
public IMatcher
 
  845     AssertionResult operator ()(
const U& actual)
 
  847         if( (actual).empty() )
 
  866 class SizeIsMatcher : 
public IMatcher
 
  869     explicit SizeIsMatcher(
const T& expected) : m_expected(expected) {}
 
  873     AssertionResult operator ()(
const U& actual)
 
  885         iu_global_format_stringstream strm;
 
  886         strm << 
"Size is: " << m_expected;
 
  890     template<
typename Container>
 
  891     bool Check(
const Container& actual)
 
  893         return static_cast<bool>(CastToMatcher(m_expected)(actual.size()));
 
  895 #if !defined(IUTEST_NO_FUNCTION_TEMPLATE_ORDERING) 
  896     template<
typename U, 
size_t SIZE>
 
  897     bool Check(
const U(&)[SIZE])
 
  899         return static_cast<bool>(CastToMatcher(m_expected)(SIZE));
 
  911 class AtMatcher : 
public IMatcher
 
  914     AtMatcher(
size_t index, 
const T& expected) : m_index(index), m_expected(expected) {}
 
  918     AssertionResult operator ()(
const U& actual)
 
  920         if( CastToMatcher(m_expected)(actual[m_index]) )
 
  930         iu_global_format_stringstream strm;
 
  931         strm << 
"At " << m_index << 
": " << m_expected;
 
  944 class ElementsAreArrayMatcher : 
public IMatcher
 
  947     template<
typename It>
 
  948     ElementsAreArrayMatcher(It begin, It end, 
bool expected_elem_count=
true)
 
  949         : m_expected_elem_count(expected_elem_count)
 
  951         m_expected.insert(m_expected.end(), begin, end);
 
  956     AssertionResult operator ()(
const U& actual)
 
  959         return Check(begin(actual), end(actual));
 
  967     ::std::string WhichIs(const ::std::string& msg)
 const 
  969         iu_global_format_stringstream strm;
 
  970         if( m_expected_elem_count )
 
  972             strm << 
"ElementsAreArray: ";
 
  976             strm << 
"ElementsAreArrayForward: ";
 
  982     template<
typename Ite>
 
  983     AssertionResult Check(Ite actual_begin, Ite actual_end)
 
  985         const size_t actual_cnt = ::std::distance(actual_begin, actual_end);
 
  986         const size_t expected_cnt = m_expected.size();
 
  987         if( actual_cnt < expected_cnt )
 
  989             iu_global_format_stringstream stream;
 
  990             stream << 
"actual argument[" << actual_cnt << 
"] is less than " << expected_cnt;
 
  993         if( m_expected_elem_count && actual_cnt > expected_cnt )
 
  995             iu_global_format_stringstream stream;
 
  996             stream << 
"actual argument[" << actual_cnt << 
"] is greater than " << expected_cnt;
 
 1000         Ite it_a=actual_begin;
 
 1001         typename ::std::vector<T>::iterator it_e=m_expected.begin();
 
 1002         for( 
int i=0; it_a != actual_end && it_e != m_expected.end(); ++it_e, ++it_a, ++i )
 
 1005             if( *it_a != *it_e )
 
 1014     ::std::vector<T> m_expected;
 
 1015     bool m_expected_elem_count;
 
 1018 #if IUTEST_HAS_MATCHER_ELEMENTSARE 
 1023 class ElementsAreMatcherBase : 
public IMatcher
 
 1026     template<
typename T, 
typename U>
 
 1027     static AssertionResult Check(T& matchers, 
const U& actual)
 
 1030         return Check<0, tuples::tuple_size<T>::value - 1>(begin(actual), end(actual), matchers);
 
 1032     template<
int N, 
typename T>
 
 1033     static ::std::string WhichIs(
const T& matchers)
 
 1035         ::std::string str = 
"ElementsAre: {";
 
 1036         str += WhichIs_<T, N, tuples::tuple_size<T>::value-1>(matchers);
 
 1041     template<
int N, 
int LAST, 
typename Ite, 
typename M>
 
 1042     static AssertionResult Check(Ite it, Ite end, M& matchers)
 
 1044         const size_t cnt = ::std::distance(it, end);
 
 1047             return AssertionFailure() << 
"ElementsAre: argument[" << cnt << 
"] is less than " << LAST+1;
 
 1049         return CheckElem<N, LAST>(it, end, matchers);
 
 1052     template<
int N, 
int LAST, 
typename Ite, 
typename M>
 
 1053     static AssertionResult CheckElem(Ite it, Ite end, M& matchers
 
 1054         , 
typename detail::enable_if<N == LAST, void>::type*& = detail::enabler::value)
 
 1056         for( 
int index=N; it != end; ++it, ++index )
 
 1058             AssertionResult ar = CastToMatcher(tuples::get<N>(matchers))(*it);
 
 1067     template<
int N, 
int LAST, 
typename Ite, 
typename M>
 
 1068     static AssertionResult CheckElem(Ite it, Ite end, M& matchers
 
 1069         , 
typename detail::disable_if<N == LAST, void>::type*& = detail::enabler::value)
 
 1071         AssertionResult ar = CastToMatcher(tuples::get<N>(matchers))(*it);
 
 1074             return CheckElem<N + 1, LAST>(++it, end, matchers);
 
 1079     template<
int N, 
typename T>
 
 1080     static ::std::string WhichIsElem(
const T& matchers, 
int index)
 
 1082         iu_global_format_stringstream strm;
 
 1083         strm << 
"ElementsAre(" << index << 
"): " << tuples::get<N>(matchers);
 
 1087     template<
typename T, 
int N, 
int LAST>
 
 1088     static ::std::string WhichIs_(
const T& matchers
 
 1089         , 
typename detail::enable_if<N == LAST, void>::type*& = detail::enabler::value)
 
 1091         return StreamableToString(tuples::get<N>(matchers));
 
 1093     template<
typename T, 
int N, 
int LAST>
 
 1094     static ::std::string WhichIs_(
const T& matchers
 
 1095         , 
typename detail::disable_if<N == LAST, void>::type*& = detail::enabler::value)
 
 1097         return StreamableToString(tuples::get<N>(matchers)) + 
", " + WhichIs_<T, N + 1, LAST>(matchers);
 
 1101 #if IUTEST_HAS_MATCHER_VARIADIC 
 1106 template<
typename ...T>
 
 1107 class ElementsAreMatcher : 
public ElementsAreMatcherBase
 
 1110     explicit ElementsAreMatcher(T... t) : m_matchers(t...) {}
 
 1113     template<
typename U>
 
 1114     AssertionResult operator ()(
const U& actual)
 
 1116         return Check(m_matchers, actual);
 
 1120         return ElementsAreMatcherBase::WhichIs<0>(m_matchers);
 
 1124     tuples::tuple<T...> m_matchers;
 
 1151 #define IIUT_DECL_ELEMENTSARE_MATCHER(n)                                                \ 
 1152     template< IUTEST_PP_ENUM_PARAMS(n, typename T) >                                    \ 
 1153     class IUTEST_PP_CAT(ElementsAreMatcher, n) : public ElementsAreMatcherBase {        \ 
 1154     public: IUTEST_PP_CAT(ElementsAreMatcher, n)(IUTEST_PP_ENUM_BINARY_PARAMS(n, T, m)) \ 
 1155         : m_matchers(IUTEST_PP_ENUM_PARAMS(n, m)) {}                                    \ 
 1156     template<typename U>AssertionResult operator ()(const U& actual) {                  \ 
 1157         return Check(m_matchers, actual); }                                             \ 
 1158     ::std::string WhichIs() const IUTEST_CXX_OVERRIDE {                                 \ 
 1159         return ElementsAreMatcherBase::WhichIs<0>(m_matchers); }                        \ 
 1161     tuples::tuple< IUTEST_PP_ENUM_PARAMS(n, T) > m_matchers;                            \ 
 1164 IIUT_DECL_ELEMENTSARE_MATCHER(1);
 
 1165 IIUT_DECL_ELEMENTSARE_MATCHER(2);
 
 1166 IIUT_DECL_ELEMENTSARE_MATCHER(3);
 
 1167 IIUT_DECL_ELEMENTSARE_MATCHER(4);
 
 1168 IIUT_DECL_ELEMENTSARE_MATCHER(5);
 
 1169 IIUT_DECL_ELEMENTSARE_MATCHER(6);
 
 1170 IIUT_DECL_ELEMENTSARE_MATCHER(7);
 
 1171 IIUT_DECL_ELEMENTSARE_MATCHER(8);
 
 1172 IIUT_DECL_ELEMENTSARE_MATCHER(9);
 
 1173 IIUT_DECL_ELEMENTSARE_MATCHER(10);
 
 1175 #undef IIUT_DECL_ELEMENTSARE_MATCHER 
 1184 template<
typename F, 
typename T>
 
 1185 class FieldMatcher : 
public IMatcher
 
 1188     FieldMatcher(
const F& field, 
const T& expected) : m_field(field), m_expected(expected) {}
 
 1191     template<
typename U>
 
 1192     AssertionResult operator ()(
const U& actual)
 
 1204         iu_global_format_stringstream strm;
 
 1205         strm << 
"Field: " << m_expected;
 
 1210 #if !defined(IUTEST_NO_SFINAE) 
 1211     template<
typename U>
 
 1212     bool Check(
const U& actual
 
 1213         , 
typename detail::disable_if_t< detail::is_pointer<U> >::type*& = detail::enabler::value)
 
 1215         return static_cast<bool>(CastToMatcher(m_expected)(actual.*m_field));
 
 1217     template<
typename U>
 
 1218     bool Check(
const U& actual
 
 1219         , 
typename detail::enable_if_t< detail::is_pointer<U> >::type*& = detail::enabler::value)
 
 1221         return static_cast<bool>(CastToMatcher(m_expected)(actual->*m_field));
 
 1224     template<
typename U>
 
 1225     bool Check(
const U& actual)
 
 1227         return static_cast<bool>(CastToMatcher(m_expected)(actual->*m_field));
 
 1239 template<
typename F, 
typename T>
 
 1240 class PropertyMatcher : 
public IMatcher
 
 1243     PropertyMatcher(
const F& prop, 
const T& expected) : m_property(prop), m_expected(expected) {}
 
 1246     template<
typename U>
 
 1247     AssertionResult operator ()(
const U& actual)
 
 1259         iu_global_format_stringstream strm;
 
 1260         strm << 
"Property: " << m_expected;
 
 1265 #if !defined(IUTEST_NO_SFINAE) 
 1266     template<
typename U>
 
 1267     bool Check(
const U& actual
 
 1268         , 
typename detail::disable_if_t< detail::is_pointer<U> >::type*& = detail::enabler::value)
 
 1270         return static_cast<bool>(CastToMatcher(m_expected)((actual.*m_property)()));
 
 1272     template<
typename U>
 
 1273     bool Check(
const U& actual
 
 1274         , 
typename detail::enable_if_t< detail::is_pointer<U> >::type*& = detail::enabler::value)
 
 1276         return static_cast<bool>(CastToMatcher(m_expected)((actual->*m_property)()));
 
 1279     template<
typename U>
 
 1280     bool Check(
const U& actual)
 
 1282         return static_cast<bool>(CastToMatcher(m_expected)((actual->*m_property)()));
 
 1287     const F& m_property;
 
 1294 template<
typename T>
 
 1295 class KeyMatcher : 
public IMatcher
 
 1298     explicit KeyMatcher(
const T& expected) : m_expected(expected) {}
 
 1301     template<
typename U>
 
 1302     AssertionResult operator ()(
const U& actual)
 const 
 1304         if( CastToMatcher(m_expected)(actual.first) )
 
 1314         iu_global_format_stringstream strm;
 
 1315         strm << 
"Key: " << m_expected;
 
 1320     const T& m_expected;
 
 1326 template<
typename T1, 
typename T2>
 
 1327 class PairMatcher : 
public IMatcher
 
 1330     PairMatcher(
const T1& m1, 
const T2& m2) : m_m1(m1), m_m2(m2) {}
 
 1333     template<
typename U>
 
 1334     AssertionResult operator ()(
const U& actual)
 
 1336         if( !CheckElem(actual.first, m_m1) )
 
 1340         if( !CheckElem(actual.second, m_m2) )
 
 1350         iu_global_format_stringstream strm;
 
 1351         strm << 
"Pair: (" << m_m1 << 
", " << m_m2 << 
")";
 
 1355     template<
typename T, 
typename U>
 
 1356     bool CheckElem(
const T& actual, U& matcher)
 
 1358         return static_cast<bool>(CastToMatcher(matcher)(actual));
 
 1369 template<
typename F, 
typename T>
 
 1370 class ResultOfMatcher : 
public IMatcher
 
 1373     ResultOfMatcher(F& func, 
const T& expected) : m_func(func), m_expected(expected) {}
 
 1376     template<
typename U>
 
 1377     AssertionResult operator ()(
const U& actual)
 
 1389         iu_global_format_stringstream strm;
 
 1390         strm << 
"Result of: " << m_expected;
 
 1395     template<
typename U>
 
 1396     bool Check(
const U& actual)
 
 1398         return static_cast<bool>(CastToMatcher(m_expected)((*m_func)(actual)));
 
 1408 template<
typename T>
 
 1409 class PointeeMatcher : 
public IMatcher
 
 1412     explicit PointeeMatcher(
const T& expected) : m_expected(expected) {}
 
 1415     template<
typename U>
 
 1416     AssertionResult operator ()(
const U& actual)
 
 1428         iu_global_format_stringstream strm;
 
 1429         strm << 
"Points To: " << m_expected;
 
 1433     template<
typename U>
 
 1434     bool Check(
const U& actual)
 
 1436         return static_cast<bool>(CastToMatcher(m_expected)(*actual));
 
 1445 template<
typename T>
 
 1446 class NotMatcher : 
public IMatcher
 
 1449     explicit NotMatcher(
const T& unexpected) : m_unexpected(unexpected) {}
 
 1452     template<
typename U>
 
 1453     AssertionResult operator ()(
const U& actual)
 
 1455         if( !CastToMatcher(m_unexpected)(actual) )
 
 1465         iu_global_format_stringstream strm;
 
 1466         strm << 
"Not: (" << m_unexpected << 
")";
 
 1477 template<
typename T>
 
 1478 class AnyMatcher : 
public IMatcher
 
 1481     AssertionResult operator ()(
const T&)
 const 
 1485     template<
typename U>
 
 1486     AssertionResult operator ()(
const U&) 
const;
 
 1491         iu_global_format_stringstream strm;
 
 1492         strm << 
"A: " << detail::GetTypeNameProxy<T>::GetTypeName();
 
 1500 class AnythingMatcher : 
public IMatcher
 
 1503     AnythingMatcher() {}
 
 1505     template<
typename U>
 
 1506     AssertionResult operator ()(
const U&)
 const 
 1518 #if IUTEST_HAS_MATCHER_REGEX 
 1523 class RegexMatcher : 
public IMatcher
 
 1526     RegexMatcher(
const detail::iuRegex& expected, 
bool full_match) : m_expected(expected), m_full_match(full_match) {}
 
 1529     template<
typename U>
 
 1530     AssertionResult operator ()(
const U& actual)
 const 
 1542         iu_global_format_stringstream strm;
 
 1545             strm << 
"MatchesRegex: " << m_expected.pattern();
 
 1549             strm << 
"ContainsRegex: " << m_expected.pattern();
 
 1554     bool Regex(
const char* actual)
 const 
 1556         return m_full_match ? m_expected.FullMatch(actual)
 
 1557             : m_expected.PartialMatch(actual);
 
 1559     bool Regex(const ::std::string& actual)
 const 
 1561         return m_full_match ? m_expected.FullMatch(actual.c_str())
 
 1562             : m_expected.PartialMatch(actual.c_str());
 
 1566     detail::iuRegex m_expected;
 
 1572 #if IUTEST_HAS_MATCHER_ALLOF_AND_ANYOF 
 1577 class AllOfMatcherBase : 
public IMatcher
 
 1580     template<
typename T, 
typename U>
 
 1581     static AssertionResult Check(T& matchers, 
const U& actual)
 
 1583         return Check_<T, U, 0, tuples::tuple_size<T>::value-1>(matchers, actual);
 
 1585     template<
int N, 
typename T>
 
 1586     static ::std::string WhichIs(
const T& matchers)
 
 1588         return WhichIs_<T, N, tuples::tuple_size<T>::value-1>(matchers);
 
 1591     template<
typename T, 
typename U, 
int N, 
int LAST>
 
 1592     static AssertionResult Check_(T& matchers, 
const U& actual, 
typename detail::enable_if<N == LAST, void>::type*& = detail::enabler::value)
 
 1594         AssertionResult ar = tuples::get<N>(matchers)(actual);
 
 1601     template<
typename T, 
typename U, 
int N, 
int LAST>
 
 1602     static AssertionResult Check_(T& matchers, 
const U& actual, 
typename detail::disable_if<N == LAST, void>::type*& = detail::enabler::value)
 
 1604         AssertionResult ar = tuples::get<N>(matchers)(actual);
 
 1607             return Check_<T, U, N + 1, LAST>(matchers, actual);
 
 1612     template<
typename T, 
int N, 
int LAST>
 
 1613     static ::std::string WhichIs_(
const T& matchers, 
typename detail::enable_if<N == LAST, void>::type*& = detail::enabler::value)
 
 1615         return tuples::get<N>(matchers).WhichIs();
 
 1617     template<
typename T, 
int N, 
int LAST>
 
 1618     static ::std::string WhichIs_(
const T& matchers, 
typename detail::disable_if<N == LAST, void>::type*& = detail::enabler::value)
 
 1620         return tuples::get<N>(matchers).WhichIs() + 
" and " + WhichIs_<T, N + 1, LAST>(matchers);
 
 1624 #if IUTEST_HAS_MATCHER_VARIADIC 
 1629 template<
typename ...T>
 
 1630 class AllOfMatcher : 
public AllOfMatcherBase
 
 1633     explicit AllOfMatcher(T... t) : m_matchers(t...) {}
 
 1636     template<
typename U>
 
 1637     AssertionResult operator ()(
const U& actual)
 
 1639         return Check(m_matchers, actual);
 
 1643         return AllOfMatcherBase::WhichIs<0>(m_matchers);
 
 1647     tuples::tuple<T...> m_matchers;
 
 1674 #define IIUT_DECL_ALLOF_MATCHER(n)                                                  \ 
 1675     template< IUTEST_PP_ENUM_PARAMS(n, typename T) >                                \ 
 1676     class IUTEST_PP_CAT(AllOfMatcher, n) : public AllOfMatcherBase {                \ 
 1677     public: IUTEST_PP_CAT(AllOfMatcher, n)(IUTEST_PP_ENUM_BINARY_PARAMS(n, T, m))   \ 
 1678         : m_matchers(IUTEST_PP_ENUM_PARAMS(n, m)) {}                                \ 
 1679     template<typename U>AssertionResult operator ()(const U& actual) {              \ 
 1680         return Check(m_matchers, actual); }                                         \ 
 1681     ::std::string WhichIs() const IUTEST_CXX_OVERRIDE {                             \ 
 1682         return AllOfMatcherBase::WhichIs<0>(m_matchers); }                          \ 
 1684     tuples::tuple< IUTEST_PP_ENUM_PARAMS(n, T) > m_matchers;                        \ 
 1687 IIUT_DECL_ALLOF_MATCHER(2);
 
 1688 IIUT_DECL_ALLOF_MATCHER(3);
 
 1689 IIUT_DECL_ALLOF_MATCHER(4);
 
 1690 IIUT_DECL_ALLOF_MATCHER(5);
 
 1691 IIUT_DECL_ALLOF_MATCHER(6);
 
 1692 IIUT_DECL_ALLOF_MATCHER(7);
 
 1693 IIUT_DECL_ALLOF_MATCHER(8);
 
 1694 IIUT_DECL_ALLOF_MATCHER(9);
 
 1695 IIUT_DECL_ALLOF_MATCHER(10);
 
 1697 #undef IIUT_DECL_ALLOF_MATCHER 
 1704 class AnyOfMatcherBase : 
public IMatcher
 
 1707     template<
typename T, 
typename U>
 
 1708     static AssertionResult Check(T& matchers, 
const U& actual)
 
 1710         return Check_<T, U, 0, tuples::tuple_size<T>::value-1>(matchers, actual);
 
 1712     template<
int N, 
typename T>
 
 1713     static ::std::string WhichIs(
const T& matchers)
 
 1715         return WhichIs_<T, N, tuples::tuple_size<T>::value-1>(matchers);
 
 1718     template<
typename T, 
typename U, 
int N, 
int LAST>
 
 1719     static AssertionResult Check_(T& matchers, 
const U& actual, 
typename detail::enable_if<N == LAST, void>::type*& = detail::enabler::value)
 
 1721         AssertionResult ar = tuples::get<N>(matchers)(actual);
 
 1728     template<
typename T, 
typename U, 
int N, 
int LAST>
 
 1729     static AssertionResult Check_(T& matchers, 
const U& actual, 
typename detail::disable_if<N == LAST, void>::type*& = detail::enabler::value)
 
 1731         AssertionResult ar = tuples::get<N>(matchers)(actual);
 
 1736         return Check_<T, U, N + 1, LAST>(matchers, actual);
 
 1739     template<
typename T, 
int N, 
int LAST>
 
 1740     static ::std::string WhichIs_(
const T& matchers, 
typename detail::enable_if<N == LAST, void>::type*& = detail::enabler::value)
 
 1742         return tuples::get<N>(matchers).WhichIs();
 
 1744     template<
typename T, 
int N, 
int LAST>
 
 1745     static ::std::string WhichIs_(
const T& matchers, 
typename detail::disable_if<N == LAST, void>::type*& = detail::enabler::value)
 
 1747         return tuples::get<N>(matchers).WhichIs() + 
" or " + WhichIs_<T, N + 1, LAST>(matchers);
 
 1751 #if IUTEST_HAS_MATCHER_VARIADIC 
 1756 template<
typename ...T>
 
 1757 class AnyOfMatcher : 
public AnyOfMatcherBase
 
 1760     explicit AnyOfMatcher(T... t) : m_matchers(t...) {}
 
 1763     template<
typename U>
 
 1764     AssertionResult operator ()(
const U& actual)
 
 1766         return Check(m_matchers, actual);
 
 1770         return AnyOfMatcherBase::WhichIs<0>(m_matchers);
 
 1774     tuples::tuple<T...> m_matchers;
 
 1801 #define IIUT_DECL_ANYOF_MATCHER(n)                                                  \ 
 1802     template< IUTEST_PP_ENUM_PARAMS(n, typename T) >                                \ 
 1803     class IUTEST_PP_CAT(AnyOfMatcher, n) : public AnyOfMatcherBase {                \ 
 1804     public: IUTEST_PP_CAT(AnyOfMatcher, n)(IUTEST_PP_ENUM_BINARY_PARAMS(n, T, m))   \ 
 1805         : m_matchers(IUTEST_PP_ENUM_PARAMS(n, m)) {}                                \ 
 1806     template<typename U>AssertionResult operator ()(const U& actual) {              \ 
 1807         return Check(m_matchers, actual); }                                         \ 
 1808     ::std::string WhichIs() const IUTEST_CXX_OVERRIDE {                             \ 
 1809         return AnyOfMatcherBase::WhichIs<0>(m_matchers); }                          \ 
 1811     tuples::tuple< IUTEST_PP_ENUM_PARAMS(n, T) > m_matchers;                        \ 
 1814 IIUT_DECL_ANYOF_MATCHER(2);
 
 1815 IIUT_DECL_ANYOF_MATCHER(3);
 
 1816 IIUT_DECL_ANYOF_MATCHER(4);
 
 1817 IIUT_DECL_ANYOF_MATCHER(5);
 
 1818 IIUT_DECL_ANYOF_MATCHER(6);
 
 1819 IIUT_DECL_ANYOF_MATCHER(7);
 
 1820 IIUT_DECL_ANYOF_MATCHER(8);
 
 1821 IIUT_DECL_ANYOF_MATCHER(9);
 
 1822 IIUT_DECL_ANYOF_MATCHER(10);
 
 1824 #undef IIUT_DECL_ANYOF_MATCHER 
 1830 IUTEST_PRAGMA_ASSIGNMENT_OPERATOR_COULD_NOT_GENERATE_WARN_DISABLE_END()
 
 1850 template<
typename T>
 
 1851 detail::EqMatcher<T> 
Equals(
const T& expected)
 
 1853     return detail::EqMatcher<T>(expected);
 
 1860 template<
typename T>
 
 1861 detail::EqMatcher<T> 
Eq(
const T& expected)
 
 1863     return detail::EqMatcher<T>(expected);
 
 1870 template<
typename T>
 
 1871 detail::NeMatcher<T> 
Ne(
const T& expected)
 
 1873     return detail::NeMatcher<T>(expected);
 
 1880 template<
typename T>
 
 1881 detail::LeMatcher<T> 
Le(
const T& expected)
 
 1883     return detail::LeMatcher<T>(expected);
 
 1890 template<
typename T>
 
 1891 detail::LtMatcher<T> 
Lt(
const T& expected)
 
 1893     return detail::LtMatcher<T>(expected);
 
 1900 template<
typename T>
 
 1901 detail::GeMatcher<T> 
Ge(
const T& expected)
 
 1903     return detail::GeMatcher<T>(expected);
 
 1910 template<
typename T>
 
 1911 detail::GtMatcher<T> 
Gt(
const T& expected)
 
 1913     return detail::GtMatcher<T>(expected);
 
 1920 inline detail::TwofoldEqMatcher 
Eq()
 
 1922     return detail::TwofoldEqMatcher();
 
 1929 inline detail::TwofoldNeMatcher 
Ne()
 
 1931     return detail::TwofoldNeMatcher();
 
 1938 inline detail::TwofoldLeMatcher 
Le()
 
 1940     return detail::TwofoldLeMatcher();
 
 1947 inline detail::TwofoldLtMatcher 
Lt()
 
 1949     return detail::TwofoldLtMatcher();
 
 1956 inline detail::TwofoldGeMatcher 
Ge()
 
 1958     return detail::TwofoldGeMatcher();
 
 1965 inline detail::TwofoldGtMatcher 
Gt()
 
 1967     return detail::TwofoldGtMatcher();
 
 1974 inline detail::IsNullMatcher 
IsNull()
 
 1976     return detail::IsNullMatcher();
 
 1983 inline detail::NotNullMatcher 
NotNull()
 
 1985     return detail::NotNullMatcher();
 
 1992 template<
typename T, 
typename U>
 
 1993 detail::TypedEqMatcher<T> 
TypedEq(
const U& expected)
 
 1995     return detail::TypedEqMatcher<T>(
static_cast<T
>(expected));
 
 2002 template<
typename T>
 
 2005     return detail::FloatingPointEqMatcher<T>(expected);
 
 2012 inline detail::FloatingPointEqMatcher<float> 
FloatEq(
float expected)
 
 2014     return detail::FloatingPointEqMatcher<float>(expected);
 
 2021 inline detail::FloatingPointEqMatcher<double> 
DoubleEq(
double expected)
 
 2023     return detail::FloatingPointEqMatcher<double>(expected);
 
 2026 #if IUTEST_HAS_LONG_DOUBLE 
 2032 inline detail::FloatingPointEqMatcher<long double> LongDoubleEq(
long double expected)
 
 2034     return detail::FloatingPointEqMatcher<long double>(expected);
 
 2043 template<
typename T>
 
 2046     return detail::NanSensitiveFloatingPointEqMatcher<T>(expected);
 
 2053 inline detail::NanSensitiveFloatingPointEqMatcher<float> 
NanSensitiveFloatEq(
float expected)
 
 2055     return detail::NanSensitiveFloatingPointEqMatcher<float>(expected);
 
 2062 inline detail::NanSensitiveFloatingPointEqMatcher<double> 
NanSensitiveDoubleEq(
double expected)
 
 2064     return detail::NanSensitiveFloatingPointEqMatcher<double>(expected);
 
 2067 #if IUTEST_HAS_LONG_DOUBLE 
 2073 inline detail::NanSensitiveFloatingPointEqMatcher<long double> NanSensitiveLongDoubleEq(
long double expected)
 
 2075     return detail::NanSensitiveFloatingPointEqMatcher<long double>(expected);
 
 2080 #if IUTEST_HAS_MATCHER_FLOATINGPOINT_NEAR 
 2086 template<
typename T>
 
 2087 inline detail::FloatingPointNearMatcher<T> 
FloatingPointNear(T expected, T max_abs_error)
 
 2089     return detail::FloatingPointNearMatcher<T>(expected, max_abs_error);
 
 2096 inline detail::FloatingPointNearMatcher<float> 
FloatNear(
float expected, 
float max_abs_error)
 
 2098     return detail::FloatingPointNearMatcher<float>(expected, max_abs_error);
 
 2105 inline detail::FloatingPointNearMatcher<double> 
DoubleNear(
double expected, 
double max_abs_error)
 
 2107     return detail::FloatingPointNearMatcher<double>(expected, max_abs_error);
 
 2110 #if IUTEST_HAS_LONG_DOUBLE 
 2116 inline detail::FloatingPointNearMatcher<long double> LongDoubleNear(
long double expected, 
long double max_abs_error)
 
 2118     return detail::FloatingPointNearMatcher<long double>(expected, max_abs_error);
 
 2127 template<
typename T>
 
 2130     return detail::NanSensitiveFloatingPointNearMatcher<T>(expected, max_abs_error);
 
 2137 inline detail::NanSensitiveFloatingPointNearMatcher<float> 
NanSensitiveFloatNear(
float expected, 
float max_abs_error)
 
 2139     return detail::NanSensitiveFloatingPointNearMatcher<float>(expected, max_abs_error);
 
 2146 inline detail::NanSensitiveFloatingPointNearMatcher<double> 
NanSensitiveDoubleNear(
double expected, 
double max_abs_error)
 
 2148     return detail::NanSensitiveFloatingPointNearMatcher<double>(expected, max_abs_error);
 
 2151 #if IUTEST_HAS_LONG_DOUBLE 
 2157 inline detail::NanSensitiveFloatingPointNearMatcher<long double> NanSensitiveLongDoubleNear(
long double expected, 
long double max_abs_error)
 
 2159     return detail::NanSensitiveFloatingPointNearMatcher<long double>(expected, max_abs_error);
 
 2170 template<
typename T>
 
 2171 detail::StrEqMatcher<T> 
StrEq(
const T& expected)
 
 2173     return detail::StrEqMatcher<T>(expected);
 
 2180 template<
typename T>
 
 2181 detail::StrNeMatcher<T> 
StrNe(
const T& expected)
 
 2183     return detail::StrNeMatcher<T>(expected);
 
 2190 template<
typename T>
 
 2191 detail::StrCaseEqMatcher<T> 
StrCaseEq(
const T& expected)
 
 2193     return detail::StrCaseEqMatcher<T>(expected);
 
 2200 template<
typename T>
 
 2201 detail::StrCaseNeMatcher<T> 
StrCaseNe(
const T& expected)
 
 2203     return detail::StrCaseNeMatcher<T>(expected);
 
 2210 template<
typename T>
 
 2211 detail::StartsWithMatcher<const T&> 
StartsWith(
const T& str)
 
 2213     return detail::StartsWithMatcher<const T&>(str);
 
 2220 template<
typename T>
 
 2221 detail::HasSubstrMatcher<const T&> 
HasSubstr(
const T& str)
 
 2223     return detail::HasSubstrMatcher<const T&>(str);
 
 2230 template<
typename T>
 
 2231 detail::EndsWithMatcher<const T&> 
EndsWith(
const T& str)
 
 2233     return detail::EndsWithMatcher<const T&>(str);
 
 2240 template<
typename T>
 
 2241 detail::ContainsMatcher<T> 
Contains(
const T& expected)
 
 2243     return detail::ContainsMatcher<T>(expected);
 
 2246 #if IUTEST_HAS_MATCHER_EACH 
 2252 template<
typename T>
 
 2253 detail::EachMatcher<T> 
Each(
const T& expected)
 
 2255     return detail::EachMatcher<T>(expected);
 
 2264 template<
typename T>
 
 2265 detail::ContainerEqMatcher<T> 
ContainerEq(
const T& expected)
 
 2267     return detail::ContainerEqMatcher<T>(expected);
 
 2270 #if IUTEST_HAS_MATCHER_POINTWISE 
 2276 template<
typename M, 
typename T>
 
 2277 detail::PointwiseMatcher<M, T> 
Pointwise(
const M& matcher, 
const T& expected)
 
 2279     return detail::PointwiseMatcher<M, T>(matcher, expected);
 
 2288 inline detail::IsEmptyMatcher 
IsEmpty()
 
 2290     return detail::IsEmptyMatcher();
 
 2297 template<
typename T>
 
 2298 detail::SizeIsMatcher<T> 
SizeIs(
const T& expected)
 
 2300     return detail::SizeIsMatcher<T>(expected);
 
 2307 template<
typename T>
 
 2308 detail::AtMatcher<T> 
At(
size_t index, 
const T& expected)
 
 2310     return detail::AtMatcher<T>(index, expected);
 
 2317 template<
typename Container>
 
 2318 detail::ElementsAreArrayMatcher< typename Container::value_type > 
ElementsAreArray(
const Container& container)
 
 2321     return detail::ElementsAreArrayMatcher<typename Container::value_type>(container.begin(), container.end());
 
 2324 #if !defined(IUTEST_NO_FUNCTION_TEMPLATE_ORDERING) 
 2326 template<
typename T, 
size_t SIZE>
 
 2329     return detail::ElementsAreArrayMatcher<T>(v, v + SIZE);
 
 2332 #if !defined(IUTEST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) 
 2334 template<
typename Ite>
 
 2335 detail::ElementsAreArrayMatcher< typename detail::IteratorTraits<Ite>::type > 
ElementsAreArray(Ite begin, Ite end)
 
 2337     return detail::ElementsAreArrayMatcher< typename detail::IteratorTraits<Ite>::type >(begin, end);
 
 2341 #if IUTEST_HAS_INITIALIZER_LIST 
 2343 template<
typename T>
 
 2344 detail::ElementsAreArrayMatcher<T> 
ElementsAreArray(::std::initializer_list<T> l)
 
 2346     return detail::ElementsAreArrayMatcher<T>(l.begin(), l.end());
 
 2356 template<
typename T>
 
 2359     return detail::ElementsAreArrayMatcher<T>(a, a + count);
 
 2362 #if IUTEST_HAS_MATCHER_ELEMENTSAREARRAYFORWARD 
 2368 template<
typename Container>
 
 2369 detail::ElementsAreArrayMatcher< typename Container::value_type > 
ElementsAreArrayForward(
const Container& container)
 
 2371     return detail::ElementsAreArrayMatcher<typename Container::value_type>(container.begin(), container.end(), 
false);
 
 2374 #if !defined(IUTEST_NO_FUNCTION_TEMPLATE_ORDERING) 
 2376 template<
typename T, 
size_t SIZE>
 
 2379     return detail::ElementsAreArrayMatcher<T>(v, v + SIZE, 
false);
 
 2382 #if !defined(IUTEST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) 
 2384 template<
typename Ite>
 
 2385 detail::ElementsAreArrayMatcher< typename detail::IteratorTraits<Ite>::type > 
ElementsAreArrayForward(Ite begin, Ite end)
 
 2387     return detail::ElementsAreArrayMatcher< typename detail::IteratorTraits<Ite>::type >(begin, end, 
false);
 
 2391 #if IUTEST_HAS_INITIALIZER_LIST 
 2393 template<
typename T>
 
 2396     return detail::ElementsAreArrayMatcher<T>(l.begin(), l.end(), 
false);
 
 2406 template<
typename T>
 
 2409     return detail::ElementsAreArrayMatcher<T>(a, a + count, 
false);
 
 2414 #if IUTEST_HAS_MATCHER_ELEMENTSARE 
 2416 #if IUTEST_HAS_MATCHER_VARIADIC 
 2421 template<
typename ...T>
 
 2422 detail::ElementsAreMatcher<T...> 
ElementsAre(
const T&... m)
 
 2424     return detail::ElementsAreMatcher<T...>(m...);
 
 2429 #define IIUT_ELEMENTSARE_MATCHER_NAME(n)    IUTEST_PP_CAT(ElementsAreMatcher, n) 
 2430 #define IIUT_DECL_ELEMENTSARE(n)                                                \ 
 2431     template< IUTEST_PP_ENUM_PARAMS(n, typename T) >                            \ 
 2432     detail:: IIUT_ELEMENTSARE_MATCHER_NAME(n)< IUTEST_PP_ENUM_PARAMS(n, T) >    \ 
 2433     ElementsAre( IUTEST_PP_ENUM_BINARY_PARAMS(n, const T, &m) ) { return        \ 
 2434     detail:: IIUT_ELEMENTSARE_MATCHER_NAME(n)< IUTEST_PP_ENUM_PARAMS(n, T) >    \ 
 2435         ( IUTEST_PP_ENUM_PARAMS(n, m) ); } 
 2438 IIUT_DECL_ELEMENTSARE(1)
 
 2439 IIUT_DECL_ELEMENTSARE(2)
 
 2440 IIUT_DECL_ELEMENTSARE(3)
 
 2441 IIUT_DECL_ELEMENTSARE(4)
 
 2442 IIUT_DECL_ELEMENTSARE(5)
 
 2443 IIUT_DECL_ELEMENTSARE(6)
 
 2444 IIUT_DECL_ELEMENTSARE(7)
 
 2445 IIUT_DECL_ELEMENTSARE(8)
 
 2446 IIUT_DECL_ELEMENTSARE(9)
 
 2447 IIUT_DECL_ELEMENTSARE(10)
 
 2449 #undef IIUT_ELEMENTSARE_MATCHER_NAME 
 2450 #undef IIUT_DECL_ELEMENTSARE 
 2459 template<
typename T>
 
 2460 detail::KeyMatcher<T> 
Key(
const T& expected)
 
 2462     return detail::KeyMatcher<T>(expected);
 
 2469 template<
typename T1, 
typename T2>
 
 2470 detail::PairMatcher<T1, T2> 
Pair(
const T1& m1, 
const T2& m2)
 
 2472     return detail::PairMatcher<T1, T2>(m1, m2);
 
 2479 template<
typename F, 
typename T>
 
 2480 detail::FieldMatcher<F, T> 
Field(
const F& field, 
const T& expected)
 
 2482     return detail::FieldMatcher<F, T>(field, expected);
 
 2489 template<
typename P, 
typename T>
 
 2490 detail::PropertyMatcher<P, T> 
Property(
const P& prop, 
const T& expected)
 
 2492     return detail::PropertyMatcher<P, T>(prop, expected);
 
 2499 template<
typename F, 
typename T>
 
 2500 detail::ResultOfMatcher<F, T> 
ResultOf(
const F& func, 
const T& expected)
 
 2502     return detail::ResultOfMatcher<F, T>(func, expected);
 
 2508 template<
typename T>
 
 2509 detail::PointeeMatcher<T> 
Pointee(
const T& expected)
 
 2511     return detail::PointeeMatcher<T>(expected);
 
 2517 template<
typename T>
 
 2518 detail::NotMatcher<T> 
Not(
const T& unexpected)
 
 2520     return detail::NotMatcher<T>(unexpected);
 
 2526 template<
typename T>
 
 2527 detail::AnyMatcher<T> 
A()
 
 2529     return detail::AnyMatcher<T>();
 
 2536 const detail::AnythingMatcher 
_;
 
 2538 #if IUTEST_HAS_MATCHER_REGEX 
 2543 inline detail::RegexMatcher MatchesRegex(const ::std::string& str)
 
 2545     return detail::RegexMatcher(detail::iuRegex(str), 
true);
 
 2551 inline detail::RegexMatcher ContainsRegex(const ::std::string& str)
 
 2553     return detail::RegexMatcher(detail::iuRegex(str), 
false);
 
 2558 #if IUTEST_HAS_MATCHER_ALLOF_AND_ANYOF 
 2560 #if IUTEST_HAS_MATCHER_VARIADIC 
 2566 template<
typename ...T>
 
 2567 detail::AllOfMatcher<T...> 
AllOf(
const T&... m)
 
 2569     return detail::AllOfMatcher<T...>(m...);
 
 2576 template<
typename ...T>
 
 2577 detail::AnyOfMatcher<T...> 
AnyOf(
const T&... m)
 
 2579     return detail::AnyOfMatcher<T...>(m...);
 
 2584 #define IIUT_ANYOF_AND_ALLOF_MATCHER_NAME(name, n)  IUTEST_PP_CAT( IUTEST_PP_CAT(name, Matcher), n) 
 2585 #define IIUT_DECL_ANYOF_AND_ALLOF(name, n)                                              \ 
 2586     template< IUTEST_PP_ENUM_PARAMS(n, typename T) >                                    \ 
 2587     detail:: IIUT_ANYOF_AND_ALLOF_MATCHER_NAME(name, n)< IUTEST_PP_ENUM_PARAMS(n, T) >  \ 
 2588     name( IUTEST_PP_ENUM_BINARY_PARAMS(n, const T, &m) ) { return                       \ 
 2589     detail:: IIUT_ANYOF_AND_ALLOF_MATCHER_NAME(name, n)< IUTEST_PP_ENUM_PARAMS(n, T) >  \ 
 2590         ( IUTEST_PP_ENUM_PARAMS(n, m) ); } 
 2593 IIUT_DECL_ANYOF_AND_ALLOF(
AllOf, 2)
 
 2594 IIUT_DECL_ANYOF_AND_ALLOF(
AllOf, 3)
 
 2595 IIUT_DECL_ANYOF_AND_ALLOF(
AllOf, 4)
 
 2596 IIUT_DECL_ANYOF_AND_ALLOF(
AllOf, 5)
 
 2597 IIUT_DECL_ANYOF_AND_ALLOF(
AllOf, 6)
 
 2598 IIUT_DECL_ANYOF_AND_ALLOF(
AllOf, 7)
 
 2599 IIUT_DECL_ANYOF_AND_ALLOF(
AllOf, 8)
 
 2600 IIUT_DECL_ANYOF_AND_ALLOF(
AllOf, 9)
 
 2601 IIUT_DECL_ANYOF_AND_ALLOF(
AllOf, 10)
 
 2603 IIUT_DECL_ANYOF_AND_ALLOF(
AnyOf, 2)
 
 2604 IIUT_DECL_ANYOF_AND_ALLOF(
AnyOf, 3)
 
 2605 IIUT_DECL_ANYOF_AND_ALLOF(
AnyOf, 4)
 
 2606 IIUT_DECL_ANYOF_AND_ALLOF(
AnyOf, 5)
 
 2607 IIUT_DECL_ANYOF_AND_ALLOF(
AnyOf, 6)
 
 2608 IIUT_DECL_ANYOF_AND_ALLOF(
AnyOf, 7)
 
 2609 IIUT_DECL_ANYOF_AND_ALLOF(
AnyOf, 8)
 
 2610 IIUT_DECL_ANYOF_AND_ALLOF(
AnyOf, 9)
 
 2611 IIUT_DECL_ANYOF_AND_ALLOF(
AnyOf, 10)
 
 2613 #undef IIUT_ANYOF_AND_ALLOF_MATCHER_NAME 
 2614 #undef IIUT_DECL_ANYOF_AND_ALLOF 
 2623 template<
typename T, 
typename M>
 
 2624 bool Value(
const T& value, 
const M& expected)
 
 2626     return static_cast<bool>(detail::CastToMatcher(expected)(value));
 
 2635 using namespace matchers; 
 
 2639 #endif  // IUTEST_HAS_MATCHERS 
 2641 #endif // INCG_IRIS_IUTEST_MATCHER_HPP_23746E00_1A4B_4778_91AD_45C6DEFEEFA7_