• Home
  • History
  • Annotate
  • Raw
  • Download

Lines Matching +full:argument +full:- +full:count

3 A **matcher** matches a *single* argument. You can use it inside `ON_CALL()` or
7 | :----------------------------------- | :------------------------------------ |
17 Built-in matchers (where `argument` is the function argument, e.g.
25 :-------------------------- | :-----------------------------------------------
26 `_` | `argument` can be any value of the correct type.
27 `A<type>()` or `An<type>()` | `argument` can be any value of type `type`.
32 | :--------------------- | :-------------------------------------------------- |
33 | `Eq(value)` or `value` | `argument == value` |
34 | `Ge(value)` | `argument >= value` |
35 | `Gt(value)` | `argument > value` |
36 | `Le(value)` | `argument <= value` |
37 | `Lt(value)` | `argument < value` |
38 | `Ne(value)` | `argument != value` |
39 | `IsFalse()` | `argument` evaluates to `false` in a Boolean context. |
40 | `IsTrue()` | `argument` evaluates to `true` in a Boolean context. |
41 | `IsNull()` | `argument` is a `NULL` pointer (raw or smart). |
42 | `NotNull()` | `argument` is a non-null pointer (raw or smart). |
43 | `Optional(m)` | `argument` is `optional<>` that contains a value matching `m`. (For test…
44 | `VariantWith<T>(m)` | `argument` is `variant<>` that holds the alternative of type T with a va…
45 | `Ref(variable)` | `argument` is a reference to `variable`. |
46 | `TypedEq<type>(value)` | `argument` has type `type` and is equal to `value`. You may need to use …
58 [`EXPECT_TRUE` and `EXPECT_FALSE`](primer.md#basic-assertions) assertions.
60 ### Floating-Point Matchers {#FpMatchers}
63 | :------------------------------- | :--------------------------------- |
64 | `DoubleEq(a_double)` | `argument` is a `double` value approximately equal to `a_doubl…
65 | `FloatEq(a_float)` | `argument` is a `float` value approximately equal to `a_float`…
66 | `NanSensitiveDoubleEq(a_double)` | `argument` is a `double` value approximately equal to `a_doubl…
67 | `NanSensitiveFloatEq(a_float)` | `argument` is a `float` value approximately equal to `a_float`…
68 | `IsNan()` | `argument` is any floating-point type with a NaN value. |
70 The above matchers use ULP-based comparison (the same as used in googletest).
78 | :------------------------------------------------ | :----------------------- |
79 | `DoubleNear(a_double, max_abs_error)` | `argument` is a `double` value close to `a_do…
80 | `FloatNear(a_float, max_abs_error)` | `argument` is a `float` value close to `a_flo…
81 | `NanSensitiveDoubleNear(a_double, max_abs_error)` | `argument` is a `double` value close to `a_do…
82 | `NanSensitiveFloatNear(a_float, max_abs_error)` | `argument` is a `float` value close to `a_flo…
86 The `argument` can be either a C string or a C++ string object:
89 | :---------------------- | :------------------------------------------------- |
90 | `ContainsRegex(string)` | `argument` matches the given regular expression. |
91 | `EndsWith(suffix)` | `argument` ends with string `suffix`. |
92 | `HasSubstr(string)` | `argument` contains `string` as a sub-string. |
93 | `IsEmpty()` | `argument` is an empty string. |
94 | `MatchesRegex(string)` | `argument` matches the given regular expression with the match starting…
95 | `StartsWith(prefix)` | `argument` starts with string `prefix`. |
96 | `StrCaseEq(string)` | `argument` is equal to `string`, ignoring case. |
97 | `StrCaseNe(string)` | `argument` is not equal to `string`, ignoring case. |
98 | `StrEq(string)` | `argument` is equal to `string`. |
99 | `StrNe(string)` | `argument` is not equal to `string`. |
103 [here](advanced.md#regular-expression-syntax). All of these matchers, except
108 Most STL-style containers support `==`, so you can use `Eq(expected_container)`
110 write the elements in-line, match them more flexibly, or get more informative
114 | :---------------------------------------- | :------------------------------- |
115 | `BeginEndDistanceIs(m)` | `argument` is a container whose `begin()` and `end()` iterators are sep…
117 | `Contains(e)` | `argument` contains an element that matches `e`, which can be either a value or a…
118 | `Each(e)` | `argument` is a container where *every* element matches `e`, which can be either a va…
119 | `ElementsAre(e0, e1, ..., en)` | `argument` has `n + 1` elements, where the *i*-th element matche…
120count)` | The same as `ElementsAre()` except that the expected element values/matchers come from a…
121 | `IsEmpty()` | `argument` is an empty container (`container.empty()`). |
122 …sSubsetOf(begin, end)`, `IsSubsetOf(array)`, or `IsSubsetOf(array, count)` | `argument` matches `U…
123 …gin, end)`, `IsSupersetOf(array)`, or `IsSupersetOf(array, count)` | Some subset of `argument` mat…
124argument` contains the same number of elements as in `container`, and for all i, (the i-th element…
125 | `SizeIs(m)` | `argument` is a container whose size matches `m`. E.g. `SizeIs(2)` or `SizeIs(Lt(2)…
126 | `UnorderedElementsAre(e0, e1, ..., en)` | `argument` has `n + 1` elements, and under *some* permu…
127count)` | The same as `UnorderedElementsAre()` except that the expected element values/matchers co…
129 …When `argument` is sorted using the `<` operator, it matches container matcher `m`. E.g. `WhenSort…
130 …d(m)`, except that the given comparator instead of `<` is used to sort `argument`. E.g. `WhenSorte…
137 2. an array passed as a pointer and a count (e.g. in `Bar(const T* buffer,
138 int len)` -- see [Multi-argument Matchers](#MultiArgMatchers)).
139 * The array being matched may be multi-dimensional (i.e. its elements can be
159 | :------------------------------ | :----------------------------------------- |
160 …:field, m)` | `argument.field` (or `argument->field` when `argument` is a plain pointer) mat…
161 | `Field(field_name, &class::field, m)` | The same as the two-parameter version, but provides a bet…
162 | `Key(e)` | `argument.first` matches `e`, which can be either a value or a …
163 | `Pair(m1, m2)` | `argument` is an `std::pair` whose `first` field matches `m1` a…
164 | `FieldsAre(m...)` | `argument` is a compatible object where each field matches …
165argument.property()` (or `argument->property()` when `argument` is a plain pointer) matches matche…
166 | `Property(property_name, &class::property, m)` | The same as the two-parameter version, but provi…
193 | :--------------- | :------------------------------------------------ |
194 | `ResultOf(f, m)` | `f(argument)` matches matcher `m`, where `f` is a function or functor. |
199 | :------------------------ | :---------------------------------------------- |
200 | `Address(m)` | the result of `std::addressof(argument)` matches `m`. |
201 | `Pointee(m)` | `argument` (either a smart pointer or a raw pointer) points to a valu…
202argument` (either a smart pointer or a raw pointer) contains a pointer that matches `m`. `m` will …
203 | `WhenDynamicCastTo<T>(m)` | when `argument` is passed through `dynamic_cast<T>()`, it matches mat…
205 ### Multi-argument Matchers {#MultiArgMatchers}
207 Technically, all matchers match a *single* value. A "multi-argument" matcher is
212 :------ | :----------
224 | :------------------------- | :---------------------------------------------- |
226 | `Args<N1, N2, ..., Nk>(m)` | The tuple of the `k` selected (using 0-based indices) arguments matc…
233 | :------------------------------- | :-------------------------------------- |
234 | `AllOf(m1, m2, ..., mn)` | `argument` matches all of the matchers `m1` to `mn`. |
235 …ray(array, count)` | The same as `AllOf()` except that the matchers come from an initializer list,…
236 | `AnyOf(m1, m2, ..., mn)` | `argument` matches at least one of the matchers `m1` to `mn`. |
237 …ray(array, count)` | The same as `AnyOf()` except that the matchers come from an initializer list,…
238 | `Not(m)` | `argument` doesn't match matcher `m`. |
243 | :---------------------- | :------------------------------------ |
245 | `SafeMatcherCast<T>(m)` | [safely casts](gmock_cook_book.md#casting-matchers) matcher `m` to type…
246 | `Truly(predicate)` | `predicate(argument)` returns something considered by C++ to be true, w…
254 | :---------------------------- | :------------------------------------------ |
262 | :----------------------------------- | :------------------------------------ |