gmock-generated-matchers.h 44.7 KB
Newer Older
1
2
3
// This file was GENERATED by command:
//     pump.py gmock-generated-matchers.h.pump
// DO NOT EDIT BY HAND!!!
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

// Copyright 2008, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//     * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//     * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
//     * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

// Google Mock - a framework for writing C++ mock classes.
//
// This file implements some commonly used variadic matchers.

Gennadiy Civil's avatar
 
Gennadiy Civil committed
38
39
// GOOGLETEST_CM0002 DO NOT DELETE

40
41
42
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_

43
#include <iterator>
44
45
#include <sstream>
#include <string>
Abseil Team's avatar
Abseil Team committed
46
#include <utility>
47
#include <vector>
48
#include "gmock/gmock-matchers.h"
49

zhanyong.wan's avatar
zhanyong.wan committed
50
// The MATCHER* family of macros can be used in a namespace scope to
zhanyong.wan's avatar
zhanyong.wan committed
51
52
53
54
55
56
// define custom matchers easily.
//
// Basic Usage
// ===========
//
// The syntax
zhanyong.wan's avatar
zhanyong.wan committed
57
58
59
//
//   MATCHER(name, description_string) { statements; }
//
zhanyong.wan's avatar
zhanyong.wan committed
60
61
62
63
// defines a matcher with the given name that executes the statements,
// which must return a bool to indicate if the match succeeds.  Inside
// the statements, you can refer to the value being matched by 'arg',
// and refer to its type by 'arg_type'.
64
65
66
67
68
69
70
71
72
73
//
// The description string documents what the matcher does, and is used
// to generate the failure message when the match fails.  Since a
// MATCHER() is usually defined in a header file shared by multiple
// C++ source files, we require the description to be a C-string
// literal to avoid possible side effects.  It can be empty, in which
// case we'll use the sequence of words in the matcher name as the
// description.
//
// For example:
zhanyong.wan's avatar
zhanyong.wan committed
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//
//   MATCHER(IsEven, "") { return (arg % 2) == 0; }
//
// allows you to write
//
//   // Expects mock_foo.Bar(n) to be called where n is even.
//   EXPECT_CALL(mock_foo, Bar(IsEven()));
//
// or,
//
//   // Verifies that the value of some_expression is even.
//   EXPECT_THAT(some_expression, IsEven());
//
// If the above assertion fails, it will print something like:
//
//   Value of: some_expression
//   Expected: is even
//     Actual: 7
//
// where the description "is even" is automatically calculated from the
// matcher name IsEven.
//
zhanyong.wan's avatar
zhanyong.wan committed
96
97
98
// Argument Type
// =============
//
zhanyong.wan's avatar
zhanyong.wan committed
99
100
101
102
103
104
105
106
107
108
// Note that the type of the value being matched (arg_type) is
// determined by the context in which you use the matcher and is
// supplied to you by the compiler, so you don't need to worry about
// declaring it (nor can you).  This allows the matcher to be
// polymorphic.  For example, IsEven() can be used to match any type
// where the value of "(arg % 2) == 0" can be implicitly converted to
// a bool.  In the "Bar(IsEven())" example above, if method Bar()
// takes an int, 'arg_type' will be int; if it takes an unsigned long,
// 'arg_type' will be unsigned long; and so on.
//
zhanyong.wan's avatar
zhanyong.wan committed
109
110
111
// Parameterizing Matchers
// =======================
//
zhanyong.wan's avatar
zhanyong.wan committed
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
// Sometimes you'll want to parameterize the matcher.  For that you
// can use another macro:
//
//   MATCHER_P(name, param_name, description_string) { statements; }
//
// For example:
//
//   MATCHER_P(HasAbsoluteValue, value, "") { return abs(arg) == value; }
//
// will allow you to write:
//
//   EXPECT_THAT(Blah("a"), HasAbsoluteValue(n));
//
// which may lead to this message (assuming n is 10):
//
//   Value of: Blah("a")
//   Expected: has absolute value 10
//     Actual: -9
//
// Note that both the matcher description and its parameter are
// printed, making the message human-friendly.
//
// In the matcher definition body, you can write 'foo_type' to
// reference the type of a parameter named 'foo'.  For example, in the
// body of MATCHER_P(HasAbsoluteValue, value) above, you can write
// 'value_type' to refer to the type of 'value'.
//
// We also provide MATCHER_P2, MATCHER_P3, ..., up to MATCHER_P10 to
// support multi-parameter matchers.
//
zhanyong.wan's avatar
zhanyong.wan committed
142
143
144
// Describing Parameterized Matchers
// =================================
//
145
146
147
148
149
150
151
152
153
154
// The last argument to MATCHER*() is a string-typed expression.  The
// expression can reference all of the matcher's parameters and a
// special bool-typed variable named 'negation'.  When 'negation' is
// false, the expression should evaluate to the matcher's description;
// otherwise it should evaluate to the description of the negation of
// the matcher.  For example,
//
//   using testing::PrintToString;
//
//   MATCHER_P2(InClosedRange, low, hi,
155
//       std::string(negation ? "is not" : "is") + " in range [" +
156
//       PrintToString(low) + ", " + PrintToString(hi) + "]") {
157
158
159
160
//     return low <= arg && arg <= hi;
//   }
//   ...
//   EXPECT_THAT(3, InClosedRange(4, 6));
161
//   EXPECT_THAT(3, Not(InClosedRange(2, 4)));
162
//
163
// would generate two failures that contain the text:
164
165
//
//   Expected: is in range [4, 6]
166
167
//   ...
//   Expected: is not in range [2, 4]
168
169
170
171
172
173
174
175
//
// If you specify "" as the description, the failure message will
// contain the sequence of words in the matcher name followed by the
// parameter values printed as a tuple.  For example,
//
//   MATCHER_P2(InClosedRange, low, hi, "") { ... }
//   ...
//   EXPECT_THAT(3, InClosedRange(4, 6));
176
//   EXPECT_THAT(3, Not(InClosedRange(2, 4)));
177
//
178
// would generate two failures that contain the text:
179
180
//
//   Expected: in closed range (4, 6)
181
182
//   ...
//   Expected: not (in closed range (2, 4))
183
//
zhanyong.wan's avatar
zhanyong.wan committed
184
185
186
// Types of Matcher Parameters
// ===========================
//
zhanyong.wan's avatar
zhanyong.wan committed
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
// For the purpose of typing, you can view
//
//   MATCHER_Pk(Foo, p1, ..., pk, description_string) { ... }
//
// as shorthand for
//
//   template <typename p1_type, ..., typename pk_type>
//   FooMatcherPk<p1_type, ..., pk_type>
//   Foo(p1_type p1, ..., pk_type pk) { ... }
//
// When you write Foo(v1, ..., vk), the compiler infers the types of
// the parameters v1, ..., and vk for you.  If you are not happy with
// the result of the type inference, you can specify the types by
// explicitly instantiating the template, as in Foo<long, bool>(5,
// false).  As said earlier, you don't get to (or need to) specify
// 'arg_type' as that's determined by the context in which the matcher
// is used.  You can assign the result of expression Foo(p1, ..., pk)
// to a variable of type FooMatcherPk<p1_type, ..., pk_type>.  This
// can be useful when composing matchers.
//
// While you can instantiate a matcher template with reference types,
// passing the parameters by pointer usually makes your code more
// readable.  If, however, you still want to pass a parameter by
// reference, be aware that in the failure message generated by the
// matcher you will see the value of the referenced object but not its
// address.
//
zhanyong.wan's avatar
zhanyong.wan committed
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
// Explaining Match Results
// ========================
//
// Sometimes the matcher description alone isn't enough to explain why
// the match has failed or succeeded.  For example, when expecting a
// long string, it can be very helpful to also print the diff between
// the expected string and the actual one.  To achieve that, you can
// optionally stream additional information to a special variable
// named result_listener, whose type is a pointer to class
// MatchResultListener:
//
//   MATCHER_P(EqualsLongString, str, "") {
//     if (arg == str) return true;
//
//     *result_listener << "the difference: "
///                     << DiffStrings(str, arg);
//     return false;
//   }
//
// Overloading Matchers
// ====================
//
zhanyong.wan's avatar
zhanyong.wan committed
236
237
238
239
240
// You can overload matchers with different numbers of parameters:
//
//   MATCHER_P(Blah, a, description_string1) { ... }
//   MATCHER_P2(Blah, a, b, description_string2) { ... }
//
zhanyong.wan's avatar
zhanyong.wan committed
241
242
// Caveats
// =======
zhanyong.wan's avatar
zhanyong.wan committed
243
//
zhanyong.wan's avatar
zhanyong.wan committed
244
245
246
247
248
249
250
251
// When defining a new matcher, you should also consider implementing
// MatcherInterface or using MakePolymorphicMatcher().  These
// approaches require more work than the MATCHER* macros, but also
// give you more control on the types of the value being matched and
// the matcher parameters, which may leads to better compiler error
// messages when the matcher is used wrong.  They also allow
// overloading matchers based on parameter types (as opposed to just
// based on the number of parameters).
zhanyong.wan's avatar
zhanyong.wan committed
252
253
254
255
256
257
258
//
// MATCHER*() can only be used in a namespace scope.  The reason is
// that C++ doesn't yet allow function-local types to be used to
// instantiate templates.  The up-coming C++0x standard will fix this.
// Once that's done, we'll consider supporting using MATCHER*() inside
// a function.
//
zhanyong.wan's avatar
zhanyong.wan committed
259
260
// More Information
// ================
zhanyong.wan's avatar
zhanyong.wan committed
261
262
//
// To learn more about using these macros, please search for 'MATCHER'
Abseil Team's avatar
Abseil Team committed
263
// on
misterg's avatar
misterg committed
264
// https://github.com/abseil/googletest/blob/master/googlemock/docs/CookBook.md
zhanyong.wan's avatar
zhanyong.wan committed
265
266
267
268
269

#define MATCHER(name, description)\
  class name##Matcher {\
   public:\
    template <typename arg_type>\
270
271
    class gmock_Impl : public ::testing::MatcherInterface<\
        GTEST_REFERENCE_TO_CONST_(arg_type)> {\
zhanyong.wan's avatar
zhanyong.wan committed
272
     public:\
273
274
      gmock_Impl()\
           {}\
zhanyong.wan's avatar
zhanyong.wan committed
275
      virtual bool MatchAndExplain(\
276
277
          GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
          ::testing::MatchResultListener* result_listener) const;\
278
      virtual void DescribeTo(::std::ostream* gmock_os) const {\
279
280
281
282
        *gmock_os << FormatDescription(false);\
      }\
      virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
        *gmock_os << FormatDescription(true);\
zhanyong.wan's avatar
zhanyong.wan committed
283
      }\
284
     private:\
285
286
      ::std::string FormatDescription(bool negation) const {\
        ::std::string gmock_description = (description);\
287
        if (!gmock_description.empty()) {\
288
          return gmock_description;\
289
        }\
290
        return ::testing::internal::FormatMatcherDescription(\
291
            negation, #name, \
292
            ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
Abseil Team's avatar
Abseil Team committed
293
                ::std::tuple<>()));\
294
      }\
zhanyong.wan's avatar
zhanyong.wan committed
295
296
297
    };\
    template <typename arg_type>\
    operator ::testing::Matcher<arg_type>() const {\
298
      return ::testing::Matcher<arg_type>(\
299
          new gmock_Impl<arg_type>());\
zhanyong.wan's avatar
zhanyong.wan committed
300
301
302
    }\
    name##Matcher() {\
    }\
303
   private:\
zhanyong.wan's avatar
zhanyong.wan committed
304
305
306
307
308
  };\
  inline name##Matcher name() {\
    return name##Matcher();\
  }\
  template <typename arg_type>\
zhanyong.wan's avatar
zhanyong.wan committed
309
  bool name##Matcher::gmock_Impl<arg_type>::MatchAndExplain(\
310
      GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
zhanyong.wan's avatar
zhanyong.wan committed
311
312
      ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
          const
zhanyong.wan's avatar
zhanyong.wan committed
313
314
315
316
317
318

#define MATCHER_P(name, p0, description)\
  template <typename p0##_type>\
  class name##MatcherP {\
   public:\
    template <typename arg_type>\
