Lines Matching defs:to

15 // contributors may be used to endorse or promote products derived from
67 // The two-level delegation design makes it possible to allow a user
68 // to write "v" instead of "Eq(v)" where a Matcher is expected, which
74 // used by a matcher to explain why a value matches or doesn't match.
78 // to indicate whether the listener is interested in why the match
88 // Streams x to the underlying ostream; does nothing if the ostream
102 // this information to avoid generating the explanation when no one
103 // intends to hear it.
115 // An instance of a subclass of this knows how to describe itself as a
121 // Describes this matcher to an ostream. The function should print
128 // Describes the negation of this matcher to an ostream. For
131 // You are not required to override this when implementing
146 // result to 'listener' if necessary (see the next paragraph), in
150 // generate an explanation like "which points to ...".
157 // needed, as sometimes the caller needs to print a failure message
163 // as it is useful information to the reader; on the other hand, an
164 // "is empty" matcher probably only needs to explain what the actual
165 // size is when the match fails, as it's redundant to say that the
166 // size is 0 when the value is already known to be empty.
170 // It's the responsibility of the caller (Google Mock) to guarantee
171 // that 'listener' is not NULL. This helps to simplify a matcher's
173 // can talk to 'listener' without checking its validity first.
174 // However, in order to implement dummy listeners efficiently,
236 // A match result listener that forwards the explanation to a given
249 // from it. We put functionalities common to all Matcher<T>
250 // specializations here to avoid code duplication.
255 // result to 'listener'.
266 // Describes this matcher to an ostream.
269 // Describes the negation of this matcher to an ostream.
281 // of the describer, which is only guaranteed to be alive when
299 // to hold the reference count, while the latter tracks all
315 // implementation of Matcher<T> is just a linked_ptr to const
323 // cannot use it until a valid value has been assigned to it.
330 // Implicit constructor here allows people to write
335 // The following two specializations allow the user to write str
347 // Allows the user to write str instead of Eq(str) sometimes, where
351 // Allows the user to write "foo" instead of Eq("foo") sometimes.
364 // Allows the user to write str instead of Eq(str) sometimes, where
368 // Allows the user to write "foo" instead of Eq("foo") sometimes.
373 // The following two specializations allow the user to write str
385 // Allows the user to write str instead of Eq(str) sometimes, where
389 // Allows the user to write "foo" instead of Eq("foo") sometimes.
392 // Allows the user to pass StringPieces directly.
405 // Allows the user to write str instead of Eq(str) sometimes, where
409 // Allows the user to write "foo" instead of Eq("foo") sometimes.
412 // Allows the user to pass StringPieces directly.
417 // The PolymorphicMatcher class template makes it easy to implement a
434 // Returns a mutable reference to the underlying matcher
438 // Returns an immutable reference to the underlying matcher
476 // Creates a matcher from its implementation. This is easier to use
477 // than the Matcher<T> constructor as it doesn't require you to
489 // easier to use than the PolymorphicMatcher<Impl> constructor as it
490 // doesn't require you to explicitly write the template argument, e.g.
505 // MatcherCast(). We need this helper in order to partially
507 // class/struct templates to be partially specialized, but not
511 // polymorphic matcher (i.e. something that can be converted to a
518 // M can be a polymorhic matcher, in which case we want to use
519 // its conversion operator to create Matcher<T>. Or it can be a value
520 // that should be passed to the Matcher<T>'s constructor.
527 // It won't work to unconditionally implict_cast
528 // polymorphic_matcher_or_value to Matcher<T> because it won't trigger
529 // a user-defined conversion from M to T if one exists (assuming M is
539 // M can't be implicitly converted to Matcher<T>, so M isn't a polymorphic
540 // matcher. It must be a value then. Use direct initialization to create
547 // M is implicitly convertible to Matcher<T>, which means that either
554 // (first to create T from M and then to create Matcher<T> from T).
561 // statically converted to type U.
575 // We delegate the matching logic to the source matcher.
596 // a matcher to its own type.
605 // In order to be safe and clear, casting between different matcher
608 // statically converted to the argument type of m.
616 // We use an intermediate class to do the actual safe casting as Nokia's
633 // In general, if type T can be implicitly converted to type U, we can
634 // safely convert a Matcher<U> to a Matcher<T> (i.e. Matcher is
636 // argument from type T to U, and then pass it to the underlying Matcher<U>.
639 // is not preserved in the conversion from T to U.
642 // Enforce that T can be implicitly converted to U.
645 // Enforce that we are not converting a non-reference type T to a reference
677 // If the explanation is not empty, prints it to the ostream.
685 // Returns true if the given type name is easy to read by a human.
686 // This is used to decide whether printing the type of a value might
696 // the match result to the listener. Returns the match result.
704 // If the listener is not interested, we do not need to construct the
741 // nothing will be streamed to os.
762 // We remove the reference in type Value to prevent the
764 // isn't interesting to the user most of the time. The
808 // is no failure, nothing will be streamed to os.
820 // TransformTupleValues uses to implement a tuple traversal.
850 // appending each result to the 'out' iterator. Returns the final value
866 // to write Not(A<bool>()). However we cannot completely rule out
867 // such a possibility, and it doesn't hurt to be prepared.
874 // conversion operator to make it appearing as a Matcher<T> for any
884 // two values being compared don't have to have the same type.
887 // used to match an int, a short, a double, etc). Therefore we use
931 static const char* Desc() { return "is equal to"; }
932 static const char* NegatedDesc() { return "isn't equal to"; }
939 static const char* Desc() { return "isn't equal to"; }
940 static const char* NegatedDesc() { return "is equal to"; }
1015 // Ref(variable) matches any argument that is a reference to
1021 // from mistakenly using Ref(x) to match a non-reference function
1033 // Google Mock is a generic framework and thus needs to support
1036 // Super below) can be instantiated to either a const type or a
1040 // compiler to catch using Ref(const_value) as a matcher for a
1046 // By passing object_ (type T&) to Impl(), which expects a Super&,
1050 // reference to a non-const reference.
1060 // MatchAndExplain() takes a Super& (as opposed to const Super&)
1061 // in order to match the interface MatcherInterface<Super&>.
1145 // Matches anything that can convert to StringType.
1169 *os << "equal to ";
1184 // can be used as a Matcher<T> as long as T can be converted to a
1202 // Matches anything that can convert to StringType.
1231 // can be used as a Matcher<T> as long as T can be converted to a
1249 // Matches anything that can convert to StringType.
1278 // can be used as a Matcher<T> as long as T can be converted to a
1295 // Matches anything that can convert to StringType.
1325 // T can be converted to a string.
1341 // Matches anything that can convert to internal::string.
1374 // compared don't have to have the same type.
1377 // used to match a tuple<int, short>, a tuple<const long&, double>,
1474 // This template type conversion operator allows Not(m) to be used
1475 // to match any type m can match.
1515 // to explain why one of them fails.
1528 // Otherwise we need to explain why *both* of them match.
1572 // by BuildList()). CombiningMatcher<T> is used to combine the matchers of the
1605 // CombiningMatcher<T> is used to recursively combine the provided matchers
1614 // VariadicMatcher<Matcher1, Matcher2...> object to match any type that
1644 // BothOfMatcher<Matcher1, Matcher2> object to match any type that
1686 // If either matcher1_ or matcher2_ matches x, we just need to
1700 // Otherwise we need to explain why *both* of them fail.
1739 // EitherOfMatcher<Matcher1, Matcher2> object to match any type that
1761 // This method template allows Truly(pred) to be used as a matcher
1769 // a value to bool (warning 4800).
1772 // when predicate_(x) returns a class convertible to bool but
1800 // This template operator() allows Matches(m) to be used as a
1808 // We let matcher_ commit to a particular type here instead of
1810 // allows us to write Matches(m) where m is a polymorphic matcher
1832 // argument M must be a type that can be converted to a matcher.
1839 // object to act as a predicate-formatter suitable for using with
1843 // We convert matcher_ to a Matcher<const T&> *now* instead of
1846 // know which type to instantiate it to until we actually see the
1873 // A helper function for converting a matcher to a predicate-formatter
1874 // without the user needing to explicitly write the type. This is
1876 // Implementation detail: 'matcher' is received by-value to force decaying.
1885 // user-specified epsilon. The template is meant to be instantiated with
1894 // negative max_abs_error_ term to indicate that ULP-based approximation will
1958 // store to restore the ostream to its original configuration
2011 // NanSensitiveFloatEq(expected) to be used as a Matcher<float>, a
2014 // by non-const reference, we may see them in code not conforming to
2015 // the style. Therefore Google Mock needs to support them.)
2047 // This type conversion operator template allows Pointee(m) to be
2072 *os << "points to a value that ";
2077 *os << "does not point to a value that ";
2086 *listener << "which points to ";
2103 // The result of dynamic_cast<To> is forwarded to the inner matcher.
2136 *os << "when dynamic_cast to " << GetToName() << ", ";
2153 To to = dynamic_cast<To>(from);
2154 return MatchPrintAndExplain(to, this->matcher_, listener);
2169 To* to = dynamic_cast<To*>(&from);
2170 if (to == NULL) {
2171 *listener << "which cannot be dynamic_cast to " << this->GetToName();
2174 return MatchPrintAndExplain(*to, this->matcher_, listener);
2206 // The first argument of MatchAndExplainImpl() is needed to help
2207 // Symbian's C++ compiler choose which overload to use. Its type is
2208 // true_type iff the Field() matcher is used to match a pointer.
2220 *listener << "which points to an object ";
2239 // may cause double references and fail to compile. That's why we
2267 // The first argument of MatchAndExplainImpl() is needed to help
2268 // Symbian's C++ compiler choose which overload to use. Its type is
2269 // true_type iff the Property() matcher is used to match a pointer.
2273 // Cannot pass the return value (for example, int) to MatchPrintAndExplain,
2277 // https://connect.microsoft.com/VisualStudio/feedback/details/1106363/internal-compiler-error-with-analyze-due-to-failure-to-infer-move
2291 *listener << "which points to an object ";
2306 // Functor classes have to typedef argument_type and result_type
2307 // to be compatible with ResultOf.
2361 *os << "is mapped by the given callable to a value that ";
2366 *os << "is mapped by the given callable to a value that ";
2371 *listener << "which is mapped by the given callable to ";
2372 // Cannot pass the return value (for example, int) to
2381 // they are actualy stateless. But we need to use them even when
2382 // 'this' is a const pointer. It's the user's responsibility not to
2515 // elements in the containers (which don't properly matter to sets, but can
2549 // GTEST_REMOVE_CONST_() is needed to work around an MSVC 8.0 bug
2550 // that causes LhsContainer to be a const type sometimes.
2605 // A comparator functor that uses the < operator to compare two values.
2658 // If the listener is not interested, we do not need to
2689 // must be able to be safely cast to Matcher<tuple<const T1&, const
2722 // We pass the LHS value and the RHS value to the inner matcher by
2723 // reference, as they may be expensive to copy. We must use tuple
2798 // Holds the logic common to ContainsMatcherImpl and EachMatcherImpl.
2843 // Symmetric to EachMatcherImpl.
2872 // Symmetric to ContainsMatcherImpl.
2936 // inner_matcher. For example, Contains(Key(Ge(5))) can be used to match an
3036 // If the listener is not interested, we don't need to construct the
3205 // there's no need to explain anything as Google Mock already
3206 // prints the empty container. Otherwise we just need to show
3223 // Every element matches its expectation. We need to explain why
3255 // Use NextGraph() to iterate over all possible edge configurations.
3256 // Use Randomize() to generate a random edge configuration.
3275 // adds 1 to that number; returns false if incrementing the graph left it
3292 // flattened array in lhs-major order, use 'SpaceIndex()' to translate
3309 // putting logic that's not specific to the element type here, we
3391 // there's no need to explain anything as Google Mock already
3392 // prints the empty container. Otherwise we just need to show
3548 // BoundSecondMatcher is copyable and assignable, as we need to put
3562 // We have to define this for UnorderedPointwise() to compile in
3564 // which requires the elements to be assignable in C++98. The
3569 // need to assert.
3727 // so it's OK to create global variables of this type.
3738 // Creates a polymorphic matcher that matches anything equal to x.
3745 // matcher matches any value that's equal to 'value'.
3750 // and equal to rhs. A user may need to use this instead of Eq(...)
3751 // in order to resolve an overloading ambiguity.
3757 // operations (e.g. TypedLt, TypedGe, and etc), but decided not to do
3759 // can always write Matcher<T>(Lt(5)) to be explicit about the type,
3814 // equal to rhs, where two NANs are considered unequal.
3820 // equal to rhs, including NaN values when rhs is NaN.
3825 // Creates a matcher that matches any double argument approximately equal to
3826 // rhs, up to the specified max absolute error bound, where two NANs are
3833 // Creates a matcher that matches any double argument approximately equal to
3834 // rhs, up to the specified max absolute error bound, including NaN values when
3842 // equal to rhs, where two NANs are considered unequal.
3848 // equal to rhs, including NaN values when rhs is NaN.
3853 // Creates a matcher that matches any float argument approximately equal to
3854 // rhs, up to the specified max absolute error bound, where two NANs are
3861 // Creates a matcher that matches any float argument approximately equal to
3862 // rhs, up to the specified max absolute error bound, including NaN values when
3870 // to a value that matches inner_matcher.
3879 // The result of dynamic_cast<To> is forwarded to the inner matcher.
3901 // The call to MatcherCast() is required for supporting inner
3904 // to compile where bar is an int32 and m is a matcher for int64.
3919 // The call to MatcherCast() is required for supporting inner
3922 // to compile where bar() returns an int32 and m is a matcher for int64.
3926 // a callable to x matches 'matcher'.
3931 // Callable has to satisfy the following conditions:
3932 // * It is required to keep no state affecting the results of
3936 // * If it is a function object, it has to define type result_type.
3945 // The call to MatcherCast() is required for supporting inner
3948 // to compile where Function() returns an int32 and m is a matcher for int64.
3953 // Matches a string equal to str.
3960 // Matches a string not equal to str.
3967 // Matches a string equal to str, ignoring case.
3974 // Matches a string not equal to str, ignoring case.
4028 // Matches a string equal to str.
4035 // Matches a string not equal to str.
4042 // Matches a string equal to str, ignoring case.
4049 // Matches a string not equal to str, ignoring case.
4113 // whose return type can be implicitly converted to bool.
4152 // which causes Container to be a const type sometimes.
4181 // TupleMatcher must be able to be safely cast to Matcher<tuple<const
4189 // which causes Container to be a const type sometimes (e.g. when
4211 // pair matcher, for all i. Tuple2Matcher must be able to be safely
4212 // cast to Matcher<tuple<const T1&, const T2&> >, where T1 and T2 are
4226 // which causes RhsContainer to be a const type sometimes (e.g. when
4230 // RhsView allows the same code to handle RhsContainer being a
4246 // Delegate the work to UnorderedElementsAreArray().
4289 // Each(m) is semantically equivalent to Not(Contains(Not(m))). Only
4319 // inner_matcher. For example, Contains(Key(Ge(5))) can be used to match an
4329 // to match a std::map<int, string> that contains exactly one element whose key
4352 // result to listener.
4378 // which is easier to read than
4384 // These macros allow using matchers to check values in Google Test
4396 // We must include this header at the end to make sure it can use the