/work/obj-fuzz/dist/include/gmock/gmock-generated-matchers.h
Line | Count | Source (jump to first uncovered line) |
1 | | // This file was GENERATED by command: |
2 | | // pump.py gmock-generated-matchers.h.pump |
3 | | // DO NOT EDIT BY HAND!!! |
4 | | |
5 | | // Copyright 2008, Google Inc. |
6 | | // All rights reserved. |
7 | | // |
8 | | // Redistribution and use in source and binary forms, with or without |
9 | | // modification, are permitted provided that the following conditions are |
10 | | // met: |
11 | | // |
12 | | // * Redistributions of source code must retain the above copyright |
13 | | // notice, this list of conditions and the following disclaimer. |
14 | | // * Redistributions in binary form must reproduce the above |
15 | | // copyright notice, this list of conditions and the following disclaimer |
16 | | // in the documentation and/or other materials provided with the |
17 | | // distribution. |
18 | | // * Neither the name of Google Inc. nor the names of its |
19 | | // contributors may be used to endorse or promote products derived from |
20 | | // this software without specific prior written permission. |
21 | | // |
22 | | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
23 | | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
24 | | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
25 | | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
26 | | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
27 | | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
28 | | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
29 | | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
30 | | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
31 | | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
32 | | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
33 | | |
34 | | // Google Mock - a framework for writing C++ mock classes. |
35 | | // |
36 | | // This file implements some commonly used variadic matchers. |
37 | | |
38 | | #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ |
39 | | #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ |
40 | | |
41 | | #include <iterator> |
42 | | #include <sstream> |
43 | | #include <string> |
44 | | #include <vector> |
45 | | #include "gmock/gmock-matchers.h" |
46 | | |
47 | | namespace testing { |
48 | | namespace internal { |
49 | | |
50 | | // The type of the i-th (0-based) field of Tuple. |
51 | | #define GMOCK_FIELD_TYPE_(Tuple, i) \ |
52 | | typename ::testing::tuple_element<i, Tuple>::type |
53 | | |
54 | | // TupleFields<Tuple, k0, ..., kn> is for selecting fields from a |
55 | | // tuple of type Tuple. It has two members: |
56 | | // |
57 | | // type: a tuple type whose i-th field is the ki-th field of Tuple. |
58 | | // GetSelectedFields(t): returns fields k0, ..., and kn of t as a tuple. |
59 | | // |
60 | | // For example, in class TupleFields<tuple<bool, char, int>, 2, 0>, we have: |
61 | | // |
62 | | // type is tuple<int, bool>, and |
63 | | // GetSelectedFields(make_tuple(true, 'a', 42)) is (42, true). |
64 | | |
65 | | template <class Tuple, int k0 = -1, int k1 = -1, int k2 = -1, int k3 = -1, |
66 | | int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1, |
67 | | int k9 = -1> |
68 | | class TupleFields; |
69 | | |
70 | | // This generic version is used when there are 10 selectors. |
71 | | template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6, |
72 | | int k7, int k8, int k9> |
73 | | class TupleFields { |
74 | | public: |
75 | | typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), |
76 | | GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), |
77 | | GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4), |
78 | | GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6), |
79 | | GMOCK_FIELD_TYPE_(Tuple, k7), GMOCK_FIELD_TYPE_(Tuple, k8), |
80 | | GMOCK_FIELD_TYPE_(Tuple, k9)> type; |
81 | | static type GetSelectedFields(const Tuple& t) { |
82 | | return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t), |
83 | | get<k5>(t), get<k6>(t), get<k7>(t), get<k8>(t), get<k9>(t)); |
84 | | } |
85 | | }; |
86 | | |
87 | | // The following specialization is used for 0 ~ 9 selectors. |
88 | | |
89 | | template <class Tuple> |
90 | | class TupleFields<Tuple, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> { |
91 | | public: |
92 | | typedef ::testing::tuple<> type; |
93 | | static type GetSelectedFields(const Tuple& /* t */) { |
94 | | return type(); |
95 | | } |
96 | | }; |
97 | | |
98 | | template <class Tuple, int k0> |
99 | | class TupleFields<Tuple, k0, -1, -1, -1, -1, -1, -1, -1, -1, -1> { |
100 | | public: |
101 | | typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0)> type; |
102 | | static type GetSelectedFields(const Tuple& t) { |
103 | | return type(get<k0>(t)); |
104 | | } |
105 | | }; |
106 | | |
107 | | template <class Tuple, int k0, int k1> |
108 | | class TupleFields<Tuple, k0, k1, -1, -1, -1, -1, -1, -1, -1, -1> { |
109 | | public: |
110 | | typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), |
111 | | GMOCK_FIELD_TYPE_(Tuple, k1)> type; |
112 | | static type GetSelectedFields(const Tuple& t) { |
113 | | return type(get<k0>(t), get<k1>(t)); |
114 | | } |
115 | | }; |
116 | | |
117 | | template <class Tuple, int k0, int k1, int k2> |
118 | | class TupleFields<Tuple, k0, k1, k2, -1, -1, -1, -1, -1, -1, -1> { |
119 | | public: |
120 | | typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), |
121 | | GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2)> type; |
122 | | static type GetSelectedFields(const Tuple& t) { |
123 | | return type(get<k0>(t), get<k1>(t), get<k2>(t)); |
124 | | } |
125 | | }; |
126 | | |
127 | | template <class Tuple, int k0, int k1, int k2, int k3> |
128 | | class TupleFields<Tuple, k0, k1, k2, k3, -1, -1, -1, -1, -1, -1> { |
129 | | public: |
130 | | typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), |
131 | | GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), |
132 | | GMOCK_FIELD_TYPE_(Tuple, k3)> type; |
133 | | static type GetSelectedFields(const Tuple& t) { |
134 | | return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t)); |
135 | | } |
136 | | }; |
137 | | |
138 | | template <class Tuple, int k0, int k1, int k2, int k3, int k4> |
139 | | class TupleFields<Tuple, k0, k1, k2, k3, k4, -1, -1, -1, -1, -1> { |
140 | | public: |
141 | | typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), |
142 | | GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), |
143 | | GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4)> type; |
144 | | static type GetSelectedFields(const Tuple& t) { |
145 | | return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t)); |
146 | | } |
147 | | }; |
148 | | |
149 | | template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5> |
150 | | class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, -1, -1, -1, -1> { |
151 | | public: |
152 | | typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), |
153 | | GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), |
154 | | GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4), |
155 | | GMOCK_FIELD_TYPE_(Tuple, k5)> type; |
156 | | static type GetSelectedFields(const Tuple& t) { |
157 | | return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t), |
158 | | get<k5>(t)); |
159 | | } |
160 | | }; |
161 | | |
162 | | template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6> |
163 | | class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, -1, -1, -1> { |
164 | | public: |
165 | | typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), |
166 | | GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), |
167 | | GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4), |
168 | | GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6)> type; |
169 | | static type GetSelectedFields(const Tuple& t) { |
170 | | return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t), |
171 | | get<k5>(t), get<k6>(t)); |
172 | | } |
173 | | }; |
174 | | |
175 | | template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6, |
176 | | int k7> |
177 | | class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, k7, -1, -1> { |
178 | | public: |
179 | | typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), |
180 | | GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), |
181 | | GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4), |
182 | | GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6), |
183 | | GMOCK_FIELD_TYPE_(Tuple, k7)> type; |
184 | | static type GetSelectedFields(const Tuple& t) { |
185 | | return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t), |
186 | | get<k5>(t), get<k6>(t), get<k7>(t)); |
187 | | } |
188 | | }; |
189 | | |
190 | | template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int k6, |
191 | | int k7, int k8> |
192 | | class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, k7, k8, -1> { |
193 | | public: |
194 | | typedef ::testing::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), |
195 | | GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), |
196 | | GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4), |
197 | | GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6), |
198 | | GMOCK_FIELD_TYPE_(Tuple, k7), GMOCK_FIELD_TYPE_(Tuple, k8)> type; |
199 | | static type GetSelectedFields(const Tuple& t) { |
200 | | return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t), |
201 | | get<k5>(t), get<k6>(t), get<k7>(t), get<k8>(t)); |
202 | | } |
203 | | }; |
204 | | |
205 | | #undef GMOCK_FIELD_TYPE_ |
206 | | |
207 | | // Implements the Args() matcher. |
208 | | template <class ArgsTuple, int k0 = -1, int k1 = -1, int k2 = -1, int k3 = -1, |
209 | | int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1, |
210 | | int k9 = -1> |
211 | | class ArgsMatcherImpl : public MatcherInterface<ArgsTuple> { |
212 | | public: |
213 | | // ArgsTuple may have top-level const or reference modifiers. |
214 | | typedef GTEST_REMOVE_REFERENCE_AND_CONST_(ArgsTuple) RawArgsTuple; |
215 | | typedef typename internal::TupleFields<RawArgsTuple, k0, k1, k2, k3, k4, k5, |
216 | | k6, k7, k8, k9>::type SelectedArgs; |
217 | | typedef Matcher<const SelectedArgs&> MonomorphicInnerMatcher; |
218 | | |
219 | | template <typename InnerMatcher> |
220 | | explicit ArgsMatcherImpl(const InnerMatcher& inner_matcher) |
221 | | : inner_matcher_(SafeMatcherCast<const SelectedArgs&>(inner_matcher)) {} |
222 | | |
223 | | virtual bool MatchAndExplain(ArgsTuple args, |
224 | | MatchResultListener* listener) const { |
225 | | const SelectedArgs& selected_args = GetSelectedArgs(args); |
226 | | if (!listener->IsInterested()) |
227 | | return inner_matcher_.Matches(selected_args); |
228 | | |
229 | | PrintIndices(listener->stream()); |
230 | | *listener << "are " << PrintToString(selected_args); |
231 | | |
232 | | StringMatchResultListener inner_listener; |
233 | | const bool match = inner_matcher_.MatchAndExplain(selected_args, |
234 | | &inner_listener); |
235 | | PrintIfNotEmpty(inner_listener.str(), listener->stream()); |
236 | | return match; |
237 | | } |
238 | | |
239 | | virtual void DescribeTo(::std::ostream* os) const { |
240 | | *os << "are a tuple "; |
241 | | PrintIndices(os); |
242 | | inner_matcher_.DescribeTo(os); |
243 | | } |
244 | | |
245 | | virtual void DescribeNegationTo(::std::ostream* os) const { |
246 | | *os << "are a tuple "; |
247 | | PrintIndices(os); |
248 | | inner_matcher_.DescribeNegationTo(os); |
249 | | } |
250 | | |
251 | | private: |
252 | | static SelectedArgs GetSelectedArgs(ArgsTuple args) { |
253 | | return TupleFields<RawArgsTuple, k0, k1, k2, k3, k4, k5, k6, k7, k8, |
254 | | k9>::GetSelectedFields(args); |
255 | | } |
256 | | |
257 | | // Prints the indices of the selected fields. |
258 | | static void PrintIndices(::std::ostream* os) { |
259 | | *os << "whose fields ("; |
260 | | const int indices[10] = { k0, k1, k2, k3, k4, k5, k6, k7, k8, k9 }; |
261 | | for (int i = 0; i < 10; i++) { |
262 | | if (indices[i] < 0) |
263 | | break; |
264 | | |
265 | | if (i >= 1) |
266 | | *os << ", "; |
267 | | |
268 | | *os << "#" << indices[i]; |
269 | | } |
270 | | *os << ") "; |
271 | | } |
272 | | |
273 | | const MonomorphicInnerMatcher inner_matcher_; |
274 | | |
275 | | GTEST_DISALLOW_ASSIGN_(ArgsMatcherImpl); |
276 | | }; |
277 | | |
278 | | template <class InnerMatcher, int k0 = -1, int k1 = -1, int k2 = -1, |
279 | | int k3 = -1, int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, |
280 | | int k8 = -1, int k9 = -1> |
281 | | class ArgsMatcher { |
282 | | public: |
283 | | explicit ArgsMatcher(const InnerMatcher& inner_matcher) |
284 | | : inner_matcher_(inner_matcher) {} |
285 | | |
286 | | template <typename ArgsTuple> |
287 | | operator Matcher<ArgsTuple>() const { |
288 | | return MakeMatcher(new ArgsMatcherImpl<ArgsTuple, k0, k1, k2, k3, k4, k5, |
289 | | k6, k7, k8, k9>(inner_matcher_)); |
290 | | } |
291 | | |
292 | | private: |
293 | | const InnerMatcher inner_matcher_; |
294 | | |
295 | | GTEST_DISALLOW_ASSIGN_(ArgsMatcher); |
296 | | }; |
297 | | |
298 | | // A set of metafunctions for computing the result type of AllOf. |
299 | | // AllOf(m1, ..., mN) returns |
300 | | // AllOfResultN<decltype(m1), ..., decltype(mN)>::type. |
301 | | |
302 | | // Although AllOf isn't defined for one argument, AllOfResult1 is defined |
303 | | // to simplify the implementation. |
304 | | template <typename M1> |
305 | | struct AllOfResult1 { |
306 | | typedef M1 type; |
307 | | }; |
308 | | |
309 | | template <typename M1, typename M2> |
310 | | struct AllOfResult2 { |
311 | | typedef BothOfMatcher< |
312 | | typename AllOfResult1<M1>::type, |
313 | | typename AllOfResult1<M2>::type |
314 | | > type; |
315 | | }; |
316 | | |
317 | | template <typename M1, typename M2, typename M3> |
318 | | struct AllOfResult3 { |
319 | | typedef BothOfMatcher< |
320 | | typename AllOfResult1<M1>::type, |
321 | | typename AllOfResult2<M2, M3>::type |
322 | | > type; |
323 | | }; |
324 | | |
325 | | template <typename M1, typename M2, typename M3, typename M4> |
326 | | struct AllOfResult4 { |
327 | | typedef BothOfMatcher< |
328 | | typename AllOfResult2<M1, M2>::type, |
329 | | typename AllOfResult2<M3, M4>::type |
330 | | > type; |
331 | | }; |
332 | | |
333 | | template <typename M1, typename M2, typename M3, typename M4, typename M5> |
334 | | struct AllOfResult5 { |
335 | | typedef BothOfMatcher< |
336 | | typename AllOfResult2<M1, M2>::type, |
337 | | typename AllOfResult3<M3, M4, M5>::type |
338 | | > type; |
339 | | }; |
340 | | |
341 | | template <typename M1, typename M2, typename M3, typename M4, typename M5, |
342 | | typename M6> |
343 | | struct AllOfResult6 { |
344 | | typedef BothOfMatcher< |
345 | | typename AllOfResult3<M1, M2, M3>::type, |
346 | | typename AllOfResult3<M4, M5, M6>::type |
347 | | > type; |
348 | | }; |
349 | | |
350 | | template <typename M1, typename M2, typename M3, typename M4, typename M5, |
351 | | typename M6, typename M7> |
352 | | struct AllOfResult7 { |
353 | | typedef BothOfMatcher< |
354 | | typename AllOfResult3<M1, M2, M3>::type, |
355 | | typename AllOfResult4<M4, M5, M6, M7>::type |
356 | | > type; |
357 | | }; |
358 | | |
359 | | template <typename M1, typename M2, typename M3, typename M4, typename M5, |
360 | | typename M6, typename M7, typename M8> |
361 | | struct AllOfResult8 { |
362 | | typedef BothOfMatcher< |
363 | | typename AllOfResult4<M1, M2, M3, M4>::type, |
364 | | typename AllOfResult4<M5, M6, M7, M8>::type |
365 | | > type; |
366 | | }; |
367 | | |
368 | | template <typename M1, typename M2, typename M3, typename M4, typename M5, |
369 | | typename M6, typename M7, typename M8, typename M9> |
370 | | struct AllOfResult9 { |
371 | | typedef BothOfMatcher< |
372 | | typename AllOfResult4<M1, M2, M3, M4>::type, |
373 | | typename AllOfResult5<M5, M6, M7, M8, M9>::type |
374 | | > type; |
375 | | }; |
376 | | |
377 | | template <typename M1, typename M2, typename M3, typename M4, typename M5, |
378 | | typename M6, typename M7, typename M8, typename M9, typename M10> |
379 | | struct AllOfResult10 { |
380 | | typedef BothOfMatcher< |
381 | | typename AllOfResult5<M1, M2, M3, M4, M5>::type, |
382 | | typename AllOfResult5<M6, M7, M8, M9, M10>::type |
383 | | > type; |
384 | | }; |
385 | | |
386 | | // A set of metafunctions for computing the result type of AnyOf. |
387 | | // AnyOf(m1, ..., mN) returns |
388 | | // AnyOfResultN<decltype(m1), ..., decltype(mN)>::type. |
389 | | |
390 | | // Although AnyOf isn't defined for one argument, AnyOfResult1 is defined |
391 | | // to simplify the implementation. |
392 | | template <typename M1> |
393 | | struct AnyOfResult1 { |
394 | | typedef M1 type; |
395 | | }; |
396 | | |
397 | | template <typename M1, typename M2> |
398 | | struct AnyOfResult2 { |
399 | | typedef EitherOfMatcher< |
400 | | typename AnyOfResult1<M1>::type, |
401 | | typename AnyOfResult1<M2>::type |
402 | | > type; |
403 | | }; |
404 | | |
405 | | template <typename M1, typename M2, typename M3> |
406 | | struct AnyOfResult3 { |
407 | | typedef EitherOfMatcher< |
408 | | typename AnyOfResult1<M1>::type, |
409 | | typename AnyOfResult2<M2, M3>::type |
410 | | > type; |
411 | | }; |
412 | | |
413 | | template <typename M1, typename M2, typename M3, typename M4> |
414 | | struct AnyOfResult4 { |
415 | | typedef EitherOfMatcher< |
416 | | typename AnyOfResult2<M1, M2>::type, |
417 | | typename AnyOfResult2<M3, M4>::type |
418 | | > type; |
419 | | }; |
420 | | |
421 | | template <typename M1, typename M2, typename M3, typename M4, typename M5> |
422 | | struct AnyOfResult5 { |
423 | | typedef EitherOfMatcher< |
424 | | typename AnyOfResult2<M1, M2>::type, |
425 | | typename AnyOfResult3<M3, M4, M5>::type |
426 | | > type; |
427 | | }; |
428 | | |
429 | | template <typename M1, typename M2, typename M3, typename M4, typename M5, |
430 | | typename M6> |
431 | | struct AnyOfResult6 { |
432 | | typedef EitherOfMatcher< |
433 | | typename AnyOfResult3<M1, M2, M3>::type, |
434 | | typename AnyOfResult3<M4, M5, M6>::type |
435 | | > type; |
436 | | }; |
437 | | |
438 | | template <typename M1, typename M2, typename M3, typename M4, typename M5, |
439 | | typename M6, typename M7> |
440 | | struct AnyOfResult7 { |
441 | | typedef EitherOfMatcher< |
442 | | typename AnyOfResult3<M1, M2, M3>::type, |
443 | | typename AnyOfResult4<M4, M5, M6, M7>::type |
444 | | > type; |
445 | | }; |
446 | | |
447 | | template <typename M1, typename M2, typename M3, typename M4, typename M5, |
448 | | typename M6, typename M7, typename M8> |
449 | | struct AnyOfResult8 { |
450 | | typedef EitherOfMatcher< |
451 | | typename AnyOfResult4<M1, M2, M3, M4>::type, |
452 | | typename AnyOfResult4<M5, M6, M7, M8>::type |
453 | | > type; |
454 | | }; |
455 | | |
456 | | template <typename M1, typename M2, typename M3, typename M4, typename M5, |
457 | | typename M6, typename M7, typename M8, typename M9> |
458 | | struct AnyOfResult9 { |
459 | | typedef EitherOfMatcher< |
460 | | typename AnyOfResult4<M1, M2, M3, M4>::type, |
461 | | typename AnyOfResult5<M5, M6, M7, M8, M9>::type |
462 | | > type; |
463 | | }; |
464 | | |
465 | | template <typename M1, typename M2, typename M3, typename M4, typename M5, |
466 | | typename M6, typename M7, typename M8, typename M9, typename M10> |
467 | | struct AnyOfResult10 { |
468 | | typedef EitherOfMatcher< |
469 | | typename AnyOfResult5<M1, M2, M3, M4, M5>::type, |
470 | | typename AnyOfResult5<M6, M7, M8, M9, M10>::type |
471 | | > type; |
472 | | }; |
473 | | |
474 | | } // namespace internal |
475 | | |
476 | | // Args<N1, N2, ..., Nk>(a_matcher) matches a tuple if the selected |
477 | | // fields of it matches a_matcher. C++ doesn't support default |
478 | | // arguments for function templates, so we have to overload it. |
479 | | template <typename InnerMatcher> |
480 | | inline internal::ArgsMatcher<InnerMatcher> |
481 | | Args(const InnerMatcher& matcher) { |
482 | | return internal::ArgsMatcher<InnerMatcher>(matcher); |
483 | | } |
484 | | |
485 | | template <int k1, typename InnerMatcher> |
486 | | inline internal::ArgsMatcher<InnerMatcher, k1> |
487 | | Args(const InnerMatcher& matcher) { |
488 | | return internal::ArgsMatcher<InnerMatcher, k1>(matcher); |
489 | | } |
490 | | |
491 | | template <int k1, int k2, typename InnerMatcher> |
492 | | inline internal::ArgsMatcher<InnerMatcher, k1, k2> |
493 | | Args(const InnerMatcher& matcher) { |
494 | | return internal::ArgsMatcher<InnerMatcher, k1, k2>(matcher); |
495 | | } |
496 | | |
497 | | template <int k1, int k2, int k3, typename InnerMatcher> |
498 | | inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3> |
499 | | Args(const InnerMatcher& matcher) { |
500 | | return internal::ArgsMatcher<InnerMatcher, k1, k2, k3>(matcher); |
501 | | } |
502 | | |
503 | | template <int k1, int k2, int k3, int k4, typename InnerMatcher> |
504 | | inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4> |
505 | | Args(const InnerMatcher& matcher) { |
506 | | return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4>(matcher); |
507 | | } |
508 | | |
509 | | template <int k1, int k2, int k3, int k4, int k5, typename InnerMatcher> |
510 | | inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5> |
511 | | Args(const InnerMatcher& matcher) { |
512 | | return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5>(matcher); |
513 | | } |
514 | | |
515 | | template <int k1, int k2, int k3, int k4, int k5, int k6, typename InnerMatcher> |
516 | | inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6> |
517 | | Args(const InnerMatcher& matcher) { |
518 | | return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6>(matcher); |
519 | | } |
520 | | |
521 | | template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, |
522 | | typename InnerMatcher> |
523 | | inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7> |
524 | | Args(const InnerMatcher& matcher) { |
525 | | return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, |
526 | | k7>(matcher); |
527 | | } |
528 | | |
529 | | template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8, |
530 | | typename InnerMatcher> |
531 | | inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8> |
532 | | Args(const InnerMatcher& matcher) { |
533 | | return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, |
534 | | k8>(matcher); |
535 | | } |
536 | | |
537 | | template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8, |
538 | | int k9, typename InnerMatcher> |
539 | | inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8, k9> |
540 | | Args(const InnerMatcher& matcher) { |
541 | | return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8, |
542 | | k9>(matcher); |
543 | | } |
544 | | |
545 | | template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8, |
546 | | int k9, int k10, typename InnerMatcher> |
547 | | inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8, k9, |
548 | | k10> |
549 | | Args(const InnerMatcher& matcher) { |
550 | | return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8, |
551 | | k9, k10>(matcher); |
552 | | } |
553 | | |
554 | | // ElementsAre(e_1, e_2, ... e_n) matches an STL-style container with |
555 | | // n elements, where the i-th element in the container must |
556 | | // match the i-th argument in the list. Each argument of |
557 | | // ElementsAre() can be either a value or a matcher. We support up to |
558 | | // 10 arguments. |
559 | | // |
560 | | // The use of DecayArray in the implementation allows ElementsAre() |
561 | | // to accept string literals, whose type is const char[N], but we |
562 | | // want to treat them as const char*. |
563 | | // |
564 | | // NOTE: Since ElementsAre() cares about the order of the elements, it |
565 | | // must not be used with containers whose elements's order is |
566 | | // undefined (e.g. hash_map). |
567 | | |
568 | | inline internal::ElementsAreMatcher< |
569 | | ::testing::tuple<> > |
570 | 0 | ElementsAre() { |
571 | 0 | typedef ::testing::tuple<> Args; |
572 | 0 | return internal::ElementsAreMatcher<Args>(Args()); |
573 | 0 | } |
574 | | |
575 | | template <typename T1> |
576 | | inline internal::ElementsAreMatcher< |
577 | | ::testing::tuple< |
578 | | typename internal::DecayArray<T1>::type> > |
579 | | ElementsAre(const T1& e1) { |
580 | | typedef ::testing::tuple< |
581 | | typename internal::DecayArray<T1>::type> Args; |
582 | | return internal::ElementsAreMatcher<Args>(Args(e1)); |
583 | | } |
584 | | |
585 | | template <typename T1, typename T2> |
586 | | inline internal::ElementsAreMatcher< |
587 | | ::testing::tuple< |
588 | | typename internal::DecayArray<T1>::type, |
589 | | typename internal::DecayArray<T2>::type> > |
590 | | ElementsAre(const T1& e1, const T2& e2) { |
591 | | typedef ::testing::tuple< |
592 | | typename internal::DecayArray<T1>::type, |
593 | | typename internal::DecayArray<T2>::type> Args; |
594 | | return internal::ElementsAreMatcher<Args>(Args(e1, e2)); |
595 | | } |
596 | | |
597 | | template <typename T1, typename T2, typename T3> |
598 | | inline internal::ElementsAreMatcher< |
599 | | ::testing::tuple< |
600 | | typename internal::DecayArray<T1>::type, |
601 | | typename internal::DecayArray<T2>::type, |
602 | | typename internal::DecayArray<T3>::type> > |
603 | | ElementsAre(const T1& e1, const T2& e2, const T3& e3) { |
604 | | typedef ::testing::tuple< |
605 | | typename internal::DecayArray<T1>::type, |
606 | | typename internal::DecayArray<T2>::type, |
607 | | typename internal::DecayArray<T3>::type> Args; |
608 | | return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3)); |
609 | | } |
610 | | |
611 | | template <typename T1, typename T2, typename T3, typename T4> |
612 | | inline internal::ElementsAreMatcher< |
613 | | ::testing::tuple< |
614 | | typename internal::DecayArray<T1>::type, |
615 | | typename internal::DecayArray<T2>::type, |
616 | | typename internal::DecayArray<T3>::type, |
617 | | typename internal::DecayArray<T4>::type> > |
618 | | ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4) { |
619 | | typedef ::testing::tuple< |
620 | | typename internal::DecayArray<T1>::type, |
621 | | typename internal::DecayArray<T2>::type, |
622 | | typename internal::DecayArray<T3>::type, |
623 | | typename internal::DecayArray<T4>::type> Args; |
624 | | return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4)); |
625 | | } |
626 | | |
627 | | template <typename T1, typename T2, typename T3, typename T4, typename T5> |
628 | | inline internal::ElementsAreMatcher< |
629 | | ::testing::tuple< |
630 | | typename internal::DecayArray<T1>::type, |
631 | | typename internal::DecayArray<T2>::type, |
632 | | typename internal::DecayArray<T3>::type, |
633 | | typename internal::DecayArray<T4>::type, |
634 | | typename internal::DecayArray<T5>::type> > |
635 | | ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
636 | | const T5& e5) { |
637 | | typedef ::testing::tuple< |
638 | | typename internal::DecayArray<T1>::type, |
639 | | typename internal::DecayArray<T2>::type, |
640 | | typename internal::DecayArray<T3>::type, |
641 | | typename internal::DecayArray<T4>::type, |
642 | | typename internal::DecayArray<T5>::type> Args; |
643 | | return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5)); |
644 | | } |
645 | | |
646 | | template <typename T1, typename T2, typename T3, typename T4, typename T5, |
647 | | typename T6> |
648 | | inline internal::ElementsAreMatcher< |
649 | | ::testing::tuple< |
650 | | typename internal::DecayArray<T1>::type, |
651 | | typename internal::DecayArray<T2>::type, |
652 | | typename internal::DecayArray<T3>::type, |
653 | | typename internal::DecayArray<T4>::type, |
654 | | typename internal::DecayArray<T5>::type, |
655 | | typename internal::DecayArray<T6>::type> > |
656 | | ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
657 | | const T5& e5, const T6& e6) { |
658 | | typedef ::testing::tuple< |
659 | | typename internal::DecayArray<T1>::type, |
660 | | typename internal::DecayArray<T2>::type, |
661 | | typename internal::DecayArray<T3>::type, |
662 | | typename internal::DecayArray<T4>::type, |
663 | | typename internal::DecayArray<T5>::type, |
664 | | typename internal::DecayArray<T6>::type> Args; |
665 | | return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6)); |
666 | | } |
667 | | |
668 | | template <typename T1, typename T2, typename T3, typename T4, typename T5, |
669 | | typename T6, typename T7> |
670 | | inline internal::ElementsAreMatcher< |
671 | | ::testing::tuple< |
672 | | typename internal::DecayArray<T1>::type, |
673 | | typename internal::DecayArray<T2>::type, |
674 | | typename internal::DecayArray<T3>::type, |
675 | | typename internal::DecayArray<T4>::type, |
676 | | typename internal::DecayArray<T5>::type, |
677 | | typename internal::DecayArray<T6>::type, |
678 | | typename internal::DecayArray<T7>::type> > |
679 | | ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
680 | | const T5& e5, const T6& e6, const T7& e7) { |
681 | | typedef ::testing::tuple< |
682 | | typename internal::DecayArray<T1>::type, |
683 | | typename internal::DecayArray<T2>::type, |
684 | | typename internal::DecayArray<T3>::type, |
685 | | typename internal::DecayArray<T4>::type, |
686 | | typename internal::DecayArray<T5>::type, |
687 | | typename internal::DecayArray<T6>::type, |
688 | | typename internal::DecayArray<T7>::type> Args; |
689 | | return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7)); |
690 | | } |
691 | | |
692 | | template <typename T1, typename T2, typename T3, typename T4, typename T5, |
693 | | typename T6, typename T7, typename T8> |
694 | | inline internal::ElementsAreMatcher< |
695 | | ::testing::tuple< |
696 | | typename internal::DecayArray<T1>::type, |
697 | | typename internal::DecayArray<T2>::type, |
698 | | typename internal::DecayArray<T3>::type, |
699 | | typename internal::DecayArray<T4>::type, |
700 | | typename internal::DecayArray<T5>::type, |
701 | | typename internal::DecayArray<T6>::type, |
702 | | typename internal::DecayArray<T7>::type, |
703 | | typename internal::DecayArray<T8>::type> > |
704 | | ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
705 | | const T5& e5, const T6& e6, const T7& e7, const T8& e8) { |
706 | | typedef ::testing::tuple< |
707 | | typename internal::DecayArray<T1>::type, |
708 | | typename internal::DecayArray<T2>::type, |
709 | | typename internal::DecayArray<T3>::type, |
710 | | typename internal::DecayArray<T4>::type, |
711 | | typename internal::DecayArray<T5>::type, |
712 | | typename internal::DecayArray<T6>::type, |
713 | | typename internal::DecayArray<T7>::type, |
714 | | typename internal::DecayArray<T8>::type> Args; |
715 | | return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7, |
716 | | e8)); |
717 | | } |
718 | | |
719 | | template <typename T1, typename T2, typename T3, typename T4, typename T5, |
720 | | typename T6, typename T7, typename T8, typename T9> |
721 | | inline internal::ElementsAreMatcher< |
722 | | ::testing::tuple< |
723 | | typename internal::DecayArray<T1>::type, |
724 | | typename internal::DecayArray<T2>::type, |
725 | | typename internal::DecayArray<T3>::type, |
726 | | typename internal::DecayArray<T4>::type, |
727 | | typename internal::DecayArray<T5>::type, |
728 | | typename internal::DecayArray<T6>::type, |
729 | | typename internal::DecayArray<T7>::type, |
730 | | typename internal::DecayArray<T8>::type, |
731 | | typename internal::DecayArray<T9>::type> > |
732 | | ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
733 | | const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9) { |
734 | | typedef ::testing::tuple< |
735 | | typename internal::DecayArray<T1>::type, |
736 | | typename internal::DecayArray<T2>::type, |
737 | | typename internal::DecayArray<T3>::type, |
738 | | typename internal::DecayArray<T4>::type, |
739 | | typename internal::DecayArray<T5>::type, |
740 | | typename internal::DecayArray<T6>::type, |
741 | | typename internal::DecayArray<T7>::type, |
742 | | typename internal::DecayArray<T8>::type, |
743 | | typename internal::DecayArray<T9>::type> Args; |
744 | | return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7, |
745 | | e8, e9)); |
746 | | } |
747 | | |
748 | | template <typename T1, typename T2, typename T3, typename T4, typename T5, |
749 | | typename T6, typename T7, typename T8, typename T9, typename T10> |
750 | | inline internal::ElementsAreMatcher< |
751 | | ::testing::tuple< |
752 | | typename internal::DecayArray<T1>::type, |
753 | | typename internal::DecayArray<T2>::type, |
754 | | typename internal::DecayArray<T3>::type, |
755 | | typename internal::DecayArray<T4>::type, |
756 | | typename internal::DecayArray<T5>::type, |
757 | | typename internal::DecayArray<T6>::type, |
758 | | typename internal::DecayArray<T7>::type, |
759 | | typename internal::DecayArray<T8>::type, |
760 | | typename internal::DecayArray<T9>::type, |
761 | | typename internal::DecayArray<T10>::type> > |
762 | | ElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
763 | | const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9, |
764 | | const T10& e10) { |
765 | | typedef ::testing::tuple< |
766 | | typename internal::DecayArray<T1>::type, |
767 | | typename internal::DecayArray<T2>::type, |
768 | | typename internal::DecayArray<T3>::type, |
769 | | typename internal::DecayArray<T4>::type, |
770 | | typename internal::DecayArray<T5>::type, |
771 | | typename internal::DecayArray<T6>::type, |
772 | | typename internal::DecayArray<T7>::type, |
773 | | typename internal::DecayArray<T8>::type, |
774 | | typename internal::DecayArray<T9>::type, |
775 | | typename internal::DecayArray<T10>::type> Args; |
776 | | return internal::ElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, e6, e7, |
777 | | e8, e9, e10)); |
778 | | } |
779 | | |
780 | | // UnorderedElementsAre(e_1, e_2, ..., e_n) is an ElementsAre extension |
781 | | // that matches n elements in any order. We support up to n=10 arguments. |
782 | | |
783 | | inline internal::UnorderedElementsAreMatcher< |
784 | | ::testing::tuple<> > |
785 | 0 | UnorderedElementsAre() { |
786 | 0 | typedef ::testing::tuple<> Args; |
787 | 0 | return internal::UnorderedElementsAreMatcher<Args>(Args()); |
788 | 0 | } |
789 | | |
790 | | template <typename T1> |
791 | | inline internal::UnorderedElementsAreMatcher< |
792 | | ::testing::tuple< |
793 | | typename internal::DecayArray<T1>::type> > |
794 | | UnorderedElementsAre(const T1& e1) { |
795 | | typedef ::testing::tuple< |
796 | | typename internal::DecayArray<T1>::type> Args; |
797 | | return internal::UnorderedElementsAreMatcher<Args>(Args(e1)); |
798 | | } |
799 | | |
800 | | template <typename T1, typename T2> |
801 | | inline internal::UnorderedElementsAreMatcher< |
802 | | ::testing::tuple< |
803 | | typename internal::DecayArray<T1>::type, |
804 | | typename internal::DecayArray<T2>::type> > |
805 | | UnorderedElementsAre(const T1& e1, const T2& e2) { |
806 | | typedef ::testing::tuple< |
807 | | typename internal::DecayArray<T1>::type, |
808 | | typename internal::DecayArray<T2>::type> Args; |
809 | | return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2)); |
810 | | } |
811 | | |
812 | | template <typename T1, typename T2, typename T3> |
813 | | inline internal::UnorderedElementsAreMatcher< |
814 | | ::testing::tuple< |
815 | | typename internal::DecayArray<T1>::type, |
816 | | typename internal::DecayArray<T2>::type, |
817 | | typename internal::DecayArray<T3>::type> > |
818 | | UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3) { |
819 | | typedef ::testing::tuple< |
820 | | typename internal::DecayArray<T1>::type, |
821 | | typename internal::DecayArray<T2>::type, |
822 | | typename internal::DecayArray<T3>::type> Args; |
823 | | return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3)); |
824 | | } |
825 | | |
826 | | template <typename T1, typename T2, typename T3, typename T4> |
827 | | inline internal::UnorderedElementsAreMatcher< |
828 | | ::testing::tuple< |
829 | | typename internal::DecayArray<T1>::type, |
830 | | typename internal::DecayArray<T2>::type, |
831 | | typename internal::DecayArray<T3>::type, |
832 | | typename internal::DecayArray<T4>::type> > |
833 | | UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4) { |
834 | | typedef ::testing::tuple< |
835 | | typename internal::DecayArray<T1>::type, |
836 | | typename internal::DecayArray<T2>::type, |
837 | | typename internal::DecayArray<T3>::type, |
838 | | typename internal::DecayArray<T4>::type> Args; |
839 | | return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4)); |
840 | | } |
841 | | |
842 | | template <typename T1, typename T2, typename T3, typename T4, typename T5> |
843 | | inline internal::UnorderedElementsAreMatcher< |
844 | | ::testing::tuple< |
845 | | typename internal::DecayArray<T1>::type, |
846 | | typename internal::DecayArray<T2>::type, |
847 | | typename internal::DecayArray<T3>::type, |
848 | | typename internal::DecayArray<T4>::type, |
849 | | typename internal::DecayArray<T5>::type> > |
850 | | UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
851 | | const T5& e5) { |
852 | | typedef ::testing::tuple< |
853 | | typename internal::DecayArray<T1>::type, |
854 | | typename internal::DecayArray<T2>::type, |
855 | | typename internal::DecayArray<T3>::type, |
856 | | typename internal::DecayArray<T4>::type, |
857 | | typename internal::DecayArray<T5>::type> Args; |
858 | | return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5)); |
859 | | } |
860 | | |
861 | | template <typename T1, typename T2, typename T3, typename T4, typename T5, |
862 | | typename T6> |
863 | | inline internal::UnorderedElementsAreMatcher< |
864 | | ::testing::tuple< |
865 | | typename internal::DecayArray<T1>::type, |
866 | | typename internal::DecayArray<T2>::type, |
867 | | typename internal::DecayArray<T3>::type, |
868 | | typename internal::DecayArray<T4>::type, |
869 | | typename internal::DecayArray<T5>::type, |
870 | | typename internal::DecayArray<T6>::type> > |
871 | | UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
872 | | const T5& e5, const T6& e6) { |
873 | | typedef ::testing::tuple< |
874 | | typename internal::DecayArray<T1>::type, |
875 | | typename internal::DecayArray<T2>::type, |
876 | | typename internal::DecayArray<T3>::type, |
877 | | typename internal::DecayArray<T4>::type, |
878 | | typename internal::DecayArray<T5>::type, |
879 | | typename internal::DecayArray<T6>::type> Args; |
880 | | return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, |
881 | | e6)); |
882 | | } |
883 | | |
884 | | template <typename T1, typename T2, typename T3, typename T4, typename T5, |
885 | | typename T6, typename T7> |
886 | | inline internal::UnorderedElementsAreMatcher< |
887 | | ::testing::tuple< |
888 | | typename internal::DecayArray<T1>::type, |
889 | | typename internal::DecayArray<T2>::type, |
890 | | typename internal::DecayArray<T3>::type, |
891 | | typename internal::DecayArray<T4>::type, |
892 | | typename internal::DecayArray<T5>::type, |
893 | | typename internal::DecayArray<T6>::type, |
894 | | typename internal::DecayArray<T7>::type> > |
895 | | UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
896 | | const T5& e5, const T6& e6, const T7& e7) { |
897 | | typedef ::testing::tuple< |
898 | | typename internal::DecayArray<T1>::type, |
899 | | typename internal::DecayArray<T2>::type, |
900 | | typename internal::DecayArray<T3>::type, |
901 | | typename internal::DecayArray<T4>::type, |
902 | | typename internal::DecayArray<T5>::type, |
903 | | typename internal::DecayArray<T6>::type, |
904 | | typename internal::DecayArray<T7>::type> Args; |
905 | | return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, |
906 | | e6, e7)); |
907 | | } |
908 | | |
909 | | template <typename T1, typename T2, typename T3, typename T4, typename T5, |
910 | | typename T6, typename T7, typename T8> |
911 | | inline internal::UnorderedElementsAreMatcher< |
912 | | ::testing::tuple< |
913 | | typename internal::DecayArray<T1>::type, |
914 | | typename internal::DecayArray<T2>::type, |
915 | | typename internal::DecayArray<T3>::type, |
916 | | typename internal::DecayArray<T4>::type, |
917 | | typename internal::DecayArray<T5>::type, |
918 | | typename internal::DecayArray<T6>::type, |
919 | | typename internal::DecayArray<T7>::type, |
920 | | typename internal::DecayArray<T8>::type> > |
921 | | UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
922 | | const T5& e5, const T6& e6, const T7& e7, const T8& e8) { |
923 | | typedef ::testing::tuple< |
924 | | typename internal::DecayArray<T1>::type, |
925 | | typename internal::DecayArray<T2>::type, |
926 | | typename internal::DecayArray<T3>::type, |
927 | | typename internal::DecayArray<T4>::type, |
928 | | typename internal::DecayArray<T5>::type, |
929 | | typename internal::DecayArray<T6>::type, |
930 | | typename internal::DecayArray<T7>::type, |
931 | | typename internal::DecayArray<T8>::type> Args; |
932 | | return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, |
933 | | e6, e7, e8)); |
934 | | } |
935 | | |
936 | | template <typename T1, typename T2, typename T3, typename T4, typename T5, |
937 | | typename T6, typename T7, typename T8, typename T9> |
938 | | inline internal::UnorderedElementsAreMatcher< |
939 | | ::testing::tuple< |
940 | | typename internal::DecayArray<T1>::type, |
941 | | typename internal::DecayArray<T2>::type, |
942 | | typename internal::DecayArray<T3>::type, |
943 | | typename internal::DecayArray<T4>::type, |
944 | | typename internal::DecayArray<T5>::type, |
945 | | typename internal::DecayArray<T6>::type, |
946 | | typename internal::DecayArray<T7>::type, |
947 | | typename internal::DecayArray<T8>::type, |
948 | | typename internal::DecayArray<T9>::type> > |
949 | | UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
950 | | const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9) { |
951 | | typedef ::testing::tuple< |
952 | | typename internal::DecayArray<T1>::type, |
953 | | typename internal::DecayArray<T2>::type, |
954 | | typename internal::DecayArray<T3>::type, |
955 | | typename internal::DecayArray<T4>::type, |
956 | | typename internal::DecayArray<T5>::type, |
957 | | typename internal::DecayArray<T6>::type, |
958 | | typename internal::DecayArray<T7>::type, |
959 | | typename internal::DecayArray<T8>::type, |
960 | | typename internal::DecayArray<T9>::type> Args; |
961 | | return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, |
962 | | e6, e7, e8, e9)); |
963 | | } |
964 | | |
965 | | template <typename T1, typename T2, typename T3, typename T4, typename T5, |
966 | | typename T6, typename T7, typename T8, typename T9, typename T10> |
967 | | inline internal::UnorderedElementsAreMatcher< |
968 | | ::testing::tuple< |
969 | | typename internal::DecayArray<T1>::type, |
970 | | typename internal::DecayArray<T2>::type, |
971 | | typename internal::DecayArray<T3>::type, |
972 | | typename internal::DecayArray<T4>::type, |
973 | | typename internal::DecayArray<T5>::type, |
974 | | typename internal::DecayArray<T6>::type, |
975 | | typename internal::DecayArray<T7>::type, |
976 | | typename internal::DecayArray<T8>::type, |
977 | | typename internal::DecayArray<T9>::type, |
978 | | typename internal::DecayArray<T10>::type> > |
979 | | UnorderedElementsAre(const T1& e1, const T2& e2, const T3& e3, const T4& e4, |
980 | | const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9, |
981 | | const T10& e10) { |
982 | | typedef ::testing::tuple< |
983 | | typename internal::DecayArray<T1>::type, |
984 | | typename internal::DecayArray<T2>::type, |
985 | | typename internal::DecayArray<T3>::type, |
986 | | typename internal::DecayArray<T4>::type, |
987 | | typename internal::DecayArray<T5>::type, |
988 | | typename internal::DecayArray<T6>::type, |
989 | | typename internal::DecayArray<T7>::type, |
990 | | typename internal::DecayArray<T8>::type, |
991 | | typename internal::DecayArray<T9>::type, |
992 | | typename internal::DecayArray<T10>::type> Args; |
993 | | return internal::UnorderedElementsAreMatcher<Args>(Args(e1, e2, e3, e4, e5, |
994 | | e6, e7, e8, e9, e10)); |
995 | | } |
996 | | |
997 | | // AllOf(m1, m2, ..., mk) matches any value that matches all of the given |
998 | | // sub-matchers. AllOf is called fully qualified to prevent ADL from firing. |
999 | | |
1000 | | template <typename M1, typename M2> |
1001 | | inline typename internal::AllOfResult2<M1, M2>::type |
1002 | 0 | AllOf(M1 m1, M2 m2) { |
1003 | 0 | return typename internal::AllOfResult2<M1, M2>::type( |
1004 | 0 | m1, |
1005 | 0 | m2); |
1006 | 0 | } Unexecuted instantiation: testing::internal::AllOfResult2<testing::EdgesLengthMatcherP2<JSContext*, int>, testing::EdgeMatcherP3<JSContext*, int, testing::PolymorphicMatcher<testing::internal::FieldMatcher<JS::ubi::Edge, mozilla::UniquePtr<char16_t [], JS::FreePolicy> > > > >::type testing::AllOf<testing::EdgesLengthMatcherP2<JSContext*, int>, testing::EdgeMatcherP3<JSContext*, int, testing::PolymorphicMatcher<testing::internal::FieldMatcher<JS::ubi::Edge, mozilla::UniquePtr<char16_t [], JS::FreePolicy> > > > >(testing::EdgesLengthMatcherP2<JSContext*, int>, testing::EdgeMatcherP3<JSContext*, int, testing::PolymorphicMatcher<testing::internal::FieldMatcher<JS::ubi::Edge, mozilla::UniquePtr<char16_t [], JS::FreePolicy> > > >) Unexecuted instantiation: testing::internal::AllOfResult2<testing::EdgeMatcherP3<JSContext*, int, testing::PolymorphicMatcher<testing::internal::FieldMatcher<JS::ubi::Edge, mozilla::UniquePtr<char16_t [], JS::FreePolicy> > > >, testing::EdgeMatcherP3<JSContext*, int, testing::PolymorphicMatcher<testing::internal::FieldMatcher<JS::ubi::Edge, mozilla::UniquePtr<char16_t [], JS::FreePolicy> > > > >::type testing::AllOf<testing::EdgeMatcherP3<JSContext*, int, testing::PolymorphicMatcher<testing::internal::FieldMatcher<JS::ubi::Edge, mozilla::UniquePtr<char16_t [], JS::FreePolicy> > > >, testing::EdgeMatcherP3<JSContext*, int, testing::PolymorphicMatcher<testing::internal::FieldMatcher<JS::ubi::Edge, mozilla::UniquePtr<char16_t [], JS::FreePolicy> > > > >(testing::EdgeMatcherP3<JSContext*, int, testing::PolymorphicMatcher<testing::internal::FieldMatcher<JS::ubi::Edge, mozilla::UniquePtr<char16_t [], JS::FreePolicy> > > >, testing::EdgeMatcherP3<JSContext*, int, testing::PolymorphicMatcher<testing::internal::FieldMatcher<JS::ubi::Edge, mozilla::UniquePtr<char16_t [], JS::FreePolicy> > > >) |
1007 | | |
1008 | | template <typename M1, typename M2, typename M3> |
1009 | | inline typename internal::AllOfResult3<M1, M2, M3>::type |
1010 | | AllOf(M1 m1, M2 m2, M3 m3) { |
1011 | | return typename internal::AllOfResult3<M1, M2, M3>::type( |
1012 | | m1, |
1013 | | ::testing::AllOf(m2, m3)); |
1014 | | } |
1015 | | |
1016 | | template <typename M1, typename M2, typename M3, typename M4> |
1017 | | inline typename internal::AllOfResult4<M1, M2, M3, M4>::type |
1018 | 0 | AllOf(M1 m1, M2 m2, M3 m3, M4 m4) { |
1019 | 0 | return typename internal::AllOfResult4<M1, M2, M3, M4>::type( |
1020 | 0 | ::testing::AllOf(m1, m2), |
1021 | 0 | ::testing::AllOf(m3, m4)); |
1022 | 0 | } |
1023 | | |
1024 | | template <typename M1, typename M2, typename M3, typename M4, typename M5> |
1025 | | inline typename internal::AllOfResult5<M1, M2, M3, M4, M5>::type |
1026 | | AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5) { |
1027 | | return typename internal::AllOfResult5<M1, M2, M3, M4, M5>::type( |
1028 | | ::testing::AllOf(m1, m2), |
1029 | | ::testing::AllOf(m3, m4, m5)); |
1030 | | } |
1031 | | |
1032 | | template <typename M1, typename M2, typename M3, typename M4, typename M5, |
1033 | | typename M6> |
1034 | | inline typename internal::AllOfResult6<M1, M2, M3, M4, M5, M6>::type |
1035 | | AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6) { |
1036 | | return typename internal::AllOfResult6<M1, M2, M3, M4, M5, M6>::type( |
1037 | | ::testing::AllOf(m1, m2, m3), |
1038 | | ::testing::AllOf(m4, m5, m6)); |
1039 | | } |
1040 | | |
1041 | | template <typename M1, typename M2, typename M3, typename M4, typename M5, |
1042 | | typename M6, typename M7> |
1043 | | inline typename internal::AllOfResult7<M1, M2, M3, M4, M5, M6, M7>::type |
1044 | | AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7) { |
1045 | | return typename internal::AllOfResult7<M1, M2, M3, M4, M5, M6, M7>::type( |
1046 | | ::testing::AllOf(m1, m2, m3), |
1047 | | ::testing::AllOf(m4, m5, m6, m7)); |
1048 | | } |
1049 | | |
1050 | | template <typename M1, typename M2, typename M3, typename M4, typename M5, |
1051 | | typename M6, typename M7, typename M8> |
1052 | | inline typename internal::AllOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::type |
1053 | | AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8) { |
1054 | | return typename internal::AllOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::type( |
1055 | | ::testing::AllOf(m1, m2, m3, m4), |
1056 | | ::testing::AllOf(m5, m6, m7, m8)); |
1057 | | } |
1058 | | |
1059 | | template <typename M1, typename M2, typename M3, typename M4, typename M5, |
1060 | | typename M6, typename M7, typename M8, typename M9> |
1061 | | inline typename internal::AllOfResult9<M1, M2, M3, M4, M5, M6, M7, M8, M9>::type |
1062 | | AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9) { |
1063 | | return typename internal::AllOfResult9<M1, M2, M3, M4, M5, M6, M7, M8, |
1064 | | M9>::type( |
1065 | | ::testing::AllOf(m1, m2, m3, m4), |
1066 | | ::testing::AllOf(m5, m6, m7, m8, m9)); |
1067 | | } |
1068 | | |
1069 | | template <typename M1, typename M2, typename M3, typename M4, typename M5, |
1070 | | typename M6, typename M7, typename M8, typename M9, typename M10> |
1071 | | inline typename internal::AllOfResult10<M1, M2, M3, M4, M5, M6, M7, M8, M9, |
1072 | | M10>::type |
1073 | | AllOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { |
1074 | | return typename internal::AllOfResult10<M1, M2, M3, M4, M5, M6, M7, M8, M9, |
1075 | | M10>::type( |
1076 | | ::testing::AllOf(m1, m2, m3, m4, m5), |
1077 | | ::testing::AllOf(m6, m7, m8, m9, m10)); |
1078 | | } |
1079 | | |
1080 | | // AnyOf(m1, m2, ..., mk) matches any value that matches any of the given |
1081 | | // sub-matchers. AnyOf is called fully qualified to prevent ADL from firing. |
1082 | | |
1083 | | template <typename M1, typename M2> |
1084 | | inline typename internal::AnyOfResult2<M1, M2>::type |
1085 | | AnyOf(M1 m1, M2 m2) { |
1086 | | return typename internal::AnyOfResult2<M1, M2>::type( |
1087 | | m1, |
1088 | | m2); |
1089 | | } |
1090 | | |
1091 | | template <typename M1, typename M2, typename M3> |
1092 | | inline typename internal::AnyOfResult3<M1, M2, M3>::type |
1093 | | AnyOf(M1 m1, M2 m2, M3 m3) { |
1094 | | return typename internal::AnyOfResult3<M1, M2, M3>::type( |
1095 | | m1, |
1096 | | ::testing::AnyOf(m2, m3)); |
1097 | | } |
1098 | | |
1099 | | template <typename M1, typename M2, typename M3, typename M4> |
1100 | | inline typename internal::AnyOfResult4<M1, M2, M3, M4>::type |
1101 | | AnyOf(M1 m1, M2 m2, M3 m3, M4 m4) { |
1102 | | return typename internal::AnyOfResult4<M1, M2, M3, M4>::type( |
1103 | | ::testing::AnyOf(m1, m2), |
1104 | | ::testing::AnyOf(m3, m4)); |
1105 | | } |
1106 | | |
1107 | | template <typename M1, typename M2, typename M3, typename M4, typename M5> |
1108 | | inline typename internal::AnyOfResult5<M1, M2, M3, M4, M5>::type |
1109 | | AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5) { |
1110 | | return typename internal::AnyOfResult5<M1, M2, M3, M4, M5>::type( |
1111 | | ::testing::AnyOf(m1, m2), |
1112 | | ::testing::AnyOf(m3, m4, m5)); |
1113 | | } |
1114 | | |
1115 | | template <typename M1, typename M2, typename M3, typename M4, typename M5, |
1116 | | typename M6> |
1117 | | inline typename internal::AnyOfResult6<M1, M2, M3, M4, M5, M6>::type |
1118 | | AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6) { |
1119 | | return typename internal::AnyOfResult6<M1, M2, M3, M4, M5, M6>::type( |
1120 | | ::testing::AnyOf(m1, m2, m3), |
1121 | | ::testing::AnyOf(m4, m5, m6)); |
1122 | | } |
1123 | | |
1124 | | template <typename M1, typename M2, typename M3, typename M4, typename M5, |
1125 | | typename M6, typename M7> |
1126 | | inline typename internal::AnyOfResult7<M1, M2, M3, M4, M5, M6, M7>::type |
1127 | | AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7) { |
1128 | | return typename internal::AnyOfResult7<M1, M2, M3, M4, M5, M6, M7>::type( |
1129 | | ::testing::AnyOf(m1, m2, m3), |
1130 | | ::testing::AnyOf(m4, m5, m6, m7)); |
1131 | | } |
1132 | | |
1133 | | template <typename M1, typename M2, typename M3, typename M4, typename M5, |
1134 | | typename M6, typename M7, typename M8> |
1135 | | inline typename internal::AnyOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::type |
1136 | | AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8) { |
1137 | | return typename internal::AnyOfResult8<M1, M2, M3, M4, M5, M6, M7, M8>::type( |
1138 | | ::testing::AnyOf(m1, m2, m3, m4), |
1139 | | ::testing::AnyOf(m5, m6, m7, m8)); |
1140 | | } |
1141 | | |
1142 | | template <typename M1, typename M2, typename M3, typename M4, typename M5, |
1143 | | typename M6, typename M7, typename M8, typename M9> |
1144 | | inline typename internal::AnyOfResult9<M1, M2, M3, M4, M5, M6, M7, M8, M9>::type |
1145 | | AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9) { |
1146 | | return typename internal::AnyOfResult9<M1, M2, M3, M4, M5, M6, M7, M8, |
1147 | | M9>::type( |
1148 | | ::testing::AnyOf(m1, m2, m3, m4), |
1149 | | ::testing::AnyOf(m5, m6, m7, m8, m9)); |
1150 | | } |
1151 | | |
1152 | | template <typename M1, typename M2, typename M3, typename M4, typename M5, |
1153 | | typename M6, typename M7, typename M8, typename M9, typename M10> |
1154 | | inline typename internal::AnyOfResult10<M1, M2, M3, M4, M5, M6, M7, M8, M9, |
1155 | | M10>::type |
1156 | | AnyOf(M1 m1, M2 m2, M3 m3, M4 m4, M5 m5, M6 m6, M7 m7, M8 m8, M9 m9, M10 m10) { |
1157 | | return typename internal::AnyOfResult10<M1, M2, M3, M4, M5, M6, M7, M8, M9, |
1158 | | M10>::type( |
1159 | | ::testing::AnyOf(m1, m2, m3, m4, m5), |
1160 | | ::testing::AnyOf(m6, m7, m8, m9, m10)); |
1161 | | } |
1162 | | |
1163 | | } // namespace testing |
1164 | | |
1165 | | |
1166 | | // The MATCHER* family of macros can be used in a namespace scope to |
1167 | | // define custom matchers easily. |
1168 | | // |
1169 | | // Basic Usage |
1170 | | // =========== |
1171 | | // |
1172 | | // The syntax |
1173 | | // |
1174 | | // MATCHER(name, description_string) { statements; } |
1175 | | // |
1176 | | // defines a matcher with the given name that executes the statements, |
1177 | | // which must return a bool to indicate if the match succeeds. Inside |
1178 | | // the statements, you can refer to the value being matched by 'arg', |
1179 | | // and refer to its type by 'arg_type'. |
1180 | | // |
1181 | | // The description string documents what the matcher does, and is used |
1182 | | // to generate the failure message when the match fails. Since a |
1183 | | // MATCHER() is usually defined in a header file shared by multiple |
1184 | | // C++ source files, we require the description to be a C-string |
1185 | | // literal to avoid possible side effects. It can be empty, in which |
1186 | | // case we'll use the sequence of words in the matcher name as the |
1187 | | // description. |
1188 | | // |
1189 | | // For example: |
1190 | | // |
1191 | | // MATCHER(IsEven, "") { return (arg % 2) == 0; } |
1192 | | // |
1193 | | // allows you to write |
1194 | | // |
1195 | | // // Expects mock_foo.Bar(n) to be called where n is even. |
1196 | | // EXPECT_CALL(mock_foo, Bar(IsEven())); |
1197 | | // |
1198 | | // or, |
1199 | | // |
1200 | | // // Verifies that the value of some_expression is even. |
1201 | | // EXPECT_THAT(some_expression, IsEven()); |
1202 | | // |
1203 | | // If the above assertion fails, it will print something like: |
1204 | | // |
1205 | | // Value of: some_expression |
1206 | | // Expected: is even |
1207 | | // Actual: 7 |
1208 | | // |
1209 | | // where the description "is even" is automatically calculated from the |
1210 | | // matcher name IsEven. |
1211 | | // |
1212 | | // Argument Type |
1213 | | // ============= |
1214 | | // |
1215 | | // Note that the type of the value being matched (arg_type) is |
1216 | | // determined by the context in which you use the matcher and is |
1217 | | // supplied to you by the compiler, so you don't need to worry about |
1218 | | // declaring it (nor can you). This allows the matcher to be |
1219 | | // polymorphic. For example, IsEven() can be used to match any type |
1220 | | // where the value of "(arg % 2) == 0" can be implicitly converted to |
1221 | | // a bool. In the "Bar(IsEven())" example above, if method Bar() |
1222 | | // takes an int, 'arg_type' will be int; if it takes an unsigned long, |
1223 | | // 'arg_type' will be unsigned long; and so on. |
1224 | | // |
1225 | | // Parameterizing Matchers |
1226 | | // ======================= |
1227 | | // |
1228 | | // Sometimes you'll want to parameterize the matcher. For that you |
1229 | | // can use another macro: |
1230 | | // |
1231 | | // MATCHER_P(name, param_name, description_string) { statements; } |
1232 | | // |
1233 | | // For example: |
1234 | | // |
1235 | | // MATCHER_P(HasAbsoluteValue, value, "") { return abs(arg) == value; } |
1236 | | // |
1237 | | // will allow you to write: |
1238 | | // |
1239 | | // EXPECT_THAT(Blah("a"), HasAbsoluteValue(n)); |
1240 | | // |
1241 | | // which may lead to this message (assuming n is 10): |
1242 | | // |
1243 | | // Value of: Blah("a") |
1244 | | // Expected: has absolute value 10 |
1245 | | // Actual: -9 |
1246 | | // |
1247 | | // Note that both the matcher description and its parameter are |
1248 | | // printed, making the message human-friendly. |
1249 | | // |
1250 | | // In the matcher definition body, you can write 'foo_type' to |
1251 | | // reference the type of a parameter named 'foo'. For example, in the |
1252 | | // body of MATCHER_P(HasAbsoluteValue, value) above, you can write |
1253 | | // 'value_type' to refer to the type of 'value'. |
1254 | | // |
1255 | | // We also provide MATCHER_P2, MATCHER_P3, ..., up to MATCHER_P10 to |
1256 | | // support multi-parameter matchers. |
1257 | | // |
1258 | | // Describing Parameterized Matchers |
1259 | | // ================================= |
1260 | | // |
1261 | | // The last argument to MATCHER*() is a string-typed expression. The |
1262 | | // expression can reference all of the matcher's parameters and a |
1263 | | // special bool-typed variable named 'negation'. When 'negation' is |
1264 | | // false, the expression should evaluate to the matcher's description; |
1265 | | // otherwise it should evaluate to the description of the negation of |
1266 | | // the matcher. For example, |
1267 | | // |
1268 | | // using testing::PrintToString; |
1269 | | // |
1270 | | // MATCHER_P2(InClosedRange, low, hi, |
1271 | | // string(negation ? "is not" : "is") + " in range [" + |
1272 | | // PrintToString(low) + ", " + PrintToString(hi) + "]") { |
1273 | | // return low <= arg && arg <= hi; |
1274 | | // } |
1275 | | // ... |
1276 | | // EXPECT_THAT(3, InClosedRange(4, 6)); |
1277 | | // EXPECT_THAT(3, Not(InClosedRange(2, 4))); |
1278 | | // |
1279 | | // would generate two failures that contain the text: |
1280 | | // |
1281 | | // Expected: is in range [4, 6] |
1282 | | // ... |
1283 | | // Expected: is not in range [2, 4] |
1284 | | // |
1285 | | // If you specify "" as the description, the failure message will |
1286 | | // contain the sequence of words in the matcher name followed by the |
1287 | | // parameter values printed as a tuple. For example, |
1288 | | // |
1289 | | // MATCHER_P2(InClosedRange, low, hi, "") { ... } |
1290 | | // ... |
1291 | | // EXPECT_THAT(3, InClosedRange(4, 6)); |
1292 | | // EXPECT_THAT(3, Not(InClosedRange(2, 4))); |
1293 | | // |
1294 | | // would generate two failures that contain the text: |
1295 | | // |
1296 | | // Expected: in closed range (4, 6) |
1297 | | // ... |
1298 | | // Expected: not (in closed range (2, 4)) |
1299 | | // |
1300 | | // Types of Matcher Parameters |
1301 | | // =========================== |
1302 | | // |
1303 | | // For the purpose of typing, you can view |
1304 | | // |
1305 | | // MATCHER_Pk(Foo, p1, ..., pk, description_string) { ... } |
1306 | | // |
1307 | | // as shorthand for |
1308 | | // |
1309 | | // template <typename p1_type, ..., typename pk_type> |
1310 | | // FooMatcherPk<p1_type, ..., pk_type> |
1311 | | // Foo(p1_type p1, ..., pk_type pk) { ... } |
1312 | | // |
1313 | | // When you write Foo(v1, ..., vk), the compiler infers the types of |
1314 | | // the parameters v1, ..., and vk for you. If you are not happy with |
1315 | | // the result of the type inference, you can specify the types by |
1316 | | // explicitly instantiating the template, as in Foo<long, bool>(5, |
1317 | | // false). As said earlier, you don't get to (or need to) specify |
1318 | | // 'arg_type' as that's determined by the context in which the matcher |
1319 | | // is used. You can assign the result of expression Foo(p1, ..., pk) |
1320 | | // to a variable of type FooMatcherPk<p1_type, ..., pk_type>. This |
1321 | | // can be useful when composing matchers. |
1322 | | // |
1323 | | // While you can instantiate a matcher template with reference types, |
1324 | | // passing the parameters by pointer usually makes your code more |
1325 | | // readable. If, however, you still want to pass a parameter by |
1326 | | // reference, be aware that in the failure message generated by the |
1327 | | // matcher you will see the value of the referenced object but not its |
1328 | | // address. |
1329 | | // |
1330 | | // Explaining Match Results |
1331 | | // ======================== |
1332 | | // |
1333 | | // Sometimes the matcher description alone isn't enough to explain why |
1334 | | // the match has failed or succeeded. For example, when expecting a |
1335 | | // long string, it can be very helpful to also print the diff between |
1336 | | // the expected string and the actual one. To achieve that, you can |
1337 | | // optionally stream additional information to a special variable |
1338 | | // named result_listener, whose type is a pointer to class |
1339 | | // MatchResultListener: |
1340 | | // |
1341 | | // MATCHER_P(EqualsLongString, str, "") { |
1342 | | // if (arg == str) return true; |
1343 | | // |
1344 | | // *result_listener << "the difference: " |
1345 | | /// << DiffStrings(str, arg); |
1346 | | // return false; |
1347 | | // } |
1348 | | // |
1349 | | // Overloading Matchers |
1350 | | // ==================== |
1351 | | // |
1352 | | // You can overload matchers with different numbers of parameters: |
1353 | | // |
1354 | | // MATCHER_P(Blah, a, description_string1) { ... } |
1355 | | // MATCHER_P2(Blah, a, b, description_string2) { ... } |
1356 | | // |
1357 | | // Caveats |
1358 | | // ======= |
1359 | | // |
1360 | | // When defining a new matcher, you should also consider implementing |
1361 | | // MatcherInterface or using MakePolymorphicMatcher(). These |
1362 | | // approaches require more work than the MATCHER* macros, but also |
1363 | | // give you more control on the types of the value being matched and |
1364 | | // the matcher parameters, which may leads to better compiler error |
1365 | | // messages when the matcher is used wrong. They also allow |
1366 | | // overloading matchers based on parameter types (as opposed to just |
1367 | | // based on the number of parameters). |
1368 | | // |
1369 | | // MATCHER*() can only be used in a namespace scope. The reason is |
1370 | | // that C++ doesn't yet allow function-local types to be used to |
1371 | | // instantiate templates. The up-coming C++0x standard will fix this. |
1372 | | // Once that's done, we'll consider supporting using MATCHER*() inside |
1373 | | // a function. |
1374 | | // |
1375 | | // More Information |
1376 | | // ================ |
1377 | | // |
1378 | | // To learn more about using these macros, please search for 'MATCHER' |
1379 | | // on http://code.google.com/p/googlemock/wiki/CookBook. |
1380 | | |
1381 | | #define MATCHER(name, description)\ |
1382 | | class name##Matcher {\ |
1383 | | public:\ |
1384 | | template <typename arg_type>\ |
1385 | | class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ |
1386 | | public:\ |
1387 | | gmock_Impl()\ |
1388 | 0 | {}\ |
1389 | | virtual bool MatchAndExplain(\ |
1390 | | arg_type arg, ::testing::MatchResultListener* result_listener) const;\ |
1391 | 0 | virtual void DescribeTo(::std::ostream* gmock_os) const {\ |
1392 | 0 | *gmock_os << FormatDescription(false);\ |
1393 | 0 | }\ |
1394 | 0 | virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ |
1395 | 0 | *gmock_os << FormatDescription(true);\ |
1396 | 0 | }\ |
1397 | | private:\ |
1398 | 0 | ::testing::internal::string FormatDescription(bool negation) const {\ |
1399 | 0 | const ::testing::internal::string gmock_description = (description);\ |
1400 | 0 | if (!gmock_description.empty())\ |
1401 | 0 | return gmock_description;\ |
1402 | 0 | return ::testing::internal::FormatMatcherDescription(\ |
1403 | 0 | negation, #name, \ |
1404 | 0 | ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ |
1405 | 0 | ::testing::tuple<>()));\ |
1406 | 0 | }\ |
1407 | | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
1408 | | };\ |
1409 | | template <typename arg_type>\ |
1410 | 0 | operator ::testing::Matcher<arg_type>() const {\ |
1411 | 0 | return ::testing::Matcher<arg_type>(\ |
1412 | 0 | new gmock_Impl<arg_type>());\ |
1413 | 0 | }\ |
1414 | 0 | name##Matcher() {\ |
1415 | 0 | }\ Unexecuted instantiation: testing::IsEmptyMatcher::IsEmptyMatcher() Unexecuted instantiation: testing::UniqueIsNullMatcher::UniqueIsNullMatcher() |
1416 | | private:\ |
1417 | | GTEST_DISALLOW_ASSIGN_(name##Matcher);\ |
1418 | | };\ |
1419 | 0 | inline name##Matcher name() {\ |
1420 | 0 | return name##Matcher();\ |
1421 | 0 | }\ Unexecuted instantiation: testing::IsEmpty() Unexecuted instantiation: testing::UniqueIsNull() |
1422 | | template <typename arg_type>\ |
1423 | | bool name##Matcher::gmock_Impl<arg_type>::MatchAndExplain(\ |
1424 | | arg_type arg, \ |
1425 | | ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ |
1426 | | const |
1427 | | |
1428 | | #define MATCHER_P(name, p0, description)\ |
1429 | | template <typename p0##_type>\ |
1430 | | class name##MatcherP {\ |
1431 | | public:\ |
1432 | | template <typename arg_type>\ |
1433 | | class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ |
1434 | | public:\ |
1435 | | explicit gmock_Impl(p0##_type gmock_p0)\ |
1436 | 0 | : p0(gmock_p0) {}\ Unexecuted instantiation: testing::EdgeToMatcherP<unsigned long>::gmock_Impl<mozilla::devtools::DeserializedEdge const&>::gmock_Impl(unsigned long) Unexecuted instantiation: testing::UniqueUTF16StrEqMatcherP<char16_t const*>::gmock_Impl<mozilla::UniquePtr<char16_t [], JS::FreePolicy> const&>::gmock_Impl(char16_t const*) Unexecuted instantiation: testing::UTF16StrEqMatcherP<char16_t const*>::gmock_Impl<char16_t const* const&>::gmock_Impl(char16_t const*) |
1437 | | virtual bool MatchAndExplain(\ |
1438 | | arg_type arg, ::testing::MatchResultListener* result_listener) const;\ |
1439 | 0 | virtual void DescribeTo(::std::ostream* gmock_os) const {\ |
1440 | 0 | *gmock_os << FormatDescription(false);\ |
1441 | 0 | }\ Unexecuted instantiation: testing::EdgeToMatcherP<unsigned long>::gmock_Impl<mozilla::devtools::DeserializedEdge const&>::DescribeTo(std::__1::basic_ostream<char, std::__1::char_traits<char> >*) const Unexecuted instantiation: testing::UniqueUTF16StrEqMatcherP<char16_t const*>::gmock_Impl<mozilla::UniquePtr<char16_t [], JS::FreePolicy> const&>::DescribeTo(std::__1::basic_ostream<char, std::__1::char_traits<char> >*) const Unexecuted instantiation: testing::UTF16StrEqMatcherP<char16_t const*>::gmock_Impl<char16_t const* const&>::DescribeTo(std::__1::basic_ostream<char, std::__1::char_traits<char> >*) const |
1442 | 0 | virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ |
1443 | 0 | *gmock_os << FormatDescription(true);\ |
1444 | 0 | }\ Unexecuted instantiation: testing::EdgeToMatcherP<unsigned long>::gmock_Impl<mozilla::devtools::DeserializedEdge const&>::DescribeNegationTo(std::__1::basic_ostream<char, std::__1::char_traits<char> >*) const Unexecuted instantiation: testing::UniqueUTF16StrEqMatcherP<char16_t const*>::gmock_Impl<mozilla::UniquePtr<char16_t [], JS::FreePolicy> const&>::DescribeNegationTo(std::__1::basic_ostream<char, std::__1::char_traits<char> >*) const Unexecuted instantiation: testing::UTF16StrEqMatcherP<char16_t const*>::gmock_Impl<char16_t const* const&>::DescribeNegationTo(std::__1::basic_ostream<char, std::__1::char_traits<char> >*) const |
1445 | | p0##_type p0;\ |
1446 | | private:\ |
1447 | 0 | ::testing::internal::string FormatDescription(bool negation) const {\ |
1448 | 0 | const ::testing::internal::string gmock_description = (description);\ |
1449 | 0 | if (!gmock_description.empty())\ |
1450 | 0 | return gmock_description;\ |
1451 | 0 | return ::testing::internal::FormatMatcherDescription(\ |
1452 | 0 | negation, #name, \ |
1453 | 0 | ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ |
1454 | 0 | ::testing::tuple<p0##_type>(p0)));\ |
1455 | 0 | }\ Unexecuted instantiation: testing::EdgeToMatcherP<unsigned long>::gmock_Impl<mozilla::devtools::DeserializedEdge const&>::FormatDescription(bool) const Unexecuted instantiation: testing::UniqueUTF16StrEqMatcherP<char16_t const*>::gmock_Impl<mozilla::UniquePtr<char16_t [], JS::FreePolicy> const&>::FormatDescription(bool) const Unexecuted instantiation: testing::UTF16StrEqMatcherP<char16_t const*>::gmock_Impl<char16_t const* const&>::FormatDescription(bool) const |
1456 | | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
1457 | | };\ |
1458 | | template <typename arg_type>\ |
1459 | 0 | operator ::testing::Matcher<arg_type>() const {\ |
1460 | 0 | return ::testing::Matcher<arg_type>(\ |
1461 | 0 | new gmock_Impl<arg_type>(p0));\ |
1462 | 0 | }\ Unexecuted instantiation: _ZNK7testing14EdgeToMatcherPImEcvNS_7MatcherIT_EEIRKN7mozilla8devtools16DeserializedEdgeEEEv Unexecuted instantiation: _ZNK7testing24UniqueUTF16StrEqMatcherPIPKDsEcvNS_7MatcherIT_EEIRKN7mozilla9UniquePtrIA_DsN2JS10FreePolicyEEEEEv Unexecuted instantiation: _ZNK7testing18UTF16StrEqMatcherPIPKDsEcvNS_7MatcherIT_EEIRKS2_EEv |
1463 | 0 | explicit name##MatcherP(p0##_type gmock_p0) : p0(gmock_p0) {\ |
1464 | 0 | }\ Unexecuted instantiation: testing::EdgeToMatcherP<unsigned long>::EdgeToMatcherP(unsigned long) Unexecuted instantiation: testing::UniqueUTF16StrEqMatcherP<char16_t const*>::UniqueUTF16StrEqMatcherP(char16_t const*) Unexecuted instantiation: testing::UTF16StrEqMatcherP<char16_t const*>::UTF16StrEqMatcherP(char16_t const*) |
1465 | | p0##_type p0;\ |
1466 | | private:\ |
1467 | | GTEST_DISALLOW_ASSIGN_(name##MatcherP);\ |
1468 | | };\ |
1469 | | template <typename p0##_type>\ |
1470 | 0 | inline name##MatcherP<p0##_type> name(p0##_type p0) {\ |
1471 | 0 | return name##MatcherP<p0##_type>(p0);\ |
1472 | 0 | }\ Unexecuted instantiation: testing::EdgeToMatcherP<unsigned long> testing::EdgeTo<unsigned long>(unsigned long) Unexecuted instantiation: testing::UniqueUTF16StrEqMatcherP<char16_t const*> testing::UniqueUTF16StrEq<char16_t const*>(char16_t const*) Unexecuted instantiation: testing::UTF16StrEqMatcherP<char16_t const*> testing::UTF16StrEq<char16_t const*>(char16_t const*) |
1473 | | template <typename p0##_type>\ |
1474 | | template <typename arg_type>\ |
1475 | | bool name##MatcherP<p0##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ |
1476 | | arg_type arg, \ |
1477 | | ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ |
1478 | | const |
1479 | | |
1480 | | #define MATCHER_P2(name, p0, p1, description)\ |
1481 | | template <typename p0##_type, typename p1##_type>\ |
1482 | | class name##MatcherP2 {\ |
1483 | | public:\ |
1484 | | template <typename arg_type>\ |
1485 | | class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ |
1486 | | public:\ |
1487 | | gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1)\ |
1488 | 0 | : p0(gmock_p0), p1(gmock_p1) {}\ |
1489 | | virtual bool MatchAndExplain(\ |
1490 | | arg_type arg, ::testing::MatchResultListener* result_listener) const;\ |
1491 | 0 | virtual void DescribeTo(::std::ostream* gmock_os) const {\ |
1492 | 0 | *gmock_os << FormatDescription(false);\ |
1493 | 0 | }\ |
1494 | 0 | virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ |
1495 | 0 | *gmock_os << FormatDescription(true);\ |
1496 | 0 | }\ |
1497 | | p0##_type p0;\ |
1498 | | p1##_type p1;\ |
1499 | | private:\ |
1500 | 0 | ::testing::internal::string FormatDescription(bool negation) const {\ |
1501 | 0 | const ::testing::internal::string gmock_description = (description);\ |
1502 | 0 | if (!gmock_description.empty())\ |
1503 | 0 | return gmock_description;\ |
1504 | 0 | return ::testing::internal::FormatMatcherDescription(\ |
1505 | 0 | negation, #name, \ |
1506 | 0 | ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ |
1507 | 0 | ::testing::tuple<p0##_type, p1##_type>(p0, p1)));\ |
1508 | 0 | }\ |
1509 | | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
1510 | | };\ |
1511 | | template <typename arg_type>\ |
1512 | 0 | operator ::testing::Matcher<arg_type>() const {\ |
1513 | 0 | return ::testing::Matcher<arg_type>(\ |
1514 | 0 | new gmock_Impl<arg_type>(p0, p1));\ |
1515 | 0 | }\ |
1516 | | name##MatcherP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ |
1517 | 0 | p1(gmock_p1) {\ |
1518 | 0 | }\ |
1519 | | p0##_type p0;\ |
1520 | | p1##_type p1;\ |
1521 | | private:\ |
1522 | | GTEST_DISALLOW_ASSIGN_(name##MatcherP2);\ |
1523 | | };\ |
1524 | | template <typename p0##_type, typename p1##_type>\ |
1525 | | inline name##MatcherP2<p0##_type, p1##_type> name(p0##_type p0, \ |
1526 | 0 | p1##_type p1) {\ |
1527 | 0 | return name##MatcherP2<p0##_type, p1##_type>(p0, p1);\ |
1528 | 0 | }\ |
1529 | | template <typename p0##_type, typename p1##_type>\ |
1530 | | template <typename arg_type>\ |
1531 | | bool name##MatcherP2<p0##_type, \ |
1532 | | p1##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ |
1533 | | arg_type arg, \ |
1534 | | ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ |
1535 | | const |
1536 | | |
1537 | | #define MATCHER_P3(name, p0, p1, p2, description)\ |
1538 | | template <typename p0##_type, typename p1##_type, typename p2##_type>\ |
1539 | | class name##MatcherP3 {\ |
1540 | | public:\ |
1541 | | template <typename arg_type>\ |
1542 | | class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ |
1543 | | public:\ |
1544 | | gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2)\ |
1545 | 0 | : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ |
1546 | | virtual bool MatchAndExplain(\ |
1547 | | arg_type arg, ::testing::MatchResultListener* result_listener) const;\ |
1548 | 0 | virtual void DescribeTo(::std::ostream* gmock_os) const {\ |
1549 | 0 | *gmock_os << FormatDescription(false);\ |
1550 | 0 | }\ |
1551 | 0 | virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ |
1552 | 0 | *gmock_os << FormatDescription(true);\ |
1553 | 0 | }\ |
1554 | | p0##_type p0;\ |
1555 | | p1##_type p1;\ |
1556 | | p2##_type p2;\ |
1557 | | private:\ |
1558 | 0 | ::testing::internal::string FormatDescription(bool negation) const {\ |
1559 | 0 | const ::testing::internal::string gmock_description = (description);\ |
1560 | 0 | if (!gmock_description.empty())\ |
1561 | 0 | return gmock_description;\ |
1562 | 0 | return ::testing::internal::FormatMatcherDescription(\ |
1563 | 0 | negation, #name, \ |
1564 | 0 | ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ |
1565 | 0 | ::testing::tuple<p0##_type, p1##_type, p2##_type>(p0, p1, \ |
1566 | 0 | p2)));\ |
1567 | 0 | }\ |
1568 | | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
1569 | | };\ |
1570 | | template <typename arg_type>\ |
1571 | 0 | operator ::testing::Matcher<arg_type>() const {\ |
1572 | 0 | return ::testing::Matcher<arg_type>(\ |
1573 | 0 | new gmock_Impl<arg_type>(p0, p1, p2));\ |
1574 | 0 | }\ |
1575 | | name##MatcherP3(p0##_type gmock_p0, p1##_type gmock_p1, \ |
1576 | 0 | p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {\ |
1577 | 0 | }\ |
1578 | | p0##_type p0;\ |
1579 | | p1##_type p1;\ |
1580 | | p2##_type p2;\ |
1581 | | private:\ |
1582 | | GTEST_DISALLOW_ASSIGN_(name##MatcherP3);\ |
1583 | | };\ |
1584 | | template <typename p0##_type, typename p1##_type, typename p2##_type>\ |
1585 | | inline name##MatcherP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \ |
1586 | 0 | p1##_type p1, p2##_type p2) {\ |
1587 | 0 | return name##MatcherP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\ |
1588 | 0 | }\ |
1589 | | template <typename p0##_type, typename p1##_type, typename p2##_type>\ |
1590 | | template <typename arg_type>\ |
1591 | | bool name##MatcherP3<p0##_type, p1##_type, \ |
1592 | | p2##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ |
1593 | | arg_type arg, \ |
1594 | | ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ |
1595 | | const |
1596 | | |
1597 | | #define MATCHER_P4(name, p0, p1, p2, p3, description)\ |
1598 | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
1599 | | typename p3##_type>\ |
1600 | | class name##MatcherP4 {\ |
1601 | | public:\ |
1602 | | template <typename arg_type>\ |
1603 | | class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ |
1604 | | public:\ |
1605 | | gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
1606 | | p3##_type gmock_p3)\ |
1607 | | : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3) {}\ |
1608 | | virtual bool MatchAndExplain(\ |
1609 | | arg_type arg, ::testing::MatchResultListener* result_listener) const;\ |
1610 | | virtual void DescribeTo(::std::ostream* gmock_os) const {\ |
1611 | | *gmock_os << FormatDescription(false);\ |
1612 | | }\ |
1613 | | virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ |
1614 | | *gmock_os << FormatDescription(true);\ |
1615 | | }\ |
1616 | | p0##_type p0;\ |
1617 | | p1##_type p1;\ |
1618 | | p2##_type p2;\ |
1619 | | p3##_type p3;\ |
1620 | | private:\ |
1621 | | ::testing::internal::string FormatDescription(bool negation) const {\ |
1622 | | const ::testing::internal::string gmock_description = (description);\ |
1623 | | if (!gmock_description.empty())\ |
1624 | | return gmock_description;\ |
1625 | | return ::testing::internal::FormatMatcherDescription(\ |
1626 | | negation, #name, \ |
1627 | | ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ |
1628 | | ::testing::tuple<p0##_type, p1##_type, p2##_type, \ |
1629 | | p3##_type>(p0, p1, p2, p3)));\ |
1630 | | }\ |
1631 | | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
1632 | | };\ |
1633 | | template <typename arg_type>\ |
1634 | | operator ::testing::Matcher<arg_type>() const {\ |
1635 | | return ::testing::Matcher<arg_type>(\ |
1636 | | new gmock_Impl<arg_type>(p0, p1, p2, p3));\ |
1637 | | }\ |
1638 | | name##MatcherP4(p0##_type gmock_p0, p1##_type gmock_p1, \ |
1639 | | p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \ |
1640 | | p2(gmock_p2), p3(gmock_p3) {\ |
1641 | | }\ |
1642 | | p0##_type p0;\ |
1643 | | p1##_type p1;\ |
1644 | | p2##_type p2;\ |
1645 | | p3##_type p3;\ |
1646 | | private:\ |
1647 | | GTEST_DISALLOW_ASSIGN_(name##MatcherP4);\ |
1648 | | };\ |
1649 | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
1650 | | typename p3##_type>\ |
1651 | | inline name##MatcherP4<p0##_type, p1##_type, p2##_type, \ |
1652 | | p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \ |
1653 | | p3##_type p3) {\ |
1654 | | return name##MatcherP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, \ |
1655 | | p1, p2, p3);\ |
1656 | | }\ |
1657 | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
1658 | | typename p3##_type>\ |
1659 | | template <typename arg_type>\ |
1660 | | bool name##MatcherP4<p0##_type, p1##_type, p2##_type, \ |
1661 | | p3##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ |
1662 | | arg_type arg, \ |
1663 | | ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ |
1664 | | const |
1665 | | |
1666 | | #define MATCHER_P5(name, p0, p1, p2, p3, p4, description)\ |
1667 | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
1668 | | typename p3##_type, typename p4##_type>\ |
1669 | | class name##MatcherP5 {\ |
1670 | | public:\ |
1671 | | template <typename arg_type>\ |
1672 | | class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ |
1673 | | public:\ |
1674 | | gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
1675 | | p3##_type gmock_p3, p4##_type gmock_p4)\ |
1676 | | : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ |
1677 | | p4(gmock_p4) {}\ |
1678 | | virtual bool MatchAndExplain(\ |
1679 | | arg_type arg, ::testing::MatchResultListener* result_listener) const;\ |
1680 | | virtual void DescribeTo(::std::ostream* gmock_os) const {\ |
1681 | | *gmock_os << FormatDescription(false);\ |
1682 | | }\ |
1683 | | virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ |
1684 | | *gmock_os << FormatDescription(true);\ |
1685 | | }\ |
1686 | | p0##_type p0;\ |
1687 | | p1##_type p1;\ |
1688 | | p2##_type p2;\ |
1689 | | p3##_type p3;\ |
1690 | | p4##_type p4;\ |
1691 | | private:\ |
1692 | | ::testing::internal::string FormatDescription(bool negation) const {\ |
1693 | | const ::testing::internal::string gmock_description = (description);\ |
1694 | | if (!gmock_description.empty())\ |
1695 | | return gmock_description;\ |
1696 | | return ::testing::internal::FormatMatcherDescription(\ |
1697 | | negation, #name, \ |
1698 | | ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ |
1699 | | ::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ |
1700 | | p4##_type>(p0, p1, p2, p3, p4)));\ |
1701 | | }\ |
1702 | | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
1703 | | };\ |
1704 | | template <typename arg_type>\ |
1705 | | operator ::testing::Matcher<arg_type>() const {\ |
1706 | | return ::testing::Matcher<arg_type>(\ |
1707 | | new gmock_Impl<arg_type>(p0, p1, p2, p3, p4));\ |
1708 | | }\ |
1709 | | name##MatcherP5(p0##_type gmock_p0, p1##_type gmock_p1, \ |
1710 | | p2##_type gmock_p2, p3##_type gmock_p3, \ |
1711 | | p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
1712 | | p3(gmock_p3), p4(gmock_p4) {\ |
1713 | | }\ |
1714 | | p0##_type p0;\ |
1715 | | p1##_type p1;\ |
1716 | | p2##_type p2;\ |
1717 | | p3##_type p3;\ |
1718 | | p4##_type p4;\ |
1719 | | private:\ |
1720 | | GTEST_DISALLOW_ASSIGN_(name##MatcherP5);\ |
1721 | | };\ |
1722 | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
1723 | | typename p3##_type, typename p4##_type>\ |
1724 | | inline name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \ |
1725 | | p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ |
1726 | | p4##_type p4) {\ |
1727 | | return name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \ |
1728 | | p4##_type>(p0, p1, p2, p3, p4);\ |
1729 | | }\ |
1730 | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
1731 | | typename p3##_type, typename p4##_type>\ |
1732 | | template <typename arg_type>\ |
1733 | | bool name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \ |
1734 | | p4##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ |
1735 | | arg_type arg, \ |
1736 | | ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ |
1737 | | const |
1738 | | |
1739 | | #define MATCHER_P6(name, p0, p1, p2, p3, p4, p5, description)\ |
1740 | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
1741 | | typename p3##_type, typename p4##_type, typename p5##_type>\ |
1742 | | class name##MatcherP6 {\ |
1743 | | public:\ |
1744 | | template <typename arg_type>\ |
1745 | | class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ |
1746 | | public:\ |
1747 | | gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
1748 | | p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5)\ |
1749 | | : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ |
1750 | | p4(gmock_p4), p5(gmock_p5) {}\ |
1751 | | virtual bool MatchAndExplain(\ |
1752 | | arg_type arg, ::testing::MatchResultListener* result_listener) const;\ |
1753 | | virtual void DescribeTo(::std::ostream* gmock_os) const {\ |
1754 | | *gmock_os << FormatDescription(false);\ |
1755 | | }\ |
1756 | | virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ |
1757 | | *gmock_os << FormatDescription(true);\ |
1758 | | }\ |
1759 | | p0##_type p0;\ |
1760 | | p1##_type p1;\ |
1761 | | p2##_type p2;\ |
1762 | | p3##_type p3;\ |
1763 | | p4##_type p4;\ |
1764 | | p5##_type p5;\ |
1765 | | private:\ |
1766 | | ::testing::internal::string FormatDescription(bool negation) const {\ |
1767 | | const ::testing::internal::string gmock_description = (description);\ |
1768 | | if (!gmock_description.empty())\ |
1769 | | return gmock_description;\ |
1770 | | return ::testing::internal::FormatMatcherDescription(\ |
1771 | | negation, #name, \ |
1772 | | ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ |
1773 | | ::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ |
1774 | | p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5)));\ |
1775 | | }\ |
1776 | | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
1777 | | };\ |
1778 | | template <typename arg_type>\ |
1779 | | operator ::testing::Matcher<arg_type>() const {\ |
1780 | | return ::testing::Matcher<arg_type>(\ |
1781 | | new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5));\ |
1782 | | }\ |
1783 | | name##MatcherP6(p0##_type gmock_p0, p1##_type gmock_p1, \ |
1784 | | p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ |
1785 | | p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
1786 | | p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {\ |
1787 | | }\ |
1788 | | p0##_type p0;\ |
1789 | | p1##_type p1;\ |
1790 | | p2##_type p2;\ |
1791 | | p3##_type p3;\ |
1792 | | p4##_type p4;\ |
1793 | | p5##_type p5;\ |
1794 | | private:\ |
1795 | | GTEST_DISALLOW_ASSIGN_(name##MatcherP6);\ |
1796 | | };\ |
1797 | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
1798 | | typename p3##_type, typename p4##_type, typename p5##_type>\ |
1799 | | inline name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, \ |
1800 | | p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \ |
1801 | | p3##_type p3, p4##_type p4, p5##_type p5) {\ |
1802 | | return name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, \ |
1803 | | p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\ |
1804 | | }\ |
1805 | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
1806 | | typename p3##_type, typename p4##_type, typename p5##_type>\ |
1807 | | template <typename arg_type>\ |
1808 | | bool name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
1809 | | p5##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ |
1810 | | arg_type arg, \ |
1811 | | ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ |
1812 | | const |
1813 | | |
1814 | | #define MATCHER_P7(name, p0, p1, p2, p3, p4, p5, p6, description)\ |
1815 | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
1816 | | typename p3##_type, typename p4##_type, typename p5##_type, \ |
1817 | | typename p6##_type>\ |
1818 | | class name##MatcherP7 {\ |
1819 | | public:\ |
1820 | | template <typename arg_type>\ |
1821 | | class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ |
1822 | | public:\ |
1823 | | gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
1824 | | p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
1825 | | p6##_type gmock_p6)\ |
1826 | | : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ |
1827 | | p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\ |
1828 | | virtual bool MatchAndExplain(\ |
1829 | | arg_type arg, ::testing::MatchResultListener* result_listener) const;\ |
1830 | | virtual void DescribeTo(::std::ostream* gmock_os) const {\ |
1831 | | *gmock_os << FormatDescription(false);\ |
1832 | | }\ |
1833 | | virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ |
1834 | | *gmock_os << FormatDescription(true);\ |
1835 | | }\ |
1836 | | p0##_type p0;\ |
1837 | | p1##_type p1;\ |
1838 | | p2##_type p2;\ |
1839 | | p3##_type p3;\ |
1840 | | p4##_type p4;\ |
1841 | | p5##_type p5;\ |
1842 | | p6##_type p6;\ |
1843 | | private:\ |
1844 | | ::testing::internal::string FormatDescription(bool negation) const {\ |
1845 | | const ::testing::internal::string gmock_description = (description);\ |
1846 | | if (!gmock_description.empty())\ |
1847 | | return gmock_description;\ |
1848 | | return ::testing::internal::FormatMatcherDescription(\ |
1849 | | negation, #name, \ |
1850 | | ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ |
1851 | | ::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ |
1852 | | p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, \ |
1853 | | p6)));\ |
1854 | | }\ |
1855 | | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
1856 | | };\ |
1857 | | template <typename arg_type>\ |
1858 | | operator ::testing::Matcher<arg_type>() const {\ |
1859 | | return ::testing::Matcher<arg_type>(\ |
1860 | | new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6));\ |
1861 | | }\ |
1862 | | name##MatcherP7(p0##_type gmock_p0, p1##_type gmock_p1, \ |
1863 | | p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ |
1864 | | p5##_type gmock_p5, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), \ |
1865 | | p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \ |
1866 | | p6(gmock_p6) {\ |
1867 | | }\ |
1868 | | p0##_type p0;\ |
1869 | | p1##_type p1;\ |
1870 | | p2##_type p2;\ |
1871 | | p3##_type p3;\ |
1872 | | p4##_type p4;\ |
1873 | | p5##_type p5;\ |
1874 | | p6##_type p6;\ |
1875 | | private:\ |
1876 | | GTEST_DISALLOW_ASSIGN_(name##MatcherP7);\ |
1877 | | };\ |
1878 | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
1879 | | typename p3##_type, typename p4##_type, typename p5##_type, \ |
1880 | | typename p6##_type>\ |
1881 | | inline name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, \ |
1882 | | p4##_type, p5##_type, p6##_type> name(p0##_type p0, p1##_type p1, \ |
1883 | | p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ |
1884 | | p6##_type p6) {\ |
1885 | | return name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, \ |
1886 | | p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\ |
1887 | | }\ |
1888 | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
1889 | | typename p3##_type, typename p4##_type, typename p5##_type, \ |
1890 | | typename p6##_type>\ |
1891 | | template <typename arg_type>\ |
1892 | | bool name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
1893 | | p5##_type, p6##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ |
1894 | | arg_type arg, \ |
1895 | | ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ |
1896 | | const |
1897 | | |
1898 | | #define MATCHER_P8(name, p0, p1, p2, p3, p4, p5, p6, p7, description)\ |
1899 | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
1900 | | typename p3##_type, typename p4##_type, typename p5##_type, \ |
1901 | | typename p6##_type, typename p7##_type>\ |
1902 | | class name##MatcherP8 {\ |
1903 | | public:\ |
1904 | | template <typename arg_type>\ |
1905 | | class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ |
1906 | | public:\ |
1907 | | gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
1908 | | p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
1909 | | p6##_type gmock_p6, p7##_type gmock_p7)\ |
1910 | | : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ |
1911 | | p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\ |
1912 | | virtual bool MatchAndExplain(\ |
1913 | | arg_type arg, ::testing::MatchResultListener* result_listener) const;\ |
1914 | | virtual void DescribeTo(::std::ostream* gmock_os) const {\ |
1915 | | *gmock_os << FormatDescription(false);\ |
1916 | | }\ |
1917 | | virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ |
1918 | | *gmock_os << FormatDescription(true);\ |
1919 | | }\ |
1920 | | p0##_type p0;\ |
1921 | | p1##_type p1;\ |
1922 | | p2##_type p2;\ |
1923 | | p3##_type p3;\ |
1924 | | p4##_type p4;\ |
1925 | | p5##_type p5;\ |
1926 | | p6##_type p6;\ |
1927 | | p7##_type p7;\ |
1928 | | private:\ |
1929 | | ::testing::internal::string FormatDescription(bool negation) const {\ |
1930 | | const ::testing::internal::string gmock_description = (description);\ |
1931 | | if (!gmock_description.empty())\ |
1932 | | return gmock_description;\ |
1933 | | return ::testing::internal::FormatMatcherDescription(\ |
1934 | | negation, #name, \ |
1935 | | ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ |
1936 | | ::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ |
1937 | | p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, \ |
1938 | | p3, p4, p5, p6, p7)));\ |
1939 | | }\ |
1940 | | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
1941 | | };\ |
1942 | | template <typename arg_type>\ |
1943 | | operator ::testing::Matcher<arg_type>() const {\ |
1944 | | return ::testing::Matcher<arg_type>(\ |
1945 | | new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7));\ |
1946 | | }\ |
1947 | | name##MatcherP8(p0##_type gmock_p0, p1##_type gmock_p1, \ |
1948 | | p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ |
1949 | | p5##_type gmock_p5, p6##_type gmock_p6, \ |
1950 | | p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
1951 | | p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ |
1952 | | p7(gmock_p7) {\ |
1953 | | }\ |
1954 | | p0##_type p0;\ |
1955 | | p1##_type p1;\ |
1956 | | p2##_type p2;\ |
1957 | | p3##_type p3;\ |
1958 | | p4##_type p4;\ |
1959 | | p5##_type p5;\ |
1960 | | p6##_type p6;\ |
1961 | | p7##_type p7;\ |
1962 | | private:\ |
1963 | | GTEST_DISALLOW_ASSIGN_(name##MatcherP8);\ |
1964 | | };\ |
1965 | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
1966 | | typename p3##_type, typename p4##_type, typename p5##_type, \ |
1967 | | typename p6##_type, typename p7##_type>\ |
1968 | | inline name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, \ |
1969 | | p4##_type, p5##_type, p6##_type, p7##_type> name(p0##_type p0, \ |
1970 | | p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ |
1971 | | p6##_type p6, p7##_type p7) {\ |
1972 | | return name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, \ |
1973 | | p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \ |
1974 | | p6, p7);\ |
1975 | | }\ |
1976 | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
1977 | | typename p3##_type, typename p4##_type, typename p5##_type, \ |
1978 | | typename p6##_type, typename p7##_type>\ |
1979 | | template <typename arg_type>\ |
1980 | | bool name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
1981 | | p5##_type, p6##_type, \ |
1982 | | p7##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ |
1983 | | arg_type arg, \ |
1984 | | ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ |
1985 | | const |
1986 | | |
1987 | | #define MATCHER_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, description)\ |
1988 | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
1989 | | typename p3##_type, typename p4##_type, typename p5##_type, \ |
1990 | | typename p6##_type, typename p7##_type, typename p8##_type>\ |
1991 | | class name##MatcherP9 {\ |
1992 | | public:\ |
1993 | | template <typename arg_type>\ |
1994 | | class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ |
1995 | | public:\ |
1996 | | gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
1997 | | p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
1998 | | p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8)\ |
1999 | | : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ |
2000 | | p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ |
2001 | | p8(gmock_p8) {}\ |
2002 | | virtual bool MatchAndExplain(\ |
2003 | | arg_type arg, ::testing::MatchResultListener* result_listener) const;\ |
2004 | | virtual void DescribeTo(::std::ostream* gmock_os) const {\ |
2005 | | *gmock_os << FormatDescription(false);\ |
2006 | | }\ |
2007 | | virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ |
2008 | | *gmock_os << FormatDescription(true);\ |
2009 | | }\ |
2010 | | p0##_type p0;\ |
2011 | | p1##_type p1;\ |
2012 | | p2##_type p2;\ |
2013 | | p3##_type p3;\ |
2014 | | p4##_type p4;\ |
2015 | | p5##_type p5;\ |
2016 | | p6##_type p6;\ |
2017 | | p7##_type p7;\ |
2018 | | p8##_type p8;\ |
2019 | | private:\ |
2020 | | ::testing::internal::string FormatDescription(bool negation) const {\ |
2021 | | const ::testing::internal::string gmock_description = (description);\ |
2022 | | if (!gmock_description.empty())\ |
2023 | | return gmock_description;\ |
2024 | | return ::testing::internal::FormatMatcherDescription(\ |
2025 | | negation, #name, \ |
2026 | | ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ |
2027 | | ::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ |
2028 | | p4##_type, p5##_type, p6##_type, p7##_type, \ |
2029 | | p8##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8)));\ |
2030 | | }\ |
2031 | | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
2032 | | };\ |
2033 | | template <typename arg_type>\ |
2034 | | operator ::testing::Matcher<arg_type>() const {\ |
2035 | | return ::testing::Matcher<arg_type>(\ |
2036 | | new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8));\ |
2037 | | }\ |
2038 | | name##MatcherP9(p0##_type gmock_p0, p1##_type gmock_p1, \ |
2039 | | p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ |
2040 | | p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ |
2041 | | p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ |
2042 | | p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ |
2043 | | p8(gmock_p8) {\ |
2044 | | }\ |
2045 | | p0##_type p0;\ |
2046 | | p1##_type p1;\ |
2047 | | p2##_type p2;\ |
2048 | | p3##_type p3;\ |
2049 | | p4##_type p4;\ |
2050 | | p5##_type p5;\ |
2051 | | p6##_type p6;\ |
2052 | | p7##_type p7;\ |
2053 | | p8##_type p8;\ |
2054 | | private:\ |
2055 | | GTEST_DISALLOW_ASSIGN_(name##MatcherP9);\ |
2056 | | };\ |
2057 | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
2058 | | typename p3##_type, typename p4##_type, typename p5##_type, \ |
2059 | | typename p6##_type, typename p7##_type, typename p8##_type>\ |
2060 | | inline name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, \ |
2061 | | p4##_type, p5##_type, p6##_type, p7##_type, \ |
2062 | | p8##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ |
2063 | | p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \ |
2064 | | p8##_type p8) {\ |
2065 | | return name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, \ |
2066 | | p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \ |
2067 | | p3, p4, p5, p6, p7, p8);\ |
2068 | | }\ |
2069 | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
2070 | | typename p3##_type, typename p4##_type, typename p5##_type, \ |
2071 | | typename p6##_type, typename p7##_type, typename p8##_type>\ |
2072 | | template <typename arg_type>\ |
2073 | | bool name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ |
2074 | | p5##_type, p6##_type, p7##_type, \ |
2075 | | p8##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ |
2076 | | arg_type arg, \ |
2077 | | ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ |
2078 | | const |
2079 | | |
2080 | | #define MATCHER_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, description)\ |
2081 | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
2082 | | typename p3##_type, typename p4##_type, typename p5##_type, \ |
2083 | | typename p6##_type, typename p7##_type, typename p8##_type, \ |
2084 | | typename p9##_type>\ |
2085 | | class name##MatcherP10 {\ |
2086 | | public:\ |
2087 | | template <typename arg_type>\ |
2088 | | class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ |
2089 | | public:\ |
2090 | | gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ |
2091 | | p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ |
2092 | | p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ |
2093 | | p9##_type gmock_p9)\ |
2094 | | : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), \ |
2095 | | p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ |
2096 | | p8(gmock_p8), p9(gmock_p9) {}\ |
2097 | | virtual bool MatchAndExplain(\ |
2098 | | arg_type arg, ::testing::MatchResultListener* result_listener) const;\ |
2099 | | virtual void DescribeTo(::std::ostream* gmock_os) const {\ |
2100 | | *gmock_os << FormatDescription(false);\ |
2101 | | }\ |
2102 | | virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\ |
2103 | | *gmock_os << FormatDescription(true);\ |
2104 | | }\ |
2105 | | p0##_type p0;\ |
2106 | | p1##_type p1;\ |
2107 | | p2##_type p2;\ |
2108 | | p3##_type p3;\ |
2109 | | p4##_type p4;\ |
2110 | | p5##_type p5;\ |
2111 | | p6##_type p6;\ |
2112 | | p7##_type p7;\ |
2113 | | p8##_type p8;\ |
2114 | | p9##_type p9;\ |
2115 | | private:\ |
2116 | | ::testing::internal::string FormatDescription(bool negation) const {\ |
2117 | | const ::testing::internal::string gmock_description = (description);\ |
2118 | | if (!gmock_description.empty())\ |
2119 | | return gmock_description;\ |
2120 | | return ::testing::internal::FormatMatcherDescription(\ |
2121 | | negation, #name, \ |
2122 | | ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\ |
2123 | | ::testing::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \ |
2124 | | p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \ |
2125 | | p9##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)));\ |
2126 | | }\ |
2127 | | GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ |
2128 | | };\ |
2129 | | template <typename arg_type>\ |
2130 | | operator ::testing::Matcher<arg_type>() const {\ |
2131 | | return ::testing::Matcher<arg_type>(\ |
2132 | | new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9));\ |
2133 | | }\ |
2134 | | name##MatcherP10(p0##_type gmock_p0, p1##_type gmock_p1, \ |
2135 | | p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ |
2136 | | p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ |
2137 | | p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \ |
2138 | | p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ |
2139 | | p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {\ |
2140 | | }\ |
2141 | | p0##_type p0;\ |
2142 | | p1##_type p1;\ |
2143 | | p2##_type p2;\ |
2144 | | p3##_type p3;\ |
2145 | | p4##_type p4;\ |
2146 | | p5##_type p5;\ |
2147 | | p6##_type p6;\ |
2148 | | p7##_type p7;\ |
2149 | | p8##_type p8;\ |
2150 | | p9##_type p9;\ |
2151 | | private:\ |
2152 | | GTEST_DISALLOW_ASSIGN_(name##MatcherP10);\ |
2153 | | };\ |
2154 | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
2155 | | typename p3##_type, typename p4##_type, typename p5##_type, \ |
2156 | | typename p6##_type, typename p7##_type, typename p8##_type, \ |
2157 | | typename p9##_type>\ |
2158 | | inline name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \ |
2159 | | p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \ |
2160 | | p9##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ |
2161 | | p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \ |
2162 | | p9##_type p9) {\ |
2163 | | return name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \ |
2164 | | p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \ |
2165 | | p1, p2, p3, p4, p5, p6, p7, p8, p9);\ |
2166 | | }\ |
2167 | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ |
2168 | | typename p3##_type, typename p4##_type, typename p5##_type, \ |
2169 | | typename p6##_type, typename p7##_type, typename p8##_type, \ |
2170 | | typename p9##_type>\ |
2171 | | template <typename arg_type>\ |
2172 | | bool name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \ |
2173 | | p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \ |
2174 | | p9##_type>::gmock_Impl<arg_type>::MatchAndExplain(\ |
2175 | | arg_type arg, \ |
2176 | | ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\ |
2177 | | const |
2178 | | |
2179 | | #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ |