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