gmock-generated-function-mockers.h 29.4 KB
Newer Older
1
2
3
// This file was GENERATED by command:
//     pump.py gmock-generated-function-mockers.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

// Copyright 2007, 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.
Gennadiy Civil's avatar
 
Gennadiy Civil committed
33

34
35
36
37
38

// Google Mock - a framework for writing C++ mock classes.
//
// This file implements function mockers of various arities.

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

41
42
43
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_

Abseil Team's avatar
Abseil Team committed
44
#include <functional>
Abseil Team's avatar
Abseil Team committed
45
46
#include <utility>

47
48
#include "gmock/gmock-spec-builders.h"
#include "gmock/internal/gmock-internal-utils.h"
49
50
51

namespace testing {
namespace internal {
Gennadiy Civil's avatar
 
Gennadiy Civil committed
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Removes the given pointer; this is a helper for the expectation setter method
// for parameterless matchers.
//
// We want to make sure that the user cannot set a parameterless expectation on
// overloaded methods, including methods which are overloaded on const. Example:
//
//   class MockClass {
//     MOCK_METHOD0(GetName, string&());
//     MOCK_CONST_METHOD0(GetName, const string&());
//   };
//
//   TEST() {
//     // This should be an error, as it's not clear which overload is expected.
//     EXPECT_CALL(mock, GetName).WillOnce(ReturnRef(value));
//   }
//
// Here are the generated expectation-setter methods:
//
//   class MockClass {
//     // Overload 1
72
//     MockSpec<string&()> gmock_GetName() { ... }
Gennadiy Civil's avatar
 
Gennadiy Civil committed
73
74
75
76
//     // Overload 2. Declared const so that the compiler will generate an
//     // error when trying to resolve between this and overload 4 in
//     // 'gmock_GetName(WithoutMatchers(), nullptr)'.
//     MockSpec<string&()> gmock_GetName(
77
//         const WithoutMatchers&, const Function<string&()>*) const {
Gennadiy Civil's avatar
 
Gennadiy Civil committed
78
79
80
81
82
//       // Removes const from this, calls overload 1
//       return AdjustConstness_(this)->gmock_GetName();
//     }
//
//     // Overload 3
83
//     const string& gmock_GetName() const { ... }
Gennadiy Civil's avatar
 
Gennadiy Civil committed
84
85
//     // Overload 4
//     MockSpec<const string&()> gmock_GetName(
86
//         const WithoutMatchers&, const Function<const string&()>*) const {
Gennadiy Civil's avatar
 
Gennadiy Civil committed
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
//       // Does not remove const, calls overload 3
//       return AdjustConstness_const(this)->gmock_GetName();
//     }
//   }
//
template <typename MockType>
const MockType* AdjustConstness_const(const MockType* mock) {
  return mock;
}

// Removes const from and returns the given pointer; this is a helper for the
// expectation setter method for parameterless matchers.
template <typename MockType>
MockType* AdjustConstness_(const MockType* mock) {
  return const_cast<MockType*>(mock);
}

104
105
106
107
108
109
110
111
112
}  // namespace internal

// The style guide prohibits "using" statements in a namespace scope
// inside a header file.  However, the FunctionMocker class template
// is meant to be defined in the ::testing namespace.  The following
// line is just a trick for working around a bug in MSVC 8.0, which
// cannot handle it if we define FunctionMocker in ::testing.
using internal::FunctionMocker;

113
114
115
116
// GMOCK_RESULT_(tn, F) expands to the result type of function type F.
// We define this as a variadic macro in case F contains unprotected
// commas (the same reason that we use variadic macros in other places
// in this file).
117
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
Abseil Team's avatar
Abseil Team committed
118
119
#define GMOCK_RESULT_(...) \
    typename ::testing::internal::Function<__VA_ARGS__>::Result
120

121
// The type of argument N of the given function type.
122
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
Abseil Team's avatar
Abseil Team committed
123
124
#define GMOCK_ARG_(N, ...) \
    typename ::testing::internal::Function<__VA_ARGS__>::template Arg<N-1>::type
125

126
// The matcher type for argument N of the given function type.
127
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
Abseil Team's avatar
Abseil Team committed
128
129
#define GMOCK_MATCHER_(N, ...) \
    const ::testing::Matcher<GMOCK_ARG_(N, __VA_ARGS__)>&
130
131
132

// The variable for mocking the given method.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
133
#define GMOCK_MOCKER_(arity, constness, Method) \
134
    GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__)
135
136

// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
Abseil Team's avatar
Abseil Team committed
137
#define GMOCK_METHOD0_(constness, ct, Method, ...) \
Abseil Team's avatar
Abseil Team committed
138
139
140
  static_assert(0 == \
      ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \
      "MOCK_METHOD<N> must match argument count.");\
