Lines Matching defs:const

77 //   bool InterestedInWhy(bool result) const;
91 MatchResultListener& operator<<(const T& x) {
104 bool IsInterested() const { return stream_ != NULL; }
107 ::std::ostream* const stream_;
126 virtual void DescribeTo(::std::ostream* os) const = 0;
134 virtual void DescribeNegationTo(::std::ostream* os) const {
176 virtual bool MatchAndExplain(T x, MatchResultListener* listener) const = 0;
179 // virtual void DescribeTo(::std::ostream* os) const = 0;
180 // virtual void DescribeNegationTo(::std::ostream* os) const;
189 internal::string str() const { return ss_.str(); }
204 bool operator()(const A& a, const B& b) const { return a == b; }
208 bool operator()(const A& a, const B& b) const { return a != b; }
212 bool operator()(const A& a, const B& b) const { return a < b; }
216 bool operator()(const A& a, const B& b) const { return a > b; }
220 bool operator()(const A& a, const B& b) const { return a <= b; }
224 bool operator()(const A& a, const B& b) const { return a >= b; }
256 bool MatchAndExplain(T x, MatchResultListener* listener) const {
261 bool Matches(T x) const {
267 void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); }
270 void DescribeNegationTo(::std::ostream* os) const {
275 void ExplainMatchResultTo(T x, ::std::ostream* os) const {
283 const MatcherDescriberInterface* GetDescriber() const {
291 explicit MatcherBase(const MatcherInterface<T>* impl)
308 ::testing::internal::linked_ptr<const MatcherInterface<T> > impl_;
315 // implementation of Matcher<T> is just a linked_ptr to const
327 explicit Matcher(const MatcherInterface<T>* impl)
339 class GTEST_API_ Matcher<const internal::string&>
340 : public internal::MatcherBase<const internal::string&> {
344 explicit Matcher(const MatcherInterface<const internal::string&>* impl)
345 : internal::MatcherBase<const internal::string&>(impl) {}
349 Matcher(const internal::string& s); // NOLINT
352 Matcher(const char* s); // NOLINT
361 explicit Matcher(const MatcherInterface<internal::string>* impl)
366 Matcher(const internal::string& s); // NOLINT
369 Matcher(const char* s); // NOLINT
377 class GTEST_API_ Matcher<const StringPiece&>
378 : public internal::MatcherBase<const StringPiece&> {
382 explicit Matcher(const MatcherInterface<const StringPiece&>* impl)
383 : internal::MatcherBase<const StringPiece&>(impl) {}
387 Matcher(const internal::string& s); // NOLINT
390 Matcher(const char* s); // NOLINT
402 explicit Matcher(const MatcherInterface<StringPiece>* impl)
407 Matcher(const internal::string& s); // NOLINT
410 Matcher(const char* s); // NOLINT
425 // bool MatchAndExplain(const Value& value,
426 // MatchResultListener* listener) const;
432 explicit PolymorphicMatcher(const Impl& an_impl) : impl_(an_impl) {}
440 const Impl& impl() const { return impl_; }
443 operator Matcher<T>() const {
451 explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {}
453 virtual void DescribeTo(::std::ostream* os) const {
457 virtual void DescribeNegationTo(::std::ostream* os) const {
461 virtual bool MatchAndExplain(T x, MatchResultListener* listener) const {
466 const Impl impl_;
482 // Matcher<const string&>(foo);
484 inline Matcher<T> MakeMatcher(const MatcherInterface<T>* impl) {
496 inline PolymorphicMatcher<Impl> MakePolymorphicMatcher(const Impl& impl) {
517 static Matcher<T> Cast(const M& polymorphic_matcher_or_value) {
538 static Matcher<T> CastImpl(const M& value, BooleanConstant<false>) {
545 static Matcher<T> CastImpl(const M& polymorphic_matcher_or_value,
565 static Matcher<T> Cast(const Matcher<U>& source_matcher) {
572 explicit Impl(const Matcher<U>& source_matcher)
576 virtual bool MatchAndExplain(T x, MatchResultListener* listener) const {
580 virtual void DescribeTo(::std::ostream* os) const {
584 virtual void DescribeNegationTo(::std::ostream* os) const {
589 const Matcher<U> source_matcher_;
600 static Matcher<T> Cast(const Matcher<T>& matcher) { return matcher; }
610 inline Matcher<T> MatcherCast(const M& matcher) {
619 // template <T, U> ... (const Matcher<U>&)
627 static inline Matcher<T> Cast(const M& polymorphic_matcher_or_value) {
641 static inline Matcher<T> Cast(const Matcher<U>& matcher) {
654 const bool kTIsOther = GMOCK_KIND_OF_(RawT) == internal::kOther;
655 const bool kUIsOther = GMOCK_KIND_OF_(RawU) == internal::kOther;
665 inline Matcher<T> SafeMatcherCast(const M& polymorphic_matcher) {
678 inline void PrintIfNotEmpty(const internal::string& explanation,
688 inline bool IsReadableTypeName(const string& type_name) {
698 // Value cannot be passed by const reference, because some matchers take a
699 // non-const argument.
701 bool MatchPrintAndExplain(Value& value, const Matcher<T>& matcher,
710 const bool match = matcher.MatchAndExplain(value, &inner_listener);
714 const string& type_name = GetTypeName<Value>();
732 static bool Matches(const MatcherTuple& matcher_tuple,
733 const ValueTuple& value_tuple) {
743 static void ExplainMatchFailuresTo(const MatcherTuple& matchers,
744 const ValueTuple& values,
779 static bool Matches(const MatcherTuple& /* matcher_tuple */,
780 const ValueTuple& /* value_tuple */) {
785 static void ExplainMatchFailuresTo(const MatcherTuple& /* matchers */,
786 const ValueTuple& /* values */,
796 bool TupleMatches(const MatcherTuple& matcher_tuple,
797 const ValueTuple& value_tuple) {
810 void ExplainMatchFailureTupleTo(const MatcherTuple& matchers,
811 const ValueTuple& values,
829 static OutIter Run(Func f, const Tuple& t, OutIter out) {
836 OutIter operator() (Func f, const Tup& t, OutIter out) const {
843 OutIter operator() (Func /* f */, const Tup& /* t */, OutIter out) const {
853 OutIter TransformTupleValues(Func f, const Tuple& t, OutIter out) {
862 T /* x */, MatchResultListener* /* listener */) const { return true; }
863 virtual void DescribeTo(::std::ostream* os) const { *os << "is anything"; }
864 virtual void DescribeNegationTo(::std::ostream* os) const {
879 operator Matcher<T>() const { return A<T>(); }
891 // a "bare" type (i.e. neither 'const T' nor 'T&').
895 explicit ComparisonBase(const Rhs& rhs) : rhs_(rhs) {}
897 operator Matcher<Lhs>() const {
905 explicit Impl(const Rhs& rhs) : rhs_(rhs) {}
907 Lhs lhs, MatchResultListener* /* listener */) const {
910 virtual void DescribeTo(::std::ostream* os) const {
914 virtual void DescribeNegationTo(::std::ostream* os) const {
929 explicit EqMatcher(const Rhs& rhs)
931 static const char* Desc() { return "is equal to"; }
932 static const char* NegatedDesc() { return "isn't equal to"; }
937 explicit NeMatcher(const Rhs& rhs)
939 static const char* Desc() { return "isn't equal to"; }
940 static const char* NegatedDesc() { return "is equal to"; }
945 explicit LtMatcher(const Rhs& rhs)
947 static const char* Desc() { return "is <"; }
948 static const char* NegatedDesc() { return "isn't <"; }
953 explicit GtMatcher(const Rhs& rhs)
955 static const char* Desc() { return "is >"; }
956 static const char* NegatedDesc() { return "isn't >"; }
961 explicit LeMatcher(const Rhs& rhs)
963 static const char* Desc() { return "is <="; }
964 static const char* NegatedDesc() { return "isn't <="; }
969 explicit GeMatcher(const Rhs& rhs)
971 static const char* Desc() { return "is >="; }
972 static const char* NegatedDesc() { return "isn't >="; }
980 bool MatchAndExplain(const Pointer& p,
981 MatchResultListener* /* listener */) const {
989 void DescribeTo(::std::ostream* os) const { *os << "is NULL"; }
990 void DescribeNegationTo(::std::ostream* os) const {
1000 bool MatchAndExplain(const Pointer& p,
1001 MatchResultListener* /* listener */) const {
1009 void DescribeTo(::std::ostream* os) const { *os << "isn't NULL"; }
1010 void DescribeNegationTo(::std::ostream* os) const {
1034 // mocking any function types, including those that take non-const
1036 // Super below) can be instantiated to either a const type or a
1037 // non-const type.
1039 // RefMatcher() takes a T& instead of const T&, as we want the
1041 // non-const reference.
1045 operator Matcher<Super&>() const {
1049 // non-const reference, as you cannot implicitly convert a const
1050 // reference to a non-const reference.
1060 // MatchAndExplain() takes a Super& (as opposed to const Super&)
1063 Super& x, MatchResultListener* listener) const {
1064 *listener << "which is located @" << static_cast<const void*>(&x);
1068 virtual void DescribeTo(::std::ostream* os) const {
1073 virtual void DescribeNegationTo(::std::ostream* os) const {
1079 const Super& object_;
1090 inline bool CaseInsensitiveCStringEquals(const char* lhs, const char* rhs) {
1094 inline bool CaseInsensitiveCStringEquals(const wchar_t* lhs,
1095 const wchar_t* rhs) {
1102 bool CaseInsensitiveStringEquals(const StringType& s1,
1103 const StringType& s2) {
1110 const typename StringType::value_type nul = 0;
1111 const size_t i1 = s1.find(nul), i2 = s2.find(nul);
1128 StrEqualityMatcher(const StringType& str, bool expect_eq,
1133 // const char*
1135 // const wchar_t*
1138 bool MatchAndExplain(CharType* s, MatchResultListener* listener) const {
1147 // This is a template, not just a plain function with const StringType&,
1150 bool MatchAndExplain(const MatcheeStringType& s,
1151 MatchResultListener* /* listener */) const {
1152 const StringType& s2(s);
1153 const bool eq = case_sensitive_ ? s2 == string_ :
1158 void DescribeTo(::std::ostream* os) const {
1162 void DescribeNegationTo(::std::ostream* os) const {
1167 void DescribeToHelper(bool expect_eq, ::std::ostream* os) const {
1176 const StringType string_;
1177 const bool expect_eq_;
1178 const bool case_sensitive_;
1189 explicit HasSubstrMatcher(const StringType& substring)
1193 // const char*
1195 // const wchar_t*
1198 bool MatchAndExplain(CharType* s, MatchResultListener* listener) const {
1204 // This is a template, not just a plain function with const StringType&,
1207 bool MatchAndExplain(const MatcheeStringType& s,
1208 MatchResultListener* /* listener */) const {
1209 const StringType& s2(s);
1214 void DescribeTo(::std::ostream* os) const {
1219 void DescribeNegationTo(::std::ostream* os) const {
1225 const StringType substring_;
1236 explicit StartsWithMatcher(const StringType& prefix) : prefix_(prefix) {
1240 // const char*
1242 // const wchar_t*
1245 bool MatchAndExplain(CharType* s, MatchResultListener* listener) const {
1251 // This is a template, not just a plain function with const StringType&,
1254 bool MatchAndExplain(const MatcheeStringType& s,
1255 MatchResultListener* /* listener */) const {
1256 const StringType& s2(s);
1261 void DescribeTo(::std::ostream* os) const {
1266 void DescribeNegationTo(::std::ostream* os) const {
1272 const StringType prefix_;
1283 explicit EndsWithMatcher(const StringType& suffix) : suffix_(suffix) {}
1286 // const char*
1288 // const wchar_t*
1291 bool MatchAndExplain(CharType* s, MatchResultListener* listener) const {
1297 // This is a template, not just a plain function with const StringType&,
1300 bool MatchAndExplain(const MatcheeStringType& s,
1301 MatchResultListener* /* listener */) const {
1302 const StringType& s2(s);
1307 void DescribeTo(::std::ostream* os) const {
1312 void DescribeNegationTo(::std::ostream* os) const {
1318 const StringType suffix_;
1328 MatchesRegexMatcher(const RE* regex, bool full_match)
1332 // const char*
1334 // const wchar_t*
1337 bool MatchAndExplain(CharType* s, MatchResultListener* listener) const {
1343 // This is a template, not just a plain function with const internal::string&,
1346 bool MatchAndExplain(const MatcheeStringType& s,
1347 MatchResultListener* /* listener */) const {
1348 const internal::string& s2(s);
1353 void DescribeTo(::std::ostream* os) const {
1359 void DescribeNegationTo(::std::ostream* os) const {
1366 const internal::linked_ptr<const RE> regex_;
1367 const bool full_match_;
1377 // used to match a tuple<int, short>, a tuple<const long&, double>,
1384 operator Matcher< ::testing::tuple<T1, T2> >() const {
1388 operator Matcher<const ::testing::tuple<T1, T2>&>() const {
1389 return MakeMatcher(new Impl<const ::testing::tuple<T1, T2>&>);
1402 MatchResultListener* /* listener */) const {
1405 virtual void DescribeTo(::std::ostream* os) const {
1408 virtual void DescribeNegationTo(::std::ostream* os) const {
1416 static const char* Desc() { return "an equal pair"; }
1420 static const char* Desc() { return "an unequal pair"; }
1424 static const char* Desc() { return "a pair where the first < the second"; }
1428 static const char* Desc() { return "a pair where the first > the second"; }
1432 static const char* Desc() { return "a pair where the first <= the second"; }
1436 static const char* Desc() { return "a pair where the first >= the second"; }
1446 explicit NotMatcherImpl(const Matcher<T>& matcher)
1449 virtual bool MatchAndExplain(T x, MatchResultListener* listener) const {
1453 virtual void DescribeTo(::std::ostream* os) const {
1457 virtual void DescribeNegationTo(::std::ostream* os) const {
1462 const Matcher<T> matcher_;
1477 operator Matcher<T>() const {
1494 BothOfMatcherImpl(const Matcher<T>& matcher1, const Matcher<T>& matcher2)
1497 virtual void DescribeTo(::std::ostream* os) const {
1505 virtual void DescribeNegationTo(::std::ostream* os) const {
1513 virtual bool MatchAndExplain(T x, MatchResultListener* listener) const {
1529 const internal::string s1 = listener1.str();
1530 const internal::string s2 = listener2.str();
1544 const Matcher<T> matcher1_;
1545 const Matcher<T> matcher2_;
1567 static ListType BuildList(const Head& matcher, const Tail&... tail) {
1576 static Matcher<T> CreateMatcher(const ListType& matchers) {
1590 static ListType BuildList(const Matcher1& matcher1,
1591 const Matcher2& matcher2) {
1596 static Matcher<T> CreateMatcher(const ListType& matchers) {
1610 VariadicMatcher(const Args&... matchers) // NOLINT
1617 operator Matcher<T>() const {
1625 const typename MatcherListType::ListType matchers_;
1647 operator Matcher<T>() const {
1666 EitherOfMatcherImpl(const Matcher<T>& matcher1, const Matcher<T>& matcher2)
1669 virtual void DescribeTo(::std::ostream* os) const {
1677 virtual void DescribeNegationTo(::std::ostream* os) const {
1685 virtual bool MatchAndExplain(T x, MatchResultListener* listener) const {
1701 const internal::string s1 = listener1.str();
1702 const internal::string s2 = listener2.str();
1716 const Matcher<T> matcher1_;
1717 const Matcher<T> matcher2_;
1742 operator Matcher<T>() const {
1767 MatchResultListener* /* listener */) const {
1779 void DescribeTo(::std::ostream* os) const {
1783 void DescribeNegationTo(::std::ostream* os) const {
1807 bool operator()(const T& x) const {
1814 // compile when matcher_ has type Matcher<const T&>; if we write
1815 // Matcher<const T&>(matcher_).Matches(x) here, it won't compile
1820 // MatcherCast<const T&>() is necessary for making the code work
1822 return MatcherCast<const T&>(matcher_).Matches(x);
1842 AssertionResult operator()(const char* value_text, const T& x) const {
1843 // We convert matcher_ to a Matcher<const T&> *now* instead of
1849 // We write SafeMatcherCast<const T&>(matcher_) instead of
1850 // Matcher<const T&>(matcher_), as the latter won't compile when
1852 // We don't write MatcherCast<const T&> either, as that allows
1854 const Matcher<const T&> matcher = SafeMatcherCast<const T&>(matcher_);
1868 const M matcher_;
1922 MatchResultListener* listener) const {
1923 const FloatingPoint<FloatType> actual(value), expected(expected_);
1942 const FloatType diff = value - expected_;
1956 virtual void DescribeTo(::std::ostream* os) const {
1960 const ::std::streamsize old_precision = os->precision(
1977 virtual void DescribeNegationTo(::std::ostream* os) const {
1979 const ::std::streamsize old_precision = os->precision(
1998 bool HasMaxAbsError() const {
2002 const FloatType expected_;
2003 const bool nan_eq_nan_;
2005 const FloatType max_abs_error_;
2012 // Matcher<const float&>, or a Matcher<float&>, but nothing else.
2014 // by non-const reference, we may see them in code not conforming to
2016 operator Matcher<FloatType>() const {
2021 operator Matcher<const FloatType&>() const {
2023 new Impl<const FloatType&>(expected_, nan_eq_nan_, max_abs_error_));
2026 operator Matcher<FloatType&>() const {
2032 const FloatType expected_;
2033 const bool nan_eq_nan_;
2035 const FloatType max_abs_error_;
2045 explicit PointeeMatcher(const InnerMatcher& matcher) : matcher_(matcher) {}
2056 operator Matcher<Pointer>() const {
2068 explicit Impl(const InnerMatcher& matcher)
2069 : matcher_(MatcherCast<const Pointee&>(matcher)) {}
2071 virtual void DescribeTo(::std::ostream* os) const {
2076 virtual void DescribeNegationTo(::std::ostream* os) const {
2082 MatchResultListener* listener) const {
2091 const Matcher<const Pointee&> matcher_;
2096 const InnerMatcher matcher_;
2110 explicit WhenDynamicCastToMatcherBase(const Matcher<To>& matcher)
2113 void DescribeTo(::std::ostream* os) const {
2118 void DescribeNegationTo(::std::ostream* os) const {
2124 const Matcher<To> matcher_;
2147 explicit WhenDynamicCastToMatcher(const Matcher<To>& matcher)
2151 bool MatchAndExplain(From from, MatchResultListener* listener) const {
2163 explicit WhenDynamicCastToMatcher(const Matcher<To&>& matcher)
2167 bool MatchAndExplain(From& from, MatchResultListener* listener) const {
2184 const Matcher<const FieldType&>& matcher)
2187 void DescribeTo(::std::ostream* os) const {
2192 void DescribeNegationTo(::std::ostream* os) const {
2198 bool MatchAndExplain(const T& value, MatchResultListener* listener) const {
2209 bool MatchAndExplainImpl(false_type /* is_not_pointer */, const Class& obj,
2210 MatchResultListener* listener) const {
2215 bool MatchAndExplainImpl(true_type /* is_pointer */, const Class* p,
2216 MatchResultListener* listener) const {
2227 const FieldType Class::*field_;
2228 const Matcher<const FieldType&> matcher_;
2238 // The property may have a reference type, so 'const PropertyType&'
2244 PropertyMatcher(PropertyType (Class::*property)() const,
2245 const Matcher<RefToConstProperty>& matcher)
2248 void DescribeTo(::std::ostream* os) const {
2253 void DescribeNegationTo(::std::ostream* os) const {
2259 bool MatchAndExplain(const T&value, MatchResultListener* listener) const {
2270 bool MatchAndExplainImpl(false_type /* is_not_pointer */, const Class& obj,
2271 MatchResultListener* listener) const {
2274 // which takes a non-const reference as argument.
2286 bool MatchAndExplainImpl(true_type /* is_pointer */, const Class* p,
2287 MatchResultListener* listener) const {
2298 PropertyType (Class::*property_)() const;
2299 const Matcher<RefToConstProperty> matcher_;
2341 ResultOfMatcher(Callable callable, const Matcher<ResultType>& matcher)
2347 operator Matcher<T>() const {
2357 Impl(CallableStorageType callable, const Matcher<ResultType>& matcher)
2360 virtual void DescribeTo(::std::ostream* os) const {
2365 virtual void DescribeNegationTo(::std::ostream* os) const {
2370 virtual bool MatchAndExplain(T obj, MatchResultListener* listener) const {
2373 // MatchPrintAndExplain, which takes a non-const reference as argument.
2380 // Functors often define operator() as non-const method even though
2382 // 'this' is a const pointer. It's the user's responsibility not to
2386 const Matcher<ResultType> matcher_;
2391 const CallableStorageType callable_;
2392 const Matcher<ResultType> matcher_;
2401 explicit SizeIsMatcher(const SizeMatcher& size_matcher)
2406 operator Matcher<Container>() const {
2416 explicit Impl(const SizeMatcher& size_matcher)
2419 virtual void DescribeTo(::std::ostream* os) const {
2423 virtual void DescribeNegationTo(::std::ostream* os) const {
2429 MatchResultListener* listener) const {
2432 const bool result = size_matcher_.MatchAndExplain(size, &size_listener);
2440 const Matcher<SizeType> size_matcher_;
2445 const SizeMatcher size_matcher_;
2454 explicit BeginEndDistanceIsMatcher(const DistanceMatcher& distance_matcher)
2458 operator Matcher<Container>() const {
2470 explicit Impl(const DistanceMatcher& distance_matcher)
2473 virtual void DescribeTo(::std::ostream* os) const {
2477 virtual void DescribeNegationTo(::std::ostream* os) const {
2483 MatchResultListener* listener) const {
2492 const bool result =
2501 const Matcher<DistanceType> distance_matcher_;
2506 const DistanceMatcher distance_matcher_;
2529 explicit ContainerEqMatcher(const Container& expected)
2532 // with a const or reference type.
2537 void DescribeTo(::std::ostream* os) const {
2541 void DescribeNegationTo(::std::ostream* os) const {
2547 bool MatchAndExplain(const LhsContainer& lhs,
2548 MatchResultListener* listener) const {
2550 // that causes LhsContainer to be a const type sometimes.
2558 ::std::ostream* const os = listener->stream();
2600 const StlContainer expected_;
2608 bool operator()(const T& lhs, const U& rhs) const { return lhs < rhs; }
2615 WhenSortedByMatcher(const Comparator& comparator,
2616 const ContainerMatcher& matcher)
2620 operator Matcher<LhsContainer>() const {
2631 // Transforms std::pair<const Key, Value> into std::pair<Key, Value>
2636 Impl(const Comparator& comparator, const ContainerMatcher& matcher)
2639 virtual void DescribeTo(::std::ostream* os) const {
2644 virtual void DescribeNegationTo(::std::ostream* os) const {
2650 MatchResultListener* listener) const {
2668 const bool match = matcher_.MatchAndExplain(sorted_container,
2675 const Comparator comparator_;
2676 const Matcher<const ::std::vector<LhsValue>&> matcher_;
2682 const Comparator comparator_;
2683 const ContainerMatcher matcher_;
2689 // must be able to be safely cast to Matcher<tuple<const T1&, const
2701 PointwiseMatcher(const TupleMatcher& tuple_matcher, const RhsContainer& rhs)
2704 // with a const or reference type.
2710 operator Matcher<LhsContainer>() const {
2726 typedef ::testing::tuple<const LhsValue&, const RhsValue&> InnerMatcherArg;
2728 Impl(const TupleMatcher& tuple_matcher, const RhsStlContainer& rhs)
2733 virtual void DescribeTo(::std::ostream* os) const {
2740 virtual void DescribeNegationTo(::std::ostream* os) const {
2750 MatchResultListener* listener) const {
2752 const size_t actual_size = lhs_stl_container.size();
2761 const InnerMatcherArg value_pair(*left, *right);
2785 const Matcher<InnerMatcherArg> mono_tuple_matcher_;
2786 const RhsStlContainer rhs_;
2792 const TupleMatcher tuple_matcher_;
2793 const RhsStlContainer rhs_;
2811 testing::SafeMatcherCast<const Element&>(inner_matcher)) {}
2818 MatchResultListener* listener) const {
2824 const bool matches = inner_matcher_.MatchAndExplain(*it, &inner_listener);
2837 const Matcher<const Element&> inner_matcher_;
2852 virtual void DescribeTo(::std::ostream* os) const {
2857 virtual void DescribeNegationTo(::std::ostream* os) const {
2863 MatchResultListener* listener) const {
2881 virtual void DescribeTo(::std::ostream* os) const {
2886 virtual void DescribeNegationTo(::std::ostream* os) const {
2892 MatchResultListener* listener) const {
2907 operator Matcher<Container>() const {
2912 const M inner_matcher_;
2924 operator Matcher<Container>() const {
2929 const M inner_matcher_;
2947 testing::SafeMatcherCast<const KeyType&>(inner_matcher)) {
2952 MatchResultListener* listener) const {
2954 const bool match = inner_matcher_.MatchAndExplain(key_value.first,
2956 const internal::string explanation = inner_listener.str();
2964 virtual void DescribeTo(::std::ostream* os) const {
2970 virtual void DescribeNegationTo(::std::ostream* os) const {
2976 const Matcher<const KeyType&> inner_matcher_;
2988 operator Matcher<PairType>() const {
2993 const M matcher_for_key_;
3010 testing::SafeMatcherCast<const FirstType&>(first_matcher)),
3012 testing::SafeMatcherCast<const SecondType&>(second_matcher)) {
3016 virtual void DescribeTo(::std::ostream* os) const {
3024 virtual void DescribeNegationTo(::std::ostream* os) const {
3034 MatchResultListener* listener) const {
3061 void ExplainSuccess(const internal::string& first_explanation,
3062 const internal::string& second_explanation,
3063 MatchResultListener* listener) const {
3079 const Matcher<const FirstType&> first_matcher_;
3080 const Matcher<const SecondType&> second_matcher_;
3093 operator Matcher<PairType> () const {
3100 const FirstMatcher first_matcher_;
3101 const SecondMatcher second_matcher_;
3121 matchers_.push_back(MatcherCast<const Element&>(*first++));
3126 virtual void DescribeTo(::std::ostream* os) const {
3145 virtual void DescribeNegationTo(::std::ostream* os) const {
3162 MatchResultListener* listener) const {
3166 const bool listener_interested = listener->IsInterested();
3228 const internal::string& s = explanations[i];
3246 size_t count() const { return matchers_.size(); }
3248 ::std::vector<Matcher<const Element&> > matchers_;
3265 size_t LhsSize() const { return num_elements_; }
3266 size_t RhsSize() const { return num_matchers_; }
3267 bool HasEdge(size_t ilhs, size_t irhs) const {
3281 string DebugString() const;
3284 size_t SpaceIndex(size_t ilhs, size_t irhs) const {
3303 FindMaxBipartiteMatching(const MatchMatrix& g);
3305 GTEST_API_ bool FindPairing(const MatchMatrix& matrix,
3316 typedef ::std::vector<const MatcherDescriberInterface*> MatcherDescriberVec;
3319 void DescribeToImpl(::std::ostream* os) const;
3322 void DescribeNegationToImpl(::std::ostream* os) const;
3325 const ::std::vector<string>& element_printouts,
3326 const MatchMatrix& matrix,
3327 MatchResultListener* listener) const;
3361 matchers_.push_back(MatcherCast<const Element&>(*first));
3367 virtual void DescribeTo(::std::ostream* os) const {
3372 virtual void DescribeNegationTo(::std::ostream* os) const {
3377 MatchResultListener* listener) const {
3385 const size_t actual_count = matrix.LhsSize();
3406 typedef ::std::vector<Matcher<const Element&> > MatcherVec;
3411 MatchResultListener* listener) const {
3444 Matcher<Target> operator()(const Arg& a) const {
3453 explicit UnorderedElementsAreMatcher(const MatcherTuple& args)
3457 operator Matcher<Container>() const {
3461 typedef ::std::vector<Matcher<const Element&> > MatcherVec;
3464 TransformTupleValues(CastAndAppendTransform<const Element&>(), matchers_,
3471 const MatcherTuple matchers_;
3479 explicit ElementsAreMatcher(const MatcherTuple& args) : matchers_(args) {}
3482 operator Matcher<Container>() const {
3486 typedef ::std::vector<Matcher<const Element&> > MatcherVec;
3489 TransformTupleValues(CastAndAppendTransform<const Element&>(), matchers_,
3496 const MatcherTuple matchers_;
3511 operator Matcher<Container>() const {
3531 operator Matcher<Container>() const {
3537 const ::std::vector<T> matchers_;
3554 BoundSecondMatcher(const Tuple2Matcher& tm, const Second& second)
3558 operator Matcher<T>() const {
3570 void operator=(const BoundSecondMatcher& /*rhs*/) {
3580 Impl(const Tuple2Matcher& tm, const Second& second)
3581 : mono_tuple2_matcher_(SafeMatcherCast<const ArgTuple&>(tm)),
3584 virtual void DescribeTo(::std::ostream* os) const {
3591 virtual bool MatchAndExplain(T x, MatchResultListener* listener) const {
3597 const Matcher<const ArgTuple&> mono_tuple2_matcher_;
3598 const Second second_value_;
3603 const Tuple2Matcher tuple2_matcher_;
3604 const Second second_value_;
3613 const Tuple2Matcher& tm, const Second& second) {
3623 const char* matcher_name,
3624 const Strings& param_values);
3653 const T* pointer, size_t count) {
3659 const T (&array)[N]) {
3665 ElementsAreArray(const Container& container) {
3695 UnorderedElementsAreArray(const T* pointer, size_t count) {
3701 UnorderedElementsAreArray(const T (&array)[N]) {
3708 UnorderedElementsAreArray(const Container& container) {
3729 const internal::AnythingMatcher _ = {};
3739 // Note: if the parameter of Eq() were declared as const T&, Eq("foo")
3762 inline Matcher<Lhs> TypedEq(const Rhs& rhs) { return Eq(rhs); }
3873 const InnerMatcher& inner_matcher) {
3885 WhenDynamicCastTo(const Matcher<To>& inner_matcher) {
3897 FieldType Class::*field, const FieldMatcher& matcher) {
3900 field, MatcherCast<const FieldType&>(matcher)));
3914 PropertyType (Class::*property)() const, const PropertyMatcher& matcher) {
3940 Callable callable, const ResultOfMatcher& matcher) {
3955 StrEq(const internal::string& str) {
3962 StrNe(const internal::string& str) {
3969 StrCaseEq(const internal::string& str) {
3976 StrCaseNe(const internal::string& str) {
3984 HasSubstr(const internal::string& substring) {
3991 StartsWith(const internal::string& prefix) {
3998 EndsWith(const internal::string& suffix) {
4006 const internal::RE* regex) {
4010 const internal::string& regex) {
4017 const internal::RE* regex) {
4021 const internal::string& regex) {
4030 StrEq(const internal::wstring& str) {
4037 StrNe(const internal::wstring& str) {
4044 StrCaseEq(const internal::wstring& str) {
4051 StrCaseNe(const internal::wstring& str) {
4059 HasSubstr(const internal::wstring& substring) {
4066 StartsWith(const internal::wstring& prefix) {
4073 EndsWith(const internal::wstring& suffix) {
4128 SizeIs(const SizeMatcher& size_matcher) {
4139 BeginEndDistanceIs(const DistanceMatcher& distance_matcher) {
4150 ContainerEq(const Container& rhs) {
4152 // which causes Container to be a const type sometimes.
4162 WhenSortedBy(const Comparator& comparator,
4163 const ContainerMatcher& container_matcher) {
4172 WhenSorted(const ContainerMatcher& container_matcher) {
4181 // TupleMatcher must be able to be safely cast to Matcher<tuple<const
4182 // T1&, const T2&> >, where T1 and T2 are the types of elements in the
4187 Pointwise(const TupleMatcher& tuple_matcher, const Container& rhs) {
4189 // which causes Container to be a const type sometimes (e.g. when
4190 // rhs is a const int[])..
4201 const TupleMatcher& tuple_matcher, std::initializer_list<T> rhs) {
4212 // cast to Matcher<tuple<const T1&, const T2&> >, where T1 and T2 are
4223 UnorderedPointwise(const Tuple2Matcher& tuple2_matcher,
4224 const RhsContainer& rhs_container) {
4226 // which causes RhsContainer to be a const type sometimes (e.g. when
4227 // rhs_container is a const int[]).
4235 const RhsStlContainer& rhs_stl_container =
4256 UnorderedPointwise(const Tuple2Matcher& tuple2_matcher,
4277 // Contains(::std::pair<const int, size_t>(1, 100)));
4279 // const char* user_ids[] = { "joe", "mike", "tom" };
4311 // const char* user_ids[] = { "joe", "mike", "tom" };
4347 inline bool Value(const T& value, M matcher) {
4355 M matcher, const T& value, MatchResultListener* listener) {
4356 return SafeMatcherCast<const T&>(matcher).MatchAndExplain(value, listener);
4363 inline internal::AllOfMatcher<Args...> AllOf(const Args&... matchers) {
4368 inline internal::AnyOfMatcher<Args...> AnyOf(const Args&... matchers) {
4382 inline InnerMatcher AllArgs(const InnerMatcher& matcher) { return matcher; }