Lines Matching defs:Matcher
166 // Types of Matcher Parameters
250 // Matcher, class MatcherInterface, and others.
294 // 2. a factory function that creates a Matcher<T> object from a
298 // to write "v" instead of "Eq(v)" where a Matcher is expected, which
300 // ownership management as Matcher objects can now be copied like
334 // Matcher but is not one yet; for example, Eq(value)) or a value (for
339 static Matcher<T> Cast(const M& polymorphic_matcher_or_value) {
341 // its conversion operator to create Matcher<T>. Or it can be a value
342 // that should be passed to the Matcher<T>'s constructor.
344 // We can't call Matcher<T>(polymorphic_matcher_or_value) when M is a
350 // polymorphic_matcher_or_value to Matcher<T> because it won't trigger
354 std::is_convertible<M, Matcher<T>>{},
360 static Matcher<T> CastImpl(const M& polymorphic_matcher_or_value,
363 // M is implicitly convertible to Matcher<T>, which means that either
364 // M is a polymorphic matcher or Matcher<T> has an implicit constructor
369 // creating Matcher<T> would require a chain of two user-defined conversions
370 // (first to create T from M and then to create Matcher<T> from T).
374 // M can't be implicitly converted to Matcher<T>, so M isn't a polymorphic
377 static Matcher<T> CastImpl(const M& value,
380 return Matcher<T>(ImplicitCast_<T>(value));
383 // M can't be implicitly converted to either Matcher<T> or T. Attempt to use
393 static Matcher<T> CastImpl(const M& value,
399 // is already a Matcher. This only compiles when type T can be
402 class MatcherCastImpl<T, Matcher<U>> {
404 static Matcher<T> Cast(const Matcher<U>& source_matcher) {
405 return Matcher<T>(new Impl(source_matcher));
411 explicit Impl(const Matcher<U>& source_matcher)
449 const Matcher<U> source_matcher_;
456 class MatcherCastImpl<T, Matcher<T>> {
458 static Matcher<T> Cast(const Matcher<T>& matcher) { return matcher; }
461 // Template specialization for parameterless Matcher.
468 operator ::testing::Matcher<T>() const { // NOLINT(runtime/explicit)
469 return ::testing::Matcher<T>(new
474 // Template specialization for Matcher with parameters.
490 operator ::testing::Matcher<F>() const { // NOLINT(runtime/explicit)
496 ::testing::Matcher<F> Apply(IndexSequence<tuple_ids...>) const {
497 return ::testing::Matcher<F>(
509 // matcher m and returns a Matcher<T>. It compiles only when T can be
512 inline Matcher<T> MatcherCast(const M& matcher) {
519 inline Matcher<T> SafeMatcherCast(const M& polymorphic_matcher_or_value) {
526 // safely convert a Matcher<U> to a Matcher<T> (i.e. Matcher is
527 // contravariant): just keep a copy of the original Matcher<U>, convert the
528 // argument from type T to U, and then pass it to the underlying Matcher<U>.
530 // underlying Matcher<U> may be interested in the argument's address, which
533 inline Matcher<T> SafeMatcherCast(const Matcher<U>& matcher) {
556 Matcher<T> A();
586 bool MatchPrintAndExplain(Value& value, const Matcher<T>& matcher,
741 // conversion operator to make it appearing as a Matcher<T> for any
799 // Matcher<int> m1 = Ref(n); // This won't compile.
800 // Matcher<int&> m2 = Ref(n); // This will compile.
818 operator Matcher<Super&>() const {
961 // can be used as a Matcher<T> as long as T can be converted to a
1015 // can be used as a Matcher<T> as long as T can be converted to a
1069 // can be used as a Matcher<T> as long as T can be converted to a
1123 // used as a Matcher<T> as long as T can be converted to a string.
1129 const Matcher<const std::string&>& internal_matcher)
1158 const Matcher<const std::string&> internal_matcher_;
1173 operator Matcher<::std::tuple<T1, T2>>() const {
1174 return Matcher<::std::tuple<T1, T2>>(new Impl<const ::std::tuple<T1, T2>&>);
1177 operator Matcher<const ::std::tuple<T1, T2>&>() const {
1234 explicit NotMatcherImpl(const Matcher<T>& matcher) : matcher_(matcher) {}
1250 const Matcher<T> matcher_;
1263 operator Matcher<T>() const {
1264 return Matcher<T>(new NotMatcherImpl<T>(SafeMatcherCast<T>(matcher_)));
1278 explicit AllOfMatcherImpl(std::vector<Matcher<T>> matchers)
1329 const std::vector<Matcher<T>> matchers_;
1351 operator Matcher<T>() const {
1352 std::vector<Matcher<T>> values;
1354 return Matcher<T>(new CombiningMatcher<T>(std::move(values)));
1359 void CreateVariadicMatcher(std::vector<Matcher<T>>* values,
1367 std::vector<Matcher<T>>*,
1383 explicit AnyOfMatcherImpl(std::vector<Matcher<T>> matchers)
1434 const std::vector<Matcher<T>> matchers_;
1452 operator Matcher<T>() const { // NOLINT(runtime/explicit)
1473 operator Matcher<U>() const { // NOLINT
1475 std::vector<Matcher<RawU>> matchers;
1479 return Matcher<U>(new MatcherImpl<RawU>(std::move(matchers)));
1549 // If we write Matcher<T>(matcher_).Matches(x) here, it won't
1550 // compile when matcher_ has type Matcher<const T&>; if we write
1551 // Matcher<const T&>(matcher_).Matches(x) here, it won't compile
1552 // when matcher_ has type Matcher<T>; if we just write
1577 // We convert matcher_ to a Matcher<const T&> *now* instead of
1584 // Matcher<const T&>(matcher_), as the latter won't compile when
1585 // matcher_ has type Matcher<T> (e.g. An<int>()).
1588 const Matcher<const T&> matcher = SafeMatcherCast<const T&>(matcher_);
1667 // Implements floating point equality matcher as a Matcher<T>.
1762 // NanSensitiveFloatEq(expected) to be used as a Matcher<float>, a
1763 // Matcher<const float&>, or a Matcher<float&>, but nothing else.
1764 operator Matcher<FloatType>() const {
1769 operator Matcher<const FloatType&>() const {
1774 operator Matcher<FloatType&>() const {
1807 operator Matcher<::std::tuple<T1, T2>>() const {
1812 operator Matcher<const ::std::tuple<T1, T2>&>() const {
1832 return static_cast<Matcher<FloatType>>(fm).MatchAndExplain(
1837 return static_cast<Matcher<FloatType>>(fm).MatchAndExplain(
1877 operator Matcher<Pointer>() const {
1878 return Matcher<Pointer>(new Impl<const Pointer&>(matcher_));
1912 const Matcher<const Pointee&> matcher_;
1936 operator Matcher<PointerType>() const { // NOLINT
1937 return Matcher<PointerType>(new Impl<const PointerType&>(matcher_));
1970 Matcher<Pointer> matcher_;
1986 explicit WhenDynamicCastToMatcherBase(const Matcher<To>& matcher)
2000 const Matcher<To> matcher_;
2015 explicit WhenDynamicCastToMatcher(const Matcher<To>& matcher)
2030 explicit WhenDynamicCastToMatcher(const Matcher<To&>& matcher)
2052 const Matcher<const FieldType&>& matcher)
2056 const Matcher<const FieldType&>& matcher)
2100 const Matcher<const FieldType&> matcher_;
2117 PropertyMatcher(Property property, const Matcher<RefToConstProperty>& matcher)
2123 const Matcher<RefToConstProperty>& matcher)
2168 const Matcher<RefToConstProperty> matcher_;
2223 operator Matcher<T>() const {
2224 return Matcher<T>(
2271 // be a non-const reference (e.g. Matcher<Uncopyable&>).
2285 const Matcher<ResultType> matcher_;
2301 operator Matcher<Container>() const {
2302 return Matcher<Container>(new Impl<const Container&>(size_matcher_));
2333 const Matcher<SizeType> size_matcher_;
2349 operator Matcher<Container>() const {
2350 return Matcher<Container>(new Impl<const Container&>(distance_matcher_));
2389 const Matcher<DistanceType> distance_matcher_;
2501 operator Matcher<LhsContainer>() const {
2559 const Matcher<const ::std::vector<LhsValue>&> matcher_;
2571 // must be able to be safely cast to Matcher<std::tuple<const T1&, const
2596 operator Matcher<LhsContainer>() const {
2601 return Matcher<LhsContainer>(
2682 const Matcher<InnerMatcherArg> mono_tuple_matcher_;
2728 bool MatchAndExplainImpl(const Matcher<size_t>& count_matcher,
2777 const Matcher<const Element&> inner_matcher_;
2839 Matcher<size_t> count_matcher)
2863 const Matcher<size_t> count_matcher_;
2870 explicit ContainsTimesMatcher(M m, Matcher<size_t> count_matcher)
2874 operator Matcher<Container>() const { // NOLINT
2875 return Matcher<Container>(new ContainsTimesMatcherImpl<const Container&>(
2881 const Matcher<size_t> count_matcher_;
2891 operator Matcher<Container>() const { // NOLINT
2892 return Matcher<Container>(
2896 ContainsTimesMatcher<M> Times(Matcher<size_t> count_matcher) const {
2911 operator Matcher<Container>() const { // NOLINT
2912 return Matcher<Container>(
2986 const Matcher<const KeyType&> inner_matcher_;
2996 operator Matcher<PairType>() const {
2997 return Matcher<PairType>(
3012 operator Matcher<Type>() const { // NOLINT
3013 return Matcher<Type>(new Impl<const Type&>(matcher_));
3043 const Matcher<Address> matcher_;
3128 const Matcher<const FirstType&> first_matcher_;
3129 const Matcher<const SecondType&> second_matcher_;
3140 operator Matcher<PairType>() const {
3141 return Matcher<PairType>(
3277 Matcher<const typename std::tuple_element<I, UnpackedType>::type&>...>;
3352 operator Matcher<Struct>() const { // NOLINT
3353 return Matcher<Struct>(
3504 ::std::vector<Matcher<const Element&>> matchers_;
3681 ::std::vector<Matcher<const Element&>> matchers_;
3689 Matcher<Target> operator()(const Arg& a) const {
3702 operator Matcher<Container>() const {
3706 typedef ::std::vector<Matcher<const Element&>> MatcherVec;
3711 return Matcher<Container>(
3728 operator Matcher<Container>() const {
3737 typedef ::std::vector<Matcher<const Element&>> MatcherVec;
3742 return Matcher<Container>(new ElementsAreMatcherImpl<const Container&>(
3760 operator Matcher<Container>() const {
3761 return Matcher<Container>(
3779 operator Matcher<Container>() const {
3784 return Matcher<Container>(new ElementsAreMatcherImpl<const Container&>(
3810 operator Matcher<T>() const {
3849 const Matcher<const ArgTuple&> mono_tuple2_matcher_;
3884 operator Matcher<Optional>() const {
3885 return Matcher<Optional>(new Impl<const Optional&>(value_matcher_));
3922 const Matcher<ValueType> value_matcher_;
3940 explicit VariantMatcher(::testing::Matcher<const T&> matcher)
3986 const ::testing::Matcher<const T&> matcher_;
4001 explicit AnyCastMatcher(const ::testing::Matcher<const T&>& matcher)
4047 const ::testing::Matcher<const T&> matcher_;
4059 using MonomorphicInnerMatcher = Matcher<const SelectedArgs&>;
4122 operator Matcher<ArgsTuple>() const { // NOLINT
4238 inline Matcher<T> A() {
4244 inline Matcher<T> An() {
4249 Matcher<T> internal::MatcherCastImpl<T, M>::CastImpl(
4352 WhenDynamicCastTo(const Matcher<To>& inner_matcher) {
4728 // TupleMatcher must be able to be safely cast to Matcher<std::tuple<const
4751 // cast to Matcher<std::tuple<const T1&, const T2&> >, where T1 and T2 are
5083 Matcher<T> monomorphic_matcher = SafeMatcherCast<T>(matcher);
5246 const Matcher<const T&>& matcher) {
5257 const Matcher<const T&>& matcher) {
5270 WithWhatMatcherImpl(Matcher<std::string> matcher)
5291 const Matcher<std::string> matcher_;
5295 Matcher<std::string> m) {
5336 ExceptionMatcherImpl(Matcher<const Err&> matcher)
5378 const Matcher<const Err&> matcher_;
5415 // For example user may want to pass Matcher<std::exception>
5416 // to Throws<std::runtime_error>, or Matcher<int64> to Throws<int32>.
5445 class name##Matcher \
5446 : public ::testing::internal::MatcherBaseImpl<name##Matcher> { \
5474 inline name##Matcher GMOCK_INTERNAL_WARNING_PUSH() \
5482 bool name##Matcher::gmock_Impl<arg_type>::MatchAndExplain( \