Abseil Team's avatar
Abseil Team committed
141
  GMOCK_RESULT_(__VA_ARGS__) ct Method( \
Abseil Team's avatar
Abseil Team committed
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
      ) constness { \
    GMOCK_MOCKER_(0, constness, Method).SetOwnerAndName(this, #Method); \
    return GMOCK_MOCKER_(0, constness, Method).Invoke(); \
  } \
  ::testing::MockSpec<__VA_ARGS__> \
      gmock_##Method() constness { \
    GMOCK_MOCKER_(0, constness, Method).RegisterOwner(this); \
    return GMOCK_MOCKER_(0, constness, Method).With(); \
  } \
  ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
      const ::testing::internal::WithoutMatchers&, \
      constness ::testing::internal::Function<__VA_ARGS__>* ) const { \
        return ::testing::internal::AdjustConstness_##constness(this)-> \
            gmock_##Method(); \
      } \
157
  mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(0, constness, \
Abseil Team's avatar
Abseil Team committed
158
      Method)
159
160

// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
Abseil Team's avatar
Abseil Team committed
161
#define GMOCK_METHOD1_(constness, ct, Method, ...) \
Abseil Team's avatar
Abseil Team committed
162
163
164
  static_assert(1 == \
      ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \
      "MOCK_METHOD<N> must match argument count.");\
Abseil Team's avatar
Abseil Team committed
165
166
  GMOCK_RESULT_(__VA_ARGS__) ct Method( \
      GMOCK_ARG_(1, __VA_ARGS__) gmock_a1) constness { \
Abseil Team's avatar
Abseil Team committed
167
168
    GMOCK_MOCKER_(1, constness, Method).SetOwnerAndName(this, #Method); \
    return GMOCK_MOCKER_(1, constness, \
Abseil Team's avatar
Abseil Team committed
169
170
        Method).Invoke(::std::forward<GMOCK_ARG_(1, __VA_ARGS__)>(gmock_a1)); \
        \
Abseil Team's avatar
Abseil Team committed
171
172
  } \
  ::testing::MockSpec<__VA_ARGS__> \
Abseil Team's avatar
Abseil Team committed
173
      gmock_##Method(GMOCK_MATCHER_(1, __VA_ARGS__) gmock_a1) constness { \
Abseil Team's avatar
Abseil Team committed
174
175
176
177
178
179
180
    GMOCK_MOCKER_(1, constness, Method).RegisterOwner(this); \
    return GMOCK_MOCKER_(1, constness, Method).With(gmock_a1); \
  } \
  ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
      const ::testing::internal::WithoutMatchers&, \
      constness ::testing::internal::Function<__VA_ARGS__>* ) const { \
        return ::testing::internal::AdjustConstness_##constness(this)-> \
Abseil Team's avatar
Abseil Team committed
181
            gmock_##Method(::testing::A<GMOCK_ARG_(1, __VA_ARGS__)>()); \
Abseil Team's avatar
Abseil Team committed
182
183
184
      } \
  mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(1, constness, \
      Method)
185
186

// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
Abseil Team's avatar
Abseil Team committed
187
#define GMOCK_METHOD2_(constness, ct, Method, ...) \
Abseil Team's avatar
Abseil Team committed
188
189
190
  static_assert(2 == \
      ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \
      "MOCK_METHOD<N> must match argument count.");\
Abseil Team's avatar
Abseil Team committed
191
192
  GMOCK_RESULT_(__VA_ARGS__) ct Method( \
      GMOCK_ARG_(1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(2, \
Abseil Team's avatar
Abseil Team committed
193
194
195
          __VA_ARGS__) gmock_a2) constness { \
    GMOCK_MOCKER_(2, constness, Method).SetOwnerAndName(this, #Method); \
    return GMOCK_MOCKER_(2, constness, \
Abseil Team's avatar
Abseil Team committed
196
197
198
        Method).Invoke(::std::forward<GMOCK_ARG_(1, __VA_ARGS__)>(gmock_a1), \
        \
  ::std::forward<GMOCK_ARG_(2, __VA_ARGS__)>(gmock_a2)); \
Abseil Team's avatar
Abseil Team committed
199
200
  } \
  ::testing::MockSpec<__VA_ARGS__> \
Abseil Team's avatar
Abseil Team committed
201
202
      gmock_##Method(GMOCK_MATCHER_(1, __VA_ARGS__) gmock_a1, \
                     GMOCK_MATCHER_(2, __VA_ARGS__) gmock_a2) constness { \
Abseil Team's avatar
Abseil Team committed
203
204
205
206
207
208
209
    GMOCK_MOCKER_(2, constness, Method).RegisterOwner(this); \
    return GMOCK_MOCKER_(2, constness, Method).With(gmock_a1, gmock_a2); \
  } \
  ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
      const ::testing::internal::WithoutMatchers&, \
      constness ::testing::internal::Function<__VA_ARGS__>* ) const { \
        return ::testing::internal::AdjustConstness_##constness(this)-> \
Abseil Team's avatar
Abseil Team committed
210
211
            gmock_##Method(::testing::A<GMOCK_ARG_(1, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(2, __VA_ARGS__)>()); \
Abseil Team's avatar
Abseil Team committed
212
213
214
      } \
  mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(2, constness, \
      Method)
215
216

// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
Abseil Team's avatar
Abseil Team committed
217
#define GMOCK_METHOD3_(constness, ct, Method, ...) \
Abseil Team's avatar
Abseil Team committed
218
219
220
  static_assert(3 == \
      ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \
      "MOCK_METHOD<N> must match argument count.");\
Abseil Team's avatar
Abseil Team committed
221
222
223
  GMOCK_RESULT_(__VA_ARGS__) ct Method( \
      GMOCK_ARG_(1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(2, \
          __VA_ARGS__) gmock_a2, GMOCK_ARG_(3, \
Abseil Team's avatar
Abseil Team committed
224
225
226
          __VA_ARGS__) gmock_a3) constness { \
    GMOCK_MOCKER_(3, constness, Method).SetOwnerAndName(this, #Method); \
    return GMOCK_MOCKER_(3, constness, \
Abseil Team's avatar
Abseil Team committed
227
228
229
230
        Method).Invoke(::std::forward<GMOCK_ARG_(1, __VA_ARGS__)>(gmock_a1), \
        \
  ::std::forward<GMOCK_ARG_(2, __VA_ARGS__)>(gmock_a2), \
  ::std::forward<GMOCK_ARG_(3, __VA_ARGS__)>(gmock_a3)); \
Abseil Team's avatar
Abseil Team committed
231
232
  } \
  ::testing::MockSpec<__VA_ARGS__> \
Abseil Team's avatar
Abseil Team committed
233
234
235
      gmock_##Method(GMOCK_MATCHER_(1, __VA_ARGS__) gmock_a1, \
                     GMOCK_MATCHER_(2, __VA_ARGS__) gmock_a2, \
                     GMOCK_MATCHER_(3, __VA_ARGS__) gmock_a3) constness { \
Abseil Team's avatar
Abseil Team committed
236
237
238
239
240
241
242
243
    GMOCK_MOCKER_(3, constness, Method).RegisterOwner(this); \
    return GMOCK_MOCKER_(3, constness, Method).With(gmock_a1, gmock_a2, \
        gmock_a3); \
  } \
  ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
      const ::testing::internal::WithoutMatchers&, \
      constness ::testing::internal::Function<__VA_ARGS__>* ) const { \
        return ::testing::internal::AdjustConstness_##constness(this)-> \
Abseil Team's avatar
Abseil Team committed
244
245
246
            gmock_##Method(::testing::A<GMOCK_ARG_(1, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(2, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(3, __VA_ARGS__)>()); \
Abseil Team's avatar
Abseil Team committed
247
248
249
      } \
  mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(3, constness, \
      Method)
250
251

// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
Abseil Team's avatar
Abseil Team committed
252
#define GMOCK_METHOD4_(constness, ct, Method, ...) \
Abseil Team's avatar
Abseil Team committed
253
254
255
  static_assert(4 == \
      ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \
      "MOCK_METHOD<N> must match argument count.");\
Abseil Team's avatar
Abseil Team committed
256
257
258
259
  GMOCK_RESULT_(__VA_ARGS__) ct Method( \
      GMOCK_ARG_(1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(2, \
          __VA_ARGS__) gmock_a2, GMOCK_ARG_(3, __VA_ARGS__) gmock_a3, \
          GMOCK_ARG_(4, __VA_ARGS__) gmock_a4) constness { \
Abseil Team's avatar
Abseil Team committed
260
261
    GMOCK_MOCKER_(4, constness, Method).SetOwnerAndName(this, #Method); \
    return GMOCK_MOCKER_(4, constness, \
Abseil Team's avatar
Abseil Team committed
262
263
264
265
266
        Method).Invoke(::std::forward<GMOCK_ARG_(1, __VA_ARGS__)>(gmock_a1), \
        \
  ::std::forward<GMOCK_ARG_(2, __VA_ARGS__)>(gmock_a2), \
  ::std::forward<GMOCK_ARG_(3, __VA_ARGS__)>(gmock_a3), \
  ::std::forward<GMOCK_ARG_(4, __VA_ARGS__)>(gmock_a4)); \
Abseil Team's avatar
Abseil Team committed
267
268
  } \
  ::testing::MockSpec<__VA_ARGS__> \
Abseil Team's avatar
Abseil Team committed
269
270
271
272
      gmock_##Method(GMOCK_MATCHER_(1, __VA_ARGS__) gmock_a1, \
                     GMOCK_MATCHER_(2, __VA_ARGS__) gmock_a2, \
                     GMOCK_MATCHER_(3, __VA_ARGS__) gmock_a3, \
                     GMOCK_MATCHER_(4, __VA_ARGS__) gmock_a4) constness { \
Abseil Team's avatar
Abseil Team committed
273
274
275
276
277
278
279
280
    GMOCK_MOCKER_(4, constness, Method).RegisterOwner(this); \
    return GMOCK_MOCKER_(4, constness, Method).With(gmock_a1, gmock_a2, \
        gmock_a3, gmock_a4); \
  } \
  ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
      const ::testing::internal::WithoutMatchers&, \
      constness ::testing::internal::Function<__VA_ARGS__>* ) const { \
        return ::testing::internal::AdjustConstness_##constness(this)-> \
Abseil Team's avatar
Abseil Team committed
281
282
283
284
            gmock_##Method(::testing::A<GMOCK_ARG_(1, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(2, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(3, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(4, __VA_ARGS__)>()); \
Abseil Team's avatar
Abseil Team committed
285
286
287
      } \
  mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(4, constness, \
      Method)