319
320
    class gmock_Impl : public ::testing::MatcherInterface<\
        GTEST_REFERENCE_TO_CONST_(arg_type)> {\
zhanyong.wan's avatar
zhanyong.wan committed
321
     public:\
322
      explicit gmock_Impl(p0##_type gmock_p0)\
Abseil Team's avatar
Abseil Team committed
323
           : p0(::std::move(gmock_p0)) {}\
zhanyong.wan's avatar
zhanyong.wan committed
324
      virtual bool MatchAndExplain(\
325
326
          GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
          ::testing::MatchResultListener* result_listener) const;\
327
      virtual void DescribeTo(::std::ostream* gmock_os) const {\
328
329
330
331
        *gmock_os << FormatDescription(false);\
      }\
      virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
        *gmock_os << FormatDescription(true);\
zhanyong.wan's avatar
zhanyong.wan committed
332
      }\
333
      p0##_type const p0;\
334
     private:\
335
336
      ::std::string FormatDescription(bool negation) const {\
        ::std::string gmock_description = (description);\
337
        if (!gmock_description.empty()) {\
338
          return gmock_description;\
339
        }\
340
        return ::testing::internal::FormatMatcherDescription(\
341
            negation, #name, \
342
            ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
Abseil Team's avatar
Abseil Team committed
343
                ::std::tuple<p0##_type>(p0)));\
344
      }\
zhanyong.wan's avatar
zhanyong.wan committed
345
346
347
    };\
    template <typename arg_type>\
    operator ::testing::Matcher<arg_type>() const {\
348
      return ::testing::Matcher<arg_type>(\
349
          new gmock_Impl<arg_type>(p0));\
zhanyong.wan's avatar
zhanyong.wan committed
350
    }\
Abseil Team's avatar
Abseil Team committed
351
    explicit name##MatcherP(p0##_type gmock_p0) : p0(::std::move(gmock_p0)) {\
zhanyong.wan's avatar
zhanyong.wan committed
352
    }\
353
    p0##_type const p0;\
354
   private:\
zhanyong.wan's avatar
zhanyong.wan committed
355
356
357
358
359
360
361
  };\
  template <typename p0##_type>\
  inline name##MatcherP<p0##_type> name(p0##_type p0) {\
    return name##MatcherP<p0##_type>(p0);\
  }\
  template <typename p0##_type>\
  template <typename arg_type>\
zhanyong.wan's avatar
zhanyong.wan committed
362
  bool name##MatcherP<p0##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
363
      GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
zhanyong.wan's avatar
zhanyong.wan committed
364
365
      ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
          const
zhanyong.wan's avatar
zhanyong.wan committed
366
367
368
369
370
371

#define MATCHER_P2(name, p0, p1, description)\
  template <typename p0##_type, typename p1##_type>\
  class name##MatcherP2 {\
   public:\
    template <typename arg_type>\
372
373
    class gmock_Impl : public ::testing::MatcherInterface<\
        GTEST_REFERENCE_TO_CONST_(arg_type)> {\
zhanyong.wan's avatar
zhanyong.wan committed
374
     public:\
375
      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1)\
Abseil Team's avatar
Abseil Team committed
376
           : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)) {}\
zhanyong.wan's avatar
zhanyong.wan committed
377
      virtual bool MatchAndExplain(\
378
379
          GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
          ::testing::MatchResultListener* result_listener) const;\
380
      virtual void DescribeTo(::std::ostream* gmock_os) const {\
381
382
383
384
        *gmock_os << FormatDescription(false);\
      }\
      virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
        *gmock_os << FormatDescription(true);\
zhanyong.wan's avatar
zhanyong.wan committed
385
      }\
386
387
      p0##_type const p0;\
      p1##_type const p1;\
388
     private:\
389
390
      ::std::string FormatDescription(bool negation) const {\
        ::std::string gmock_description = (description);\
391
        if (!gmock_description.empty()) {\
392
          return gmock_description;\
393
        }\
394
        return ::testing::internal::FormatMatcherDescription(\
395
            negation, #name, \
396
            ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
Abseil Team's avatar
Abseil Team committed
397
                ::std::tuple<p0##_type, p1##_type>(p0, p1)));\
398
      }\
zhanyong.wan's avatar
zhanyong.wan committed
399
400
401
    };\
    template <typename arg_type>\
    operator ::testing::Matcher<arg_type>() const {\
402
      return ::testing::Matcher<arg_type>(\
403
          new gmock_Impl<arg_type>(p0, p1));\
zhanyong.wan's avatar
zhanyong.wan committed
404
    }\
405
    name##MatcherP2(p0##_type gmock_p0, \
Abseil Team's avatar
Abseil Team committed
406
407
        p1##_type gmock_p1) : p0(::std::move(gmock_p0)), \
        p1(::std::move(gmock_p1)) {\
zhanyong.wan's avatar
zhanyong.wan committed
408
    }\
409
410
    p0##_type const p0;\
    p1##_type const p1;\
411
   private:\
zhanyong.wan's avatar
zhanyong.wan committed
412
413
414
415
416
417
418
419
  };\
  template <typename p0##_type, typename p1##_type>\
  inline name##MatcherP2<p0##_type, p1##_type> name(p0##_type p0, \
      p1##_type p1) {\
    return name##MatcherP2<p0##_type, p1##_type>(p0, p1);\
  }\
  template <typename p0##_type, typename p1##_type>\
  template <typename arg_type>\
zhanyong.wan's avatar
zhanyong.wan committed
420
421
  bool name##MatcherP2<p0##_type, \
      p1##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
422
      GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
zhanyong.wan's avatar
zhanyong.wan committed
423
424
      ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
          const
zhanyong.wan's avatar
zhanyong.wan committed
425
426
427
428
429
430

#define MATCHER_P3(name, p0, p1, p2, description)\
  template <typename p0##_type, typename p1##_type, typename p2##_type>\
  class name##MatcherP3 {\
   public:\
    template <typename arg_type>\
431
432
    class gmock_Impl : public ::testing::MatcherInterface<\
        GTEST_REFERENCE_TO_CONST_(arg_type)> {\
zhanyong.wan's avatar
zhanyong.wan committed
433
     public:\
434
      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2)\
Abseil Team's avatar
Abseil Team committed
435
436
           : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \
               p2(::std::move(gmock_p2)) {}\
zhanyong.wan's avatar
zhanyong.wan committed
437
      virtual bool MatchAndExplain(\
438
439
          GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
          ::testing::MatchResultListener* result_listener) const;\
440
      virtual void DescribeTo(::std::ostream* gmock_os) const {\
441
442
443
444
        *gmock_os << FormatDescription(false);\
      }\
      virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
        *gmock_os << FormatDescription(true);\
zhanyong.wan's avatar
zhanyong.wan committed
445
      }\
446
447
448
      p0##_type const p0;\
      p1##_type const p1;\
      p2##_type const p2;\
449
     private:\
450
451
      ::std::string FormatDescription(bool negation) const {\
        ::std::string gmock_description = (description);\
452
        if (!gmock_description.empty()) {\
453
          return gmock_description;\
454
        }\
455
        return ::testing::internal::FormatMatcherDescription(\
456
            negation, #name, \
457
            ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
Abseil Team's avatar
Abseil Team committed
458
                ::std::tuple<p0##_type, p1##_type, p2##_type>(p0, p1, p2)));\
459
      }\
zhanyong.wan's avatar
zhanyong.wan committed
460
461
462
    };\
    template <typename arg_type>\
    operator ::testing::Matcher<arg_type>() const {\
463
      return ::testing::Matcher<arg_type>(\
464
          new gmock_Impl<arg_type>(p0, p1, p2));\
zhanyong.wan's avatar
zhanyong.wan committed
465
466
    }\
    name##MatcherP3(p0##_type gmock_p0, p1##_type gmock_p1, \
Abseil Team's avatar
Abseil Team committed
467
468
        p2##_type gmock_p2) : p0(::std::move(gmock_p0)), \
        p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)) {\
zhanyong.wan's avatar
zhanyong.wan committed
469
    }\
470
471
472
    p0##_type const p0;\
    p1##_type const p1;\
    p2##_type const p2;\
473
   private:\
zhanyong.wan's avatar
zhanyong.wan committed
474
475
476
477
478
479
480
481
  };\
  template <typename p0##_type, typename p1##_type, typename p2##_type>\
  inline name##MatcherP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \
      p1##_type p1, p2##_type p2) {\
    return name##MatcherP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\
  }\
  template <typename p0##_type, typename p1##_type, typename p2##_type>\
  template <typename arg_type>\
zhanyong.wan's avatar
zhanyong.wan committed
482
483
  bool name##MatcherP3<p0##_type, p1##_type, \
      p2##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
484
      GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
zhanyong.wan's avatar
zhanyong.wan committed
485
486
      ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
          const
zhanyong.wan's avatar
zhanyong.wan committed
487
488
489
490
491
492
493

#define MATCHER_P4(name, p0, p1, p2, p3, description)\
  template <typename p0##_type, typename p1##_type, typename p2##_type, \
      typename p3##_type>\
  class name##MatcherP4 {\
   public:\
    template <typename arg_type>\
494
495
    class gmock_Impl : public ::testing::MatcherInterface<\
        GTEST_REFERENCE_TO_CONST_(arg_type)> {\
zhanyong.wan's avatar
zhanyong.wan committed
496
497
     public:\
      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
498
          p3##_type gmock_p3)\
Abseil Team's avatar
Abseil Team committed
499
500
           : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \
               p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)) {}\
zhanyong.wan's avatar
zhanyong.wan committed
501
      virtual bool MatchAndExplain(\
502
503
          GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
          ::testing::MatchResultListener* result_listener) const;\
504
      virtual void DescribeTo(::std::ostream* gmock_os) const {\
505
506
507
508
        *gmock_os << FormatDescription(false);\
      }\
      virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
        *gmock_os << FormatDescription(true);\
zhanyong.wan's avatar
zhanyong.wan committed
509
      }\
510
511
512
513
      p0##_type const p0;\
      p1##_type const p1;\
      p2##_type const p2;\
      p3##_type const p3;\
514
     private:\
515
516
      ::std::string FormatDescription(bool negation) const {\
        ::std::string gmock_description = (description);\
517
        if (!gmock_description.empty()) {\
518
          return gmock_description;\
519
        }\
520
        return ::testing::internal::FormatMatcherDescription(\
521
            negation, #name, \
522
            ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
Abseil Team's avatar
Abseil Team committed
523
524
                ::std::tuple<p0##_type, p1##_type, p2##_type, p3##_type>(p0, \
                    p1, p2, p3)));\
525
      }\
zhanyong.wan's avatar
zhanyong.wan committed
526
527
528
    };\
    template <typename arg_type>\
    operator ::testing::Matcher<arg_type>() const {\
529
      return ::testing::Matcher<arg_type>(\
530
          new gmock_Impl<arg_type>(p0, p1, p2, p3));\
zhanyong.wan's avatar
zhanyong.wan committed
531
532
    }\
    name##MatcherP4(p0##_type gmock_p0, p1##_type gmock_p1, \
Abseil Team's avatar
Abseil Team committed
533
534
535
        p2##_type gmock_p2, p3##_type gmock_p3) : p0(::std::move(gmock_p0)), \
        p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
        p3(::std::move(gmock_p3)) {\
zhanyong.wan's avatar
zhanyong.wan committed
536
    }\
537
538
539
540
    p0##_type const p0;\
    p1##_type const p1;\
    p2##_type const p2;\
    p3##_type const p3;\
541
   private:\
zhanyong.wan's avatar
zhanyong.wan committed
542
543
544
545
546
547
548
549
550
551
552
553
  };\
  template <typename p0##_type, typename p1##_type, typename p2##_type, \
      typename p3##_type>\
  inline name##MatcherP4<p0##_type, p1##_type, p2##_type, \
      p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
      p3##_type p3) {\
    return name##MatcherP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, \
        p1, p2, p3);\
  }\
  template <typename p0##_type, typename p1##_type, typename p2##_type, \
      typename p3##_type>\
  template <typename arg_type>\
zhanyong.wan's avatar
zhanyong.wan committed
554
555
  bool name##MatcherP4<p0##_type, p1##_type, p2##_type, \
      p3##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
556
      GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
zhanyong.wan's avatar
zhanyong.wan committed
557
558
      ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
          const
zhanyong.wan's avatar
zhanyong.wan committed
559
560
561
562
563
564
565

#define MATCHER_P5(name, p0, p1, p2, p3, p4, description)\
  template <typename p0##_type, typename p1##_type, typename p2##_type, \
      typename p3##_type, typename p4##_type>\
  class name##MatcherP5 {\
   public:\
    template <typename arg_type>\
566
567
    class gmock_Impl : public ::testing::MatcherInterface<\
        GTEST_REFERENCE_TO_CONST_(arg_type)> {\
zhanyong.wan's avatar
zhanyong.wan committed
568
569
     public:\
      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
570
          p3##_type gmock_p3, p4##_type gmock_p4)\
Abseil Team's avatar
Abseil Team committed
571
572
573
           : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \
               p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \
               p4(::std::move(gmock_p4)) {}\
zhanyong.wan's avatar
zhanyong.wan committed
574
      virtual bool MatchAndExplain(\
575
576
          GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
          ::testing::MatchResultListener* result_listener) const;\
577
      virtual void DescribeTo(::std::ostream* gmock_os) const {\
578
579
580
581
        *gmock_os << FormatDescription(false);\
      }\
      virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
        *gmock_os << FormatDescription(true);\
zhanyong.wan's avatar
zhanyong.wan committed
582
      }\
583
584
585
586
587
      p0##_type const p0;\
      p1##_type const p1;\
      p2##_type const p2;\
      p3##_type const p3;\
      p4##_type const p4;\
588
     private:\
589
590
      ::std::string FormatDescription(bool negation) const {\
        ::std::string gmock_description = (description);\
591
        if (!gmock_description.empty()) {\
592
          return gmock_description;\
593
        }\
594
        return ::testing::internal::FormatMatcherDescription(\
595
            negation, #name, \
596
            ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
Abseil Team's avatar
Abseil Team committed
597
                ::std::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
598
599
                    p4##_type>(p0, p1, p2, p3, p4)));\
      }\
zhanyong.wan's avatar
zhanyong.wan committed
600
601
602
    };\
    template <typename arg_type>\
    operator ::testing::Matcher<arg_type>() const {\
603
      return ::testing::Matcher<arg_type>(\
604
          new gmock_Impl<arg_type>(p0, p1, p2, p3, p4));\
zhanyong.wan's avatar
zhanyong.wan committed
605
606
607
    }\
    name##MatcherP5(p0##_type gmock_p0, p1##_type gmock_p1, \
        p2##_type gmock_p2, p3##_type gmock_p3, \
Abseil Team's avatar
Abseil Team committed
608
609
610
        p4##_type gmock_p4) : p0(::std::move(gmock_p0)), \
        p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
        p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)) {\
zhanyong.wan's avatar
zhanyong.wan committed
611
    }\
612
613
614
615
616
    p0##_type const p0;\
    p1##_type const p1;\
    p2##_type const p2;\
    p3##_type const p3;\
    p4##_type const p4;\
617
   private:\
zhanyong.wan's avatar
zhanyong.wan committed
618
619
620
621
622
623
624
625
626
627
628
629
  };\
  template <typename p0##_type, typename p1##_type, typename p2##_type, \
      typename p3##_type, typename p4##_type>\
  inline name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \
      p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
      p4##_type p4) {\
    return name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \
        p4##_type>(p0, p1, p2, p3, p4);\
  }\
  template <typename p0##_type, typename p1##_type, typename p2##_type, \
      typename p3##_type, typename p4##_type>\
  template <typename arg_type>\
zhanyong.wan's avatar
zhanyong.wan committed
630
631
  bool name##MatcherP5<p0##_type, p1##_type, p2##_type, p3##_type, \
      p4##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
632
      GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
zhanyong.wan's avatar
zhanyong.wan committed
633
634
      ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
          const
zhanyong.wan's avatar
zhanyong.wan committed
635
636
637
638
639
640
641

#define MATCHER_P6(name, p0, p1, p2, p3, p4, p5, description)\
  template <typename p0##_type, typename p1##_type, typename p2##_type, \
      typename p3##_type, typename p4##_type, typename p5##_type>\
  class name##MatcherP6 {\
   public:\
    template <typename arg_type>\
642
643
    class gmock_Impl : public ::testing::MatcherInterface<\
        GTEST_REFERENCE_TO_CONST_(arg_type)> {\
zhanyong.wan's avatar
zhanyong.wan committed
644
645
     public:\
      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
646
          p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5)\
Abseil Team's avatar
Abseil Team committed
647
648
649
           : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \
               p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \
               p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)) {}\
zhanyong.wan's avatar
zhanyong.wan committed
650
      virtual bool MatchAndExplain(\
651
652
          GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
          ::testing::MatchResultListener* result_listener) const;\
653
      virtual void DescribeTo(::std::ostream* gmock_os) const {\
654
655
656
657
        *gmock_os << FormatDescription(false);\
      }\
      virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
        *gmock_os << FormatDescription(true);\
zhanyong.wan's avatar
zhanyong.wan committed
658
      }\
659
660
661
662
663
664
      p0##_type const p0;\
      p1##_type const p1;\
      p2##_type const p2;\
      p3##_type const p3;\
      p4##_type const p4;\
      p5##_type const p5;\
665
     private:\
666
667
      ::std::string FormatDescription(bool negation) const {\
        ::std::string gmock_description = (description);\
668
        if (!gmock_description.empty()) {\
669
          return gmock_description;\
670
        }\
671
        return ::testing::internal::FormatMatcherDescription(\
672
            negation, #name, \
673
            ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
Abseil Team's avatar
Abseil Team committed
674
                ::std::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
675
676
                    p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5)));\
      }\
zhanyong.wan's avatar
zhanyong.wan committed
677
678
679
    };\
    template <typename arg_type>\
    operator ::testing::Matcher<arg_type>() const {\
680
      return ::testing::Matcher<arg_type>(\
681
          new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5));\
zhanyong.wan's avatar
zhanyong.wan committed
682
683
684
    }\
    name##MatcherP6(p0##_type gmock_p0, p1##_type gmock_p1, \
        p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
Abseil Team's avatar
Abseil Team committed
685
686
687
688
        p5##_type gmock_p5) : p0(::std::move(gmock_p0)), \
        p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
        p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \
        p5(::std::move(gmock_p5)) {\
zhanyong.wan's avatar
zhanyong.wan committed
689
    }\
690
691
692
693
694
695
    p0##_type const p0;\
    p1##_type const p1;\
    p2##_type const p2;\
    p3##_type const p3;\
    p4##_type const p4;\
    p5##_type const p5;\
696
   private:\
zhanyong.wan's avatar
zhanyong.wan committed
697
698
699
700
701
702
703
704
705
706
707
708
709
  };\
  template <typename p0##_type, typename p1##_type, typename p2##_type, \
      typename p3##_type, typename p4##_type, typename p5##_type>\
  inline name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, \
      p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \
      p3##_type p3, p4##_type p4, p5##_type p5) {\
    return name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, \
        p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\
  }\
  template <typename p0##_type, typename p1##_type, typename p2##_type, \
      typename p3##_type, typename p4##_type, typename p5##_type>\
  template <typename arg_type>\
  bool name##MatcherP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
zhanyong.wan's avatar
zhanyong.wan committed
710
      p5##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
711
      GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
zhanyong.wan's avatar
zhanyong.wan committed
712
713
      ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
          const
zhanyong.wan's avatar
zhanyong.wan committed
714
715
716
717
718
719
720
721

#define MATCHER_P7(name, p0, p1, p2, p3, p4, p5, p6, description)\
  template <typename p0##_type, typename p1##_type, typename p2##_type, \
      typename p3##_type, typename p4##_type, typename p5##_type, \
      typename p6##_type>\
  class name##MatcherP7 {\
   public:\
    template <typename arg_type>\
722
723
    class gmock_Impl : public ::testing::MatcherInterface<\
        GTEST_REFERENCE_TO_CONST_(arg_type)> {\
zhanyong.wan's avatar
zhanyong.wan committed
724
725
726
     public:\
      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
          p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
727
          p6##_type gmock_p6)\
Abseil Team's avatar
Abseil Team committed
728
729
730
731
           : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \
               p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \
               p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)), \
               p6(::std::move(gmock_p6)) {}\
zhanyong.wan's avatar
zhanyong.wan committed
732
      virtual bool MatchAndExplain(\
733
734
          GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
          ::testing::MatchResultListener* result_listener) const;\
735
      virtual void DescribeTo(::std::ostream* gmock_os) const {\
736
737
738
739
        *gmock_os << FormatDescription(false);\
      }\
      virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
        *gmock_os << FormatDescription(true);\
zhanyong.wan's avatar
zhanyong.wan committed
740
      }\
741
742
743
744
745
746
747
      p0##_type const p0;\
      p1##_type const p1;\
      p2##_type const p2;\
      p3##_type const p3;\
      p4##_type const p4;\
      p5##_type const p5;\
      p6##_type const p6;\
748
     private:\
749
750
      ::std::string FormatDescription(bool negation) const {\
        ::std::string gmock_description = (description);\
751
        if (!gmock_description.empty()) {\
752
          return gmock_description;\
753
        }\
754
        return ::testing::internal::FormatMatcherDescription(\
755
            negation, #name, \
756
            ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
Abseil Team's avatar
Abseil Team committed
757
                ::std::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
758
759
760
                    p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, \
                    p6)));\
      }\
zhanyong.wan's avatar
zhanyong.wan committed
761
762
763
    };\
    template <typename arg_type>\
    operator ::testing::Matcher<arg_type>() const {\
764
      return ::testing::Matcher<arg_type>(\
765
          new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6));\
zhanyong.wan's avatar
zhanyong.wan committed
766
767
768
    }\
    name##MatcherP7(p0##_type gmock_p0, p1##_type gmock_p1, \
        p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
Abseil Team's avatar
Abseil Team committed
769
770
771
772
        p5##_type gmock_p5, p6##_type gmock_p6) : p0(::std::move(gmock_p0)), \
        p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
        p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \
        p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)) {\
zhanyong.wan's avatar
zhanyong.wan committed
773
    }\
774
775
776
777
778
779
780
    p0##_type const p0;\
    p1##_type const p1;\
    p2##_type const p2;\
    p3##_type const p3;\
    p4##_type const p4;\
    p5##_type const p5;\
    p6##_type const p6;\
781
   private:\
zhanyong.wan's avatar
zhanyong.wan committed
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
  };\
  template <typename p0##_type, typename p1##_type, typename p2##_type, \
      typename p3##_type, typename p4##_type, typename p5##_type, \
      typename p6##_type>\
  inline name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, \
      p4##_type, p5##_type, p6##_type> name(p0##_type p0, p1##_type p1, \
      p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
      p6##_type p6) {\
    return name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, \
        p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\
  }\
  template <typename p0##_type, typename p1##_type, typename p2##_type, \
      typename p3##_type, typename p4##_type, typename p5##_type, \
      typename p6##_type>\
  template <typename arg_type>\
  bool name##MatcherP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
zhanyong.wan's avatar
zhanyong.wan committed
798
      p5##_type, p6##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
799
      GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
zhanyong.wan's avatar
zhanyong.wan committed
800
801
      ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
          const
zhanyong.wan's avatar
zhanyong.wan committed
802
803
804
805
806
807
808
809

#define MATCHER_P8(name, p0, p1, p2, p3, p4, p5, p6, p7, description)\
  template <typename p0##_type, typename p1##_type, typename p2##_type, \
      typename p3##_type, typename p4##_type, typename p5##_type, \
      typename p6##_type, typename p7##_type>\
  class name##MatcherP8 {\
   public:\
    template <typename arg_type>\
810
811
    class gmock_Impl : public ::testing::MatcherInterface<\
        GTEST_REFERENCE_TO_CONST_(arg_type)> {\
zhanyong.wan's avatar
zhanyong.wan committed
812
813
814
     public:\
      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
          p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
815
          p6##_type gmock_p6, p7##_type gmock_p7)\
Abseil Team's avatar
Abseil Team committed
816
817
818
819
           : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \
               p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \
               p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)), \
               p6(::std::move(gmock_p6)), p7(::std::move(gmock_p7)) {}\
zhanyong.wan's avatar
zhanyong.wan committed
820
      virtual bool MatchAndExplain(\
821
822
          GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
          ::testing::MatchResultListener* result_listener) const;\
823
      virtual void DescribeTo(::std::ostream* gmock_os) const {\
824
825
826
827
        *gmock_os << FormatDescription(false);\
      }\
      virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
        *gmock_os << FormatDescription(true);\
zhanyong.wan's avatar
zhanyong.wan committed
828
      }\
829
830
831
832
833
834
835
836
      p0##_type const p0;\
      p1##_type const p1;\
      p2##_type const p2;\
      p3##_type const p3;\
      p4##_type const p4;\
      p5##_type const p5;\
      p6##_type const p6;\
      p7##_type const p7;\
837
     private:\
838
839
      ::std::string FormatDescription(bool negation) const {\
        ::std::string gmock_description = (description);\
840
        if (!gmock_description.empty()) {\
841
          return gmock_description;\
842
        }\
843
        return ::testing::internal::FormatMatcherDescription(\
844
            negation, #name, \
845
            ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
Abseil Team's avatar
Abseil Team committed
846
                ::std::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
847
848
849
                    p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, \
                    p3, p4, p5, p6, p7)));\
      }\
zhanyong.wan's avatar
zhanyong.wan committed
850
851
852
    };\
    template <typename arg_type>\
    operator ::testing::Matcher<arg_type>() const {\
853
      return ::testing::Matcher<arg_type>(\
854
          new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7));\
zhanyong.wan's avatar
zhanyong.wan committed
855
856
857
858
    }\
    name##MatcherP8(p0##_type gmock_p0, p1##_type gmock_p1, \
        p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
        p5##_type gmock_p5, p6##_type gmock_p6, \
Abseil Team's avatar
Abseil Team committed
859
860
861
862
863
        p7##_type gmock_p7) : p0(::std::move(gmock_p0)), \
        p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
        p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \
        p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)), \
        p7(::std::move(gmock_p7)) {\
zhanyong.wan's avatar
zhanyong.wan committed
864
    }\
865
866
867
868
869
870
871
872
    p0##_type const p0;\
    p1##_type const p1;\
    p2##_type const p2;\
    p3##_type const p3;\
    p4##_type const p4;\
    p5##_type const p5;\
    p6##_type const p6;\
    p7##_type const p7;\
873
   private:\
zhanyong.wan's avatar
zhanyong.wan committed
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
  };\
  template <typename p0##_type, typename p1##_type, typename p2##_type, \
      typename p3##_type, typename p4##_type, typename p5##_type, \
      typename p6##_type, typename p7##_type>\
  inline name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, \
      p4##_type, p5##_type, p6##_type, p7##_type> name(p0##_type p0, \
      p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \
      p6##_type p6, p7##_type p7) {\
    return name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, \
        p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \
        p6, p7);\
  }\
  template <typename p0##_type, typename p1##_type, typename p2##_type, \
      typename p3##_type, typename p4##_type, typename p5##_type, \
      typename p6##_type, typename p7##_type>\
  template <typename arg_type>\
  bool name##MatcherP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
zhanyong.wan's avatar
zhanyong.wan committed
891
892
      p5##_type, p6##_type, \
      p7##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
893
      GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
zhanyong.wan's avatar
zhanyong.wan committed
894
895
      ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
          const
zhanyong.wan's avatar
zhanyong.wan committed
896
897
898
899
900
901
902
903

#define MATCHER_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, description)\
  template <typename p0##_type, typename p1##_type, typename p2##_type, \
      typename p3##_type, typename p4##_type, typename p5##_type, \
      typename p6##_type, typename p7##_type, typename p8##_type>\
  class name##MatcherP9 {\
   public:\
    template <typename arg_type>\
904
905
    class gmock_Impl : public ::testing::MatcherInterface<\
        GTEST_REFERENCE_TO_CONST_(arg_type)> {\
zhanyong.wan's avatar
zhanyong.wan committed
906
907
908
     public:\
      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
          p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
909
          p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8)\
Abseil Team's avatar
Abseil Team committed
910
911
912
913
914
           : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \
               p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \
               p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)), \
               p6(::std::move(gmock_p6)), p7(::std::move(gmock_p7)), \
               p8(::std::move(gmock_p8)) {}\
zhanyong.wan's avatar
zhanyong.wan committed
915
      virtual bool MatchAndExplain(\
916
917
          GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
          ::testing::MatchResultListener* result_listener) const;\
918
      virtual void DescribeTo(::std::ostream* gmock_os) const {\
919
920
921
922
        *gmock_os << FormatDescription(false);\
      }\
      virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
        *gmock_os << FormatDescription(true);\
zhanyong.wan's avatar
zhanyong.wan committed
923
      }\
924
925
926
927
928
929
930
931
932
      p0##_type const p0;\
      p1##_type const p1;\
      p2##_type const p2;\
      p3##_type const p3;\
      p4##_type const p4;\
      p5##_type const p5;\
      p6##_type const p6;\
      p7##_type const p7;\
      p8##_type const p8;\
933
     private:\
934
935
      ::std::string FormatDescription(bool negation) const {\
        ::std::string gmock_description = (description);\
936
        if (!gmock_description.empty()) {\
937
          return gmock_description;\
938
        }\
939
        return ::testing::internal::FormatMatcherDescription(\
940
            negation, #name, \
941
            ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
Abseil Team's avatar
Abseil Team committed
942
                ::std::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
943
944
945
                    p4##_type, p5##_type, p6##_type, p7##_type, \
                    p8##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8)));\
      }\
zhanyong.wan's avatar
zhanyong.wan committed
946
947
948
    };\
    template <typename arg_type>\
    operator ::testing::Matcher<arg_type>() const {\
949
      return ::testing::Matcher<arg_type>(\
950
          new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8));\
zhanyong.wan's avatar
zhanyong.wan committed
951
952
953
954
    }\
    name##MatcherP9(p0##_type gmock_p0, p1##_type gmock_p1, \
        p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
        p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
Abseil Team's avatar
Abseil Team committed
955
956
957
958
959
        p8##_type gmock_p8) : p0(::std::move(gmock_p0)), \
        p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
        p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \
        p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)), \
        p7(::std::move(gmock_p7)), p8(::std::move(gmock_p8)) {\
zhanyong.wan's avatar
zhanyong.wan committed
960
    }\
961
962
963
964
965
966
967
968
969
    p0##_type const p0;\
    p1##_type const p1;\
    p2##_type const p2;\
    p3##_type const p3;\
    p4##_type const p4;\
    p5##_type const p5;\
    p6##_type const p6;\
    p7##_type const p7;\
    p8##_type const p8;\
970
   private:\
zhanyong.wan's avatar
zhanyong.wan committed
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
  };\
  template <typename p0##_type, typename p1##_type, typename p2##_type, \
      typename p3##_type, typename p4##_type, typename p5##_type, \
      typename p6##_type, typename p7##_type, typename p8##_type>\
  inline name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, \
      p4##_type, p5##_type, p6##_type, p7##_type, \
      p8##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
      p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \
      p8##_type p8) {\
    return name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, \
        p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \
        p3, p4, p5, p6, p7, p8);\
  }\
  template <typename p0##_type, typename p1##_type, typename p2##_type, \
      typename p3##_type, typename p4##_type, typename p5##_type, \
      typename p6##_type, typename p7##_type, typename p8##_type>\
  template <typename arg_type>\
  bool name##MatcherP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \
zhanyong.wan's avatar
zhanyong.wan committed
989
990
      p5##_type, p6##_type, p7##_type, \
      p8##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
991
      GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
zhanyong.wan's avatar
zhanyong.wan committed
992
993
      ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
          const
zhanyong.wan's avatar
zhanyong.wan committed
994
995
996
997
998
999
1000
1001
1002

#define MATCHER_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, description)\
  template <typename p0##_type, typename p1##_type, typename p2##_type, \
      typename p3##_type, typename p4##_type, typename p5##_type, \
      typename p6##_type, typename p7##_type, typename p8##_type, \
      typename p9##_type>\
  class name##MatcherP10 {\
   public:\
    template <typename arg_type>\
1003
1004
    class gmock_Impl : public ::testing::MatcherInterface<\
        GTEST_REFERENCE_TO_CONST_(arg_type)> {\
zhanyong.wan's avatar
zhanyong.wan committed
1005
1006
1007
1008
     public:\
      gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
          p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
          p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
1009
          p9##_type gmock_p9)\
Abseil Team's avatar
Abseil Team committed
1010
1011
1012
1013
1014
           : p0(::std::move(gmock_p0)), p1(::std::move(gmock_p1)), \
               p2(::std::move(gmock_p2)), p3(::std::move(gmock_p3)), \
               p4(::std::move(gmock_p4)), p5(::std::move(gmock_p5)), \
               p6(::std::move(gmock_p6)), p7(::std::move(gmock_p7)), \
               p8(::std::move(gmock_p8)), p9(::std::move(gmock_p9)) {}\
zhanyong.wan's avatar
zhanyong.wan committed
1015
      virtual bool MatchAndExplain(\
1016
1017
          GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
          ::testing::MatchResultListener* result_listener) const;\
1018
      virtual void DescribeTo(::std::ostream* gmock_os) const {\
1019
1020
1021
1022
        *gmock_os << FormatDescription(false);\
      }\
      virtual void DescribeNegationTo(::std::ostream* gmock_os) const {\
        *gmock_os << FormatDescription(true);\
zhanyong.wan's avatar
zhanyong.wan committed
1023
      }\
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
      p0##_type const p0;\
      p1##_type const p1;\
      p2##_type const p2;\
      p3##_type const p3;\
      p4##_type const p4;\
      p5##_type const p5;\
      p6##_type const p6;\
      p7##_type const p7;\
      p8##_type const p8;\
      p9##_type const p9;\
1034
     private:\
1035
1036
      ::std::string FormatDescription(bool negation) const {\
        ::std::string gmock_description = (description);\
1037
        if (!gmock_description.empty()) {\
1038
          return gmock_description;\
1039
        }\
1040
        return ::testing::internal::FormatMatcherDescription(\
1041
            negation, #name, \
1042
            ::testing::internal::UniversalTersePrintTupleFieldsToStrings(\
Abseil Team's avatar
Abseil Team committed
1043
                ::std::tuple<p0##_type, p1##_type, p2##_type, p3##_type, \
1044
1045
1046
                    p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
                    p9##_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)));\
      }\
zhanyong.wan's avatar
zhanyong.wan committed
1047
1048
1049
    };\
    template <typename arg_type>\
    operator ::testing::Matcher<arg_type>() const {\
1050
      return ::testing::Matcher<arg_type>(\
1051
          new gmock_Impl<arg_type>(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9));\
zhanyong.wan's avatar
zhanyong.wan committed
1052
1053
1054
1055
    }\
    name##MatcherP10(p0##_type gmock_p0, p1##_type gmock_p1, \
        p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
        p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
Abseil Team's avatar
Abseil Team committed
1056
1057
1058
1059
1060
1061
        p8##_type gmock_p8, p9##_type gmock_p9) : p0(::std::move(gmock_p0)), \
        p1(::std::move(gmock_p1)), p2(::std::move(gmock_p2)), \
        p3(::std::move(gmock_p3)), p4(::std::move(gmock_p4)), \
        p5(::std::move(gmock_p5)), p6(::std::move(gmock_p6)), \
        p7(::std::move(gmock_p7)), p8(::std::move(gmock_p8)), \
        p9(::std::move(gmock_p9)) {\
zhanyong.wan's avatar
zhanyong.wan committed
1062
    }\
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
    p0##_type const p0;\
    p1##_type const p1;\
    p2##_type const p2;\
    p3##_type const p3;\
    p4##_type const p4;\
    p5##_type const p5;\
    p6##_type const p6;\
    p7##_type const p7;\
    p8##_type const p8;\
    p9##_type const p9;\
1073
   private:\
zhanyong.wan's avatar
zhanyong.wan committed
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
  };\
  template <typename p0##_type, typename p1##_type, typename p2##_type, \
      typename p3##_type, typename p4##_type, typename p5##_type, \
      typename p6##_type, typename p7##_type, typename p8##_type, \
      typename p9##_type>\
  inline name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \
      p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
      p9##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \
      p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \
      p9##_type p9) {\
    return name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \
        p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \
        p1, p2, p3, p4, p5, p6, p7, p8, p9);\
  }\
  template <typename p0##_type, typename p1##_type, typename p2##_type, \
      typename p3##_type, typename p4##_type, typename p5##_type, \
      typename p6##_type, typename p7##_type, typename p8##_type, \
      typename p9##_type>\
  template <typename arg_type>\
  bool name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \
zhanyong.wan's avatar
zhanyong.wan committed
1094
1095
      p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \
      p9##_type>::gmock_Impl<arg_type>::MatchAndExplain(\
1096
      GTEST_REFERENCE_TO_CONST_(arg_type) arg,\
zhanyong.wan's avatar
zhanyong.wan committed
1097
1098
      ::testing::MatchResultListener* result_listener GTEST_ATTRIBUTE_UNUSED_)\
          const
zhanyong.wan's avatar
zhanyong.wan committed
1099

1100
#endif  // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_