Lines Matching refs:matcher

3 A **matcher** matches a *single* argument. You can use it inside `ON_CALL()` or
8 | `EXPECT_THAT(actual_value, matcher)` | Asserts that `actual_value` matches `matcher`. |
9 | `ASSERT_THAT(actual_value, matcher)` | The same as `EXPECT_THAT(actual_value, matcher)`, except t…
57 `non_copyable_value` is not changed afterwards, or the meaning of your matcher
60 `IsTrue` and `IsFalse` are useful when you need to use a matcher, or for types
123 …(e)` | `argument` contains an element that matches `e`, which can be either a value or a matcher. |
124 …, which can be either a value or a matcher, and the number of matches is `n`, which can be either …
125 …ment` is a container where *every* element matches `e`, which can be either a value or a matcher. |
126 …` has `n + 1` elements, where the *i*-th element matches `ei`, which can be a value or a matcher. |
131 …nt in `argument`, the i-th element in `container`) match `m`, which is a matcher on 2-tuples. E.g.…
133 … elements, each element matches an `ei` (for a different `i`), which can be a value or a matcher. |
136 | `WhenSorted(m)` | When `argument` is sorted using the `<` operator, it matches container matcher
149 matcher for `::std::tuple<T, U>` where `T` and `U` are the element type of
166 …field` (or `argument->field` when `argument` is a plain pointer) matches matcher `m`, where `argum…
168 … | `argument.first` matches `e`, which can be either a value or a matcher. E.g. `Contains(K…
171 …` (or `argument->property()` when `argument` is a plain pointer) matches matcher `m`, where `argum…
200 | `ResultOf(f, m)` | `f(argument)` matches matcher `m`, where `f` is a function or functor. |
208 … `argument` (either a smart pointer or a raw pointer) points to a value that matches matcher `m`. |
210 …micCastTo<T>(m)` | when `argument` is passed through `dynamic_cast<T>()`, it matches matcher `m`. |
214 Technically, all matchers match a *single* value. A "multi-argument" matcher is
237 You can make a matcher from one or more other matchers:
245 | `Not(m)` | `argument` doesn't match matcher `m`. |
246 | `Conditional(cond, m1, m2)` | Matches matcher `m1` if `cond` evaluates to true, else matches `m2`…
252 | `MatcherCast<T>(m)` | casts matcher `m` to type `Matcher<T>`. |
253 | `SafeMatcherCast<T>(m)` | [safely casts](../gmock_cook_book.md#SafeMatcherCast) matcher `m` to ty…
271 | `MATCHER(IsEven, "") { return (arg % 2) == 0; }` | Defines a matcher `IsEven()` to match an even …
272 …e the remainder is " << (arg % n); return (arg % n) == 0; }` | Defines a matcher `IsDivisibleBy(n)…
273 … and ", PrintToString(b))) { return a <= arg && arg <= b; }` | Defines a matcher `IsBetween(a, b)`…
278 2. The matcher body must be *purely functional* (i.e. it cannot have any side
280 being matched and the matcher parameters).
283 4. You can use `ExplainMatchResult()` in a custom matcher to wrap another
284 matcher, for example:
287 MATCHER_P(NestedPropertyMatches, matcher, "") {
288 return ExplainMatchResult(matcher, arg.nested().property(), result_listener);
292 5. You can use `DescribeMatcher<>` to describe another matcher. For example:
295 MATCHER_P(XAndYThat, matcher,
296 "X that " + DescribeMatcher<int>(matcher, negation) +
298 DescribeMatcher<double>(matcher, negation)) {
299 return ExplainMatchResult(matcher, arg.x(), result_listener) &&
300 ExplainMatchResult(matcher, arg.y(), result_listener);