288
289

// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
Abseil Team's avatar
Abseil Team committed
290
#define GMOCK_METHOD5_(constness, ct, Method, ...) \
Abseil Team's avatar
Abseil Team committed
291
292
293
  static_assert(5 == \
      ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \
      "MOCK_METHOD<N> must match argument count.");\
Abseil Team's avatar
Abseil Team committed
294
295
296
297
  GMOCK_RESULT_(__VA_ARGS__) ct Method( \
      GMOCK_ARG_(1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(2, \
          __VA_ARGS__) gmock_a2, GMOCK_ARG_(3, __VA_ARGS__) gmock_a3, \
          GMOCK_ARG_(4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(5, \
Abseil Team's avatar
Abseil Team committed
298
299
300
          __VA_ARGS__) gmock_a5) constness { \
    GMOCK_MOCKER_(5, constness, Method).SetOwnerAndName(this, #Method); \
    return GMOCK_MOCKER_(5, constness, \
Abseil Team's avatar
Abseil Team committed
301
302
303
304
305
306
        Method).Invoke(::std::forward<GMOCK_ARG_(1, __VA_ARGS__)>(gmock_a1), \
        \
  ::std::forward<GMOCK_ARG_(2, __VA_ARGS__)>(gmock_a2), \
  ::std::forward<GMOCK_ARG_(3, __VA_ARGS__)>(gmock_a3), \
  ::std::forward<GMOCK_ARG_(4, __VA_ARGS__)>(gmock_a4), \
  ::std::forward<GMOCK_ARG_(5, __VA_ARGS__)>(gmock_a5)); \
Abseil Team's avatar
Abseil Team committed
307
308
  } \
  ::testing::MockSpec<__VA_ARGS__> \
Abseil Team's avatar
Abseil Team committed
309
310
311
312
313
      gmock_##Method(GMOCK_MATCHER_(1, __VA_ARGS__) gmock_a1, \
                     GMOCK_MATCHER_(2, __VA_ARGS__) gmock_a2, \
                     GMOCK_MATCHER_(3, __VA_ARGS__) gmock_a3, \
                     GMOCK_MATCHER_(4, __VA_ARGS__) gmock_a4, \
                     GMOCK_MATCHER_(5, __VA_ARGS__) gmock_a5) constness { \
Abseil Team's avatar
Abseil Team committed
314
315
316
317
318
319
320
321
    GMOCK_MOCKER_(5, constness, Method).RegisterOwner(this); \
    return GMOCK_MOCKER_(5, constness, Method).With(gmock_a1, gmock_a2, \
        gmock_a3, gmock_a4, gmock_a5); \
  } \
  ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
      const ::testing::internal::WithoutMatchers&, \
      constness ::testing::internal::Function<__VA_ARGS__>* ) const { \
        return ::testing::internal::AdjustConstness_##constness(this)-> \
Abseil Team's avatar
Abseil Team committed
322
323
324
325
326
            gmock_##Method(::testing::A<GMOCK_ARG_(1, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(2, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(3, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(4, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(5, __VA_ARGS__)>()); \
Abseil Team's avatar
Abseil Team committed
327
328
329
      } \
  mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(5, constness, \
      Method)
330
331

// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
Abseil Team's avatar
Abseil Team committed
332
#define GMOCK_METHOD6_(constness, ct, Method, ...) \
Abseil Team's avatar
Abseil Team committed
333
334
335
  static_assert(6 == \
      ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \
      "MOCK_METHOD<N> must match argument count.");\
Abseil Team's avatar
Abseil Team committed
336
337
338
339
340
  GMOCK_RESULT_(__VA_ARGS__) ct Method( \
      GMOCK_ARG_(1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(2, \
          __VA_ARGS__) gmock_a2, GMOCK_ARG_(3, __VA_ARGS__) gmock_a3, \
          GMOCK_ARG_(4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(5, \
          __VA_ARGS__) gmock_a5, GMOCK_ARG_(6, \
Abseil Team's avatar
Abseil Team committed
341
342
343
          __VA_ARGS__) gmock_a6) constness { \
    GMOCK_MOCKER_(6, constness, Method).SetOwnerAndName(this, #Method); \
    return GMOCK_MOCKER_(6, constness, \
Abseil Team's avatar
Abseil Team committed
344
345
346
347
348
349
350
        Method).Invoke(::std::forward<GMOCK_ARG_(1, __VA_ARGS__)>(gmock_a1), \
        \
  ::std::forward<GMOCK_ARG_(2, __VA_ARGS__)>(gmock_a2), \
  ::std::forward<GMOCK_ARG_(3, __VA_ARGS__)>(gmock_a3), \
  ::std::forward<GMOCK_ARG_(4, __VA_ARGS__)>(gmock_a4), \
  ::std::forward<GMOCK_ARG_(5, __VA_ARGS__)>(gmock_a5), \
  ::std::forward<GMOCK_ARG_(6, __VA_ARGS__)>(gmock_a6)); \
Abseil Team's avatar
Abseil Team committed
351
352
  } \
  ::testing::MockSpec<__VA_ARGS__> \
Abseil Team's avatar
Abseil Team committed
353
354
355
356
357
358
      gmock_##Method(GMOCK_MATCHER_(1, __VA_ARGS__) gmock_a1, \
                     GMOCK_MATCHER_(2, __VA_ARGS__) gmock_a2, \
                     GMOCK_MATCHER_(3, __VA_ARGS__) gmock_a3, \
                     GMOCK_MATCHER_(4, __VA_ARGS__) gmock_a4, \
                     GMOCK_MATCHER_(5, __VA_ARGS__) gmock_a5, \
                     GMOCK_MATCHER_(6, __VA_ARGS__) gmock_a6) constness { \
Abseil Team's avatar
Abseil Team committed
359
360
361
362
363
364
365
366
    GMOCK_MOCKER_(6, constness, Method).RegisterOwner(this); \
    return GMOCK_MOCKER_(6, constness, Method).With(gmock_a1, gmock_a2, \
        gmock_a3, gmock_a4, gmock_a5, gmock_a6); \
  } \
  ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
      const ::testing::internal::WithoutMatchers&, \
      constness ::testing::internal::Function<__VA_ARGS__>* ) const { \
        return ::testing::internal::AdjustConstness_##constness(this)-> \
Abseil Team's avatar
Abseil Team committed
367
368
369
370
371
372
            gmock_##Method(::testing::A<GMOCK_ARG_(1, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(2, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(3, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(4, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(5, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(6, __VA_ARGS__)>()); \
Abseil Team's avatar
Abseil Team committed
373
374
375
      } \
  mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(6, constness, \
      Method)
376
377

// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
Abseil Team's avatar
Abseil Team committed
378
#define GMOCK_METHOD7_(constness, ct, Method, ...) \
Abseil Team's avatar
Abseil Team committed
379
380
381
  static_assert(7 == \
      ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \
      "MOCK_METHOD<N> must match argument count.");\
Abseil Team's avatar
Abseil Team committed
382
383
384
385
386
387
  GMOCK_RESULT_(__VA_ARGS__) ct Method( \
      GMOCK_ARG_(1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(2, \
          __VA_ARGS__) gmock_a2, GMOCK_ARG_(3, __VA_ARGS__) gmock_a3, \
          GMOCK_ARG_(4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(5, \
          __VA_ARGS__) gmock_a5, GMOCK_ARG_(6, __VA_ARGS__) gmock_a6, \
          GMOCK_ARG_(7, __VA_ARGS__) gmock_a7) constness { \
Abseil Team's avatar
Abseil Team committed
388
389
    GMOCK_MOCKER_(7, constness, Method).SetOwnerAndName(this, #Method); \
    return GMOCK_MOCKER_(7, constness, \
Abseil Team's avatar
Abseil Team committed
390
391
392
393
394
395
396
397
        Method).Invoke(::std::forward<GMOCK_ARG_(1, __VA_ARGS__)>(gmock_a1), \
        \
  ::std::forward<GMOCK_ARG_(2, __VA_ARGS__)>(gmock_a2), \
  ::std::forward<GMOCK_ARG_(3, __VA_ARGS__)>(gmock_a3), \
  ::std::forward<GMOCK_ARG_(4, __VA_ARGS__)>(gmock_a4), \
  ::std::forward<GMOCK_ARG_(5, __VA_ARGS__)>(gmock_a5), \
  ::std::forward<GMOCK_ARG_(6, __VA_ARGS__)>(gmock_a6), \
  ::std::forward<GMOCK_ARG_(7, __VA_ARGS__)>(gmock_a7)); \
Abseil Team's avatar
Abseil Team committed
398
399
  } \
  ::testing::MockSpec<__VA_ARGS__> \
Abseil Team's avatar
Abseil Team committed
400
401
402
403
404
405
406
      gmock_##Method(GMOCK_MATCHER_(1, __VA_ARGS__) gmock_a1, \
                     GMOCK_MATCHER_(2, __VA_ARGS__) gmock_a2, \
                     GMOCK_MATCHER_(3, __VA_ARGS__) gmock_a3, \
                     GMOCK_MATCHER_(4, __VA_ARGS__) gmock_a4, \
                     GMOCK_MATCHER_(5, __VA_ARGS__) gmock_a5, \
                     GMOCK_MATCHER_(6, __VA_ARGS__) gmock_a6, \
                     GMOCK_MATCHER_(7, __VA_ARGS__) gmock_a7) constness { \
Abseil Team's avatar
Abseil Team committed
407
408
409
410
411
412
413
414
    GMOCK_MOCKER_(7, constness, Method).RegisterOwner(this); \
    return GMOCK_MOCKER_(7, constness, Method).With(gmock_a1, gmock_a2, \
        gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \
  } \
  ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
      const ::testing::internal::WithoutMatchers&, \
      constness ::testing::internal::Function<__VA_ARGS__>* ) const { \
        return ::testing::internal::AdjustConstness_##constness(this)-> \
Abseil Team's avatar
Abseil Team committed
415
416
417
418
419
420
421
            gmock_##Method(::testing::A<GMOCK_ARG_(1, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(2, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(3, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(4, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(5, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(6, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(7, __VA_ARGS__)>()); \
Abseil Team's avatar
Abseil Team committed
422
423
424
      } \
  mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(7, constness, \
      Method)
425
426

// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
Abseil Team's avatar
Abseil Team committed
427
#define GMOCK_METHOD8_(constness, ct, Method, ...) \
Abseil Team's avatar
Abseil Team committed
428
429
430
  static_assert(8 == \
      ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \
      "MOCK_METHOD<N> must match argument count.");\
Abseil Team's avatar
Abseil Team committed
431
432
433
434
435
436
  GMOCK_RESULT_(__VA_ARGS__) ct Method( \
      GMOCK_ARG_(1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(2, \
          __VA_ARGS__) gmock_a2, GMOCK_ARG_(3, __VA_ARGS__) gmock_a3, \
          GMOCK_ARG_(4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(5, \
          __VA_ARGS__) gmock_a5, GMOCK_ARG_(6, __VA_ARGS__) gmock_a6, \
          GMOCK_ARG_(7, __VA_ARGS__) gmock_a7, GMOCK_ARG_(8, \
Abseil Team's avatar
Abseil Team committed
437
438
439
          __VA_ARGS__) gmock_a8) constness { \
    GMOCK_MOCKER_(8, constness, Method).SetOwnerAndName(this, #Method); \
    return GMOCK_MOCKER_(8, constness, \
Abseil Team's avatar
Abseil Team committed
440
441
442
443
444
445
446
447
448
        Method).Invoke(::std::forward<GMOCK_ARG_(1, __VA_ARGS__)>(gmock_a1), \
        \
  ::std::forward<GMOCK_ARG_(2, __VA_ARGS__)>(gmock_a2), \
  ::std::forward<GMOCK_ARG_(3, __VA_ARGS__)>(gmock_a3), \
  ::std::forward<GMOCK_ARG_(4, __VA_ARGS__)>(gmock_a4), \
  ::std::forward<GMOCK_ARG_(5, __VA_ARGS__)>(gmock_a5), \
  ::std::forward<GMOCK_ARG_(6, __VA_ARGS__)>(gmock_a6), \
  ::std::forward<GMOCK_ARG_(7, __VA_ARGS__)>(gmock_a7), \
  ::std::forward<GMOCK_ARG_(8, __VA_ARGS__)>(gmock_a8)); \
Abseil Team's avatar
Abseil Team committed
449
450
  } \
  ::testing::MockSpec<__VA_ARGS__> \
Abseil Team's avatar
Abseil Team committed
451
452
453
454
455
456
457
458
      gmock_##Method(GMOCK_MATCHER_(1, __VA_ARGS__) gmock_a1, \
                     GMOCK_MATCHER_(2, __VA_ARGS__) gmock_a2, \
                     GMOCK_MATCHER_(3, __VA_ARGS__) gmock_a3, \
                     GMOCK_MATCHER_(4, __VA_ARGS__) gmock_a4, \
                     GMOCK_MATCHER_(5, __VA_ARGS__) gmock_a5, \
                     GMOCK_MATCHER_(6, __VA_ARGS__) gmock_a6, \
                     GMOCK_MATCHER_(7, __VA_ARGS__) gmock_a7, \
                     GMOCK_MATCHER_(8, __VA_ARGS__) gmock_a8) constness { \
Abseil Team's avatar
Abseil Team committed
459
460
461
462
463
464
465
466
    GMOCK_MOCKER_(8, constness, Method).RegisterOwner(this); \
    return GMOCK_MOCKER_(8, constness, Method).With(gmock_a1, gmock_a2, \
        gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \
  } \
  ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
      const ::testing::internal::WithoutMatchers&, \
      constness ::testing::internal::Function<__VA_ARGS__>* ) const { \
        return ::testing::internal::AdjustConstness_##constness(this)-> \
Abseil Team's avatar
Abseil Team committed
467
468
469
470
471
472
473
474
            gmock_##Method(::testing::A<GMOCK_ARG_(1, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(2, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(3, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(4, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(5, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(6, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(7, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(8, __VA_ARGS__)>()); \
Abseil Team's avatar
Abseil Team committed
475
476
477
      } \
  mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(8, constness, \
      Method)
478
479

// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
Abseil Team's avatar
Abseil Team committed
480
#define GMOCK_METHOD9_(constness, ct, Method, ...) \
Abseil Team's avatar
Abseil Team committed
481
482
483
  static_assert(9 == \
      ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \
      "MOCK_METHOD<N> must match argument count.");\
Abseil Team's avatar
Abseil Team committed
484
485
486
487
488
489
490
  GMOCK_RESULT_(__VA_ARGS__) ct Method( \
      GMOCK_ARG_(1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(2, \
          __VA_ARGS__) gmock_a2, GMOCK_ARG_(3, __VA_ARGS__) gmock_a3, \
          GMOCK_ARG_(4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(5, \
          __VA_ARGS__) gmock_a5, GMOCK_ARG_(6, __VA_ARGS__) gmock_a6, \
          GMOCK_ARG_(7, __VA_ARGS__) gmock_a7, GMOCK_ARG_(8, \
          __VA_ARGS__) gmock_a8, GMOCK_ARG_(9, \
Abseil Team's avatar
Abseil Team committed
491
492
493
          __VA_ARGS__) gmock_a9) constness { \
    GMOCK_MOCKER_(9, constness, Method).SetOwnerAndName(this, #Method); \
    return GMOCK_MOCKER_(9, constness, \
Abseil Team's avatar
Abseil Team committed
494
495
496
497
498
499
500
501
502
503
        Method).Invoke(::std::forward<GMOCK_ARG_(1, __VA_ARGS__)>(gmock_a1), \
        \
  ::std::forward<GMOCK_ARG_(2, __VA_ARGS__)>(gmock_a2), \
  ::std::forward<GMOCK_ARG_(3, __VA_ARGS__)>(gmock_a3), \
  ::std::forward<GMOCK_ARG_(4, __VA_ARGS__)>(gmock_a4), \
  ::std::forward<GMOCK_ARG_(5, __VA_ARGS__)>(gmock_a5), \
  ::std::forward<GMOCK_ARG_(6, __VA_ARGS__)>(gmock_a6), \
  ::std::forward<GMOCK_ARG_(7, __VA_ARGS__)>(gmock_a7), \
  ::std::forward<GMOCK_ARG_(8, __VA_ARGS__)>(gmock_a8), \
  ::std::forward<GMOCK_ARG_(9, __VA_ARGS__)>(gmock_a9)); \
Abseil Team's avatar
Abseil Team committed
504
505
  } \
  ::testing::MockSpec<__VA_ARGS__> \
Abseil Team's avatar
Abseil Team committed
506
507
508
509
510
511
512
513
514
      gmock_##Method(GMOCK_MATCHER_(1, __VA_ARGS__) gmock_a1, \
                     GMOCK_MATCHER_(2, __VA_ARGS__) gmock_a2, \
                     GMOCK_MATCHER_(3, __VA_ARGS__) gmock_a3, \
                     GMOCK_MATCHER_(4, __VA_ARGS__) gmock_a4, \
                     GMOCK_MATCHER_(5, __VA_ARGS__) gmock_a5, \
                     GMOCK_MATCHER_(6, __VA_ARGS__) gmock_a6, \
                     GMOCK_MATCHER_(7, __VA_ARGS__) gmock_a7, \
                     GMOCK_MATCHER_(8, __VA_ARGS__) gmock_a8, \
                     GMOCK_MATCHER_(9, __VA_ARGS__) gmock_a9) constness { \
Abseil Team's avatar
Abseil Team committed
515
516
517
518
519
520
521
522
523
    GMOCK_MOCKER_(9, constness, Method).RegisterOwner(this); \
    return GMOCK_MOCKER_(9, constness, Method).With(gmock_a1, gmock_a2, \
        gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \
        gmock_a9); \
  } \
  ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
      const ::testing::internal::WithoutMatchers&, \
      constness ::testing::internal::Function<__VA_ARGS__>* ) const { \
        return ::testing::internal::AdjustConstness_##constness(this)-> \
Abseil Team's avatar
Abseil Team committed
524
525
526
527
528
529
530
531
532
            gmock_##Method(::testing::A<GMOCK_ARG_(1, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(2, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(3, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(4, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(5, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(6, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(7, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(8, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(9, __VA_ARGS__)>()); \
Abseil Team's avatar
Abseil Team committed
533
534
535
      } \
  mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(9, constness, \
      Method)
536
537

// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
Abseil Team's avatar
Abseil Team committed
538
#define GMOCK_METHOD10_(constness, ct, Method, ...) \
Abseil Team's avatar
Abseil Team committed
539
540
541
  static_assert(10 == \
      ::testing::internal::Function<__VA_ARGS__>::ArgumentCount, \
      "MOCK_METHOD<N> must match argument count.");\
Abseil Team's avatar
Abseil Team committed
542
543
544
545
546
547
548
549
  GMOCK_RESULT_(__VA_ARGS__) ct Method( \
      GMOCK_ARG_(1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(2, \
          __VA_ARGS__) gmock_a2, GMOCK_ARG_(3, __VA_ARGS__) gmock_a3, \
          GMOCK_ARG_(4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(5, \
          __VA_ARGS__) gmock_a5, GMOCK_ARG_(6, __VA_ARGS__) gmock_a6, \
          GMOCK_ARG_(7, __VA_ARGS__) gmock_a7, GMOCK_ARG_(8, \
          __VA_ARGS__) gmock_a8, GMOCK_ARG_(9, __VA_ARGS__) gmock_a9, \
          GMOCK_ARG_(10, __VA_ARGS__) gmock_a10) constness { \
Abseil Team's avatar
Abseil Team committed
550
551
    GMOCK_MOCKER_(10, constness, Method).SetOwnerAndName(this, #Method); \
    return GMOCK_MOCKER_(10, constness, \
Abseil Team's avatar
Abseil Team committed
552
553
554
555
556
557
558
559
560
561
562
        Method).Invoke(::std::forward<GMOCK_ARG_(1, __VA_ARGS__)>(gmock_a1), \
        \
  ::std::forward<GMOCK_ARG_(2, __VA_ARGS__)>(gmock_a2), \
  ::std::forward<GMOCK_ARG_(3, __VA_ARGS__)>(gmock_a3), \
  ::std::forward<GMOCK_ARG_(4, __VA_ARGS__)>(gmock_a4), \
  ::std::forward<GMOCK_ARG_(5, __VA_ARGS__)>(gmock_a5), \
  ::std::forward<GMOCK_ARG_(6, __VA_ARGS__)>(gmock_a6), \
  ::std::forward<GMOCK_ARG_(7, __VA_ARGS__)>(gmock_a7), \
  ::std::forward<GMOCK_ARG_(8, __VA_ARGS__)>(gmock_a8), \
  ::std::forward<GMOCK_ARG_(9, __VA_ARGS__)>(gmock_a9), \
  ::std::forward<GMOCK_ARG_(10, __VA_ARGS__)>(gmock_a10)); \
Abseil Team's avatar
Abseil Team committed
563
564
  } \
  ::testing::MockSpec<__VA_ARGS__> \
Abseil Team's avatar
Abseil Team committed
565
566
567
568
569
570
571
572
573
574
      gmock_##Method(GMOCK_MATCHER_(1, __VA_ARGS__) gmock_a1, \
                     GMOCK_MATCHER_(2, __VA_ARGS__) gmock_a2, \
                     GMOCK_MATCHER_(3, __VA_ARGS__) gmock_a3, \
                     GMOCK_MATCHER_(4, __VA_ARGS__) gmock_a4, \
                     GMOCK_MATCHER_(5, __VA_ARGS__) gmock_a5, \
                     GMOCK_MATCHER_(6, __VA_ARGS__) gmock_a6, \
                     GMOCK_MATCHER_(7, __VA_ARGS__) gmock_a7, \
                     GMOCK_MATCHER_(8, __VA_ARGS__) gmock_a8, \
                     GMOCK_MATCHER_(9, __VA_ARGS__) gmock_a9, \
                     GMOCK_MATCHER_(10, __VA_ARGS__) gmock_a10) constness { \
Abseil Team's avatar
Abseil Team committed
575
576
577
578
579
580
581
582
583
    GMOCK_MOCKER_(10, constness, Method).RegisterOwner(this); \
    return GMOCK_MOCKER_(10, constness, Method).With(gmock_a1, gmock_a2, \
        gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \
        gmock_a10); \
  } \
  ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
      const ::testing::internal::WithoutMatchers&, \
      constness ::testing::internal::Function<__VA_ARGS__>* ) const { \
        return ::testing::internal::AdjustConstness_##constness(this)-> \
Abseil Team's avatar
Abseil Team committed
584
585
586
587
588
589
590
591
592
593
            gmock_##Method(::testing::A<GMOCK_ARG_(1, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(2, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(3, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(4, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(5, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(6, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(7, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(8, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(9, __VA_ARGS__)>(), \
                     ::testing::A<GMOCK_ARG_(10, __VA_ARGS__)>()); \
Abseil Team's avatar
Abseil Team committed
594
595
596
      } \
  mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(10, constness, \
      Method)
597

598
599
600
601

}  // namespace testing

#endif  // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_