gmock-generated-function-mockers.h 50.8 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
33
34
35
36
37
38
39
40
41
42

// 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.
//
// Author: wan@google.com (Zhanyong Wan)

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

#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_

43
44
#include "gmock/gmock-spec-builders.h"
#include "gmock/internal/gmock-internal-utils.h"
45

46
47
48
49
#if GTEST_HAS_STD_FUNCTION_
# include <functional>
#endif

50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
namespace testing {
namespace internal {

template <typename F>
class FunctionMockerBase;

// Note: class FunctionMocker really belongs to the ::testing
// namespace.  However if we define it in ::testing, MSVC will
// complain when classes in ::testing::internal declare it as a
// friend class template.  To workaround this compiler bug, we define
// FunctionMocker in ::testing::internal and import it into ::testing.
template <typename F>
class FunctionMocker;

template <typename R>
class FunctionMocker<R()> : public
    internal::FunctionMockerBase<R()> {
 public:
  typedef R F();
  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;

Gennadiy Civil's avatar
Gennadiy Civil committed
71
72
  MockSpec<F> With() {
    return MockSpec<F>(this, ::testing::make_tuple());
73
74
75
  }

  R Invoke() {
76
77
78
79
80
    // Even though gcc and MSVC don't enforce it, 'this->' is required
    // by the C++ standard [14.6.4] here, as the base class type is
    // dependent on the template argument (and thus shouldn't be
    // looked into when resolving InvokeWith).
    return this->InvokeWith(ArgumentTuple());
81
82
83
84
85
86
87
88
89
90
  }
};

template <typename R, typename A1>
class FunctionMocker<R(A1)> : public
    internal::FunctionMockerBase<R(A1)> {
 public:
  typedef R F(A1);
  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;

Gennadiy Civil's avatar
Gennadiy Civil committed
91
92
  MockSpec<F> With(const Matcher<A1>& m1) {
    return MockSpec<F>(this, ::testing::make_tuple(m1));
93
94
95
  }

  R Invoke(A1 a1) {
96
97
98
99
    // Even though gcc and MSVC don't enforce it, 'this->' is required
    // by the C++ standard [14.6.4] here, as the base class type is
    // dependent on the template argument (and thus shouldn't be
    // looked into when resolving InvokeWith).
Gennadiy Civil's avatar
Gennadiy Civil committed
100
    return this->InvokeWith(ArgumentTuple(internal::forward<A1>(a1)));
101
102
103
104
105
106
107
108
109
110
  }
};

template <typename R, typename A1, typename A2>
class FunctionMocker<R(A1, A2)> : public
    internal::FunctionMockerBase<R(A1, A2)> {
 public:
  typedef R F(A1, A2);
  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;

Gennadiy Civil's avatar
Gennadiy Civil committed
111
112
  MockSpec<F> With(const Matcher<A1>& m1, const Matcher<A2>& m2) {
    return MockSpec<F>(this, ::testing::make_tuple(m1, m2));
113
114
115
  }

  R Invoke(A1 a1, A2 a2) {
116
117
118
119
    // Even though gcc and MSVC don't enforce it, 'this->' is required
    // by the C++ standard [14.6.4] here, as the base class type is
    // dependent on the template argument (and thus shouldn't be
    // looked into when resolving InvokeWith).
Gennadiy Civil's avatar
Gennadiy Civil committed
120
121
    return this->InvokeWith(ArgumentTuple(internal::forward<A1>(a1),
        internal::forward<A2>(a2)));
122
123
124
125
126
127
128
129
130
131
  }
};

template <typename R, typename A1, typename A2, typename A3>
class FunctionMocker<R(A1, A2, A3)> : public
    internal::FunctionMockerBase<R(A1, A2, A3)> {
 public:
  typedef R F(A1, A2, A3);
  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;

Gennadiy Civil's avatar
Gennadiy Civil committed
132
  MockSpec<F> With(const Matcher<A1>& m1, const Matcher<A2>& m2,
133
      const Matcher<A3>& m3) {
Gennadiy Civil's avatar
Gennadiy Civil committed
134
    return MockSpec<F>(this, ::testing::make_tuple(m1, m2, m3));
135
136
137
  }

  R Invoke(A1 a1, A2 a2, A3 a3) {
138
139
140
141
    // Even though gcc and MSVC don't enforce it, 'this->' is required
    // by the C++ standard [14.6.4] here, as the base class type is
    // dependent on the template argument (and thus shouldn't be
    // looked into when resolving InvokeWith).
Gennadiy Civil's avatar
Gennadiy Civil committed
142
143
    return this->InvokeWith(ArgumentTuple(internal::forward<A1>(a1),
        internal::forward<A2>(a2), internal::forward<A3>(a3)));
144
145
146
147
148
149
150
151
152
153
  }
};

template <typename R, typename A1, typename A2, typename A3, typename A4>
class FunctionMocker<R(A1, A2, A3, A4)> : public
    internal::FunctionMockerBase<R(A1, A2, A3, A4)> {
 public:
  typedef R F(A1, A2, A3, A4);
  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;

Gennadiy Civil's avatar
Gennadiy Civil committed
154
  MockSpec<F> With(const Matcher<A1>& m1, const Matcher<A2>& m2,
155
      const Matcher<A3>& m3, const Matcher<A4>& m4) {
Gennadiy Civil's avatar
Gennadiy Civil committed
156
    return MockSpec<F>(this, ::testing::make_tuple(m1, m2, m3, m4));
157
158
159
  }

  R Invoke(A1 a1, A2 a2, A3 a3, A4 a4) {
160
161
162
163
    // Even though gcc and MSVC don't enforce it, 'this->' is required
    // by the C++ standard [14.6.4] here, as the base class type is
    // dependent on the template argument (and thus shouldn't be
    // looked into when resolving InvokeWith).
Gennadiy Civil's avatar
Gennadiy Civil committed
164
165
166
    return this->InvokeWith(ArgumentTuple(internal::forward<A1>(a1),
        internal::forward<A2>(a2), internal::forward<A3>(a3),
        internal::forward<A4>(a4)));
167
168
169
170
171
172
173
174
175
176
177
  }
};

template <typename R, typename A1, typename A2, typename A3, typename A4,
    typename A5>
class FunctionMocker<R(A1, A2, A3, A4, A5)> : public
    internal::FunctionMockerBase<R(A1, A2, A3, A4, A5)> {
 public:
  typedef R F(A1, A2, A3, A4, A5);
  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;

Gennadiy Civil's avatar
Gennadiy Civil committed
178
  MockSpec<F> With(const Matcher<A1>& m1, const Matcher<A2>& m2,
179
      const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5) {
Gennadiy Civil's avatar
Gennadiy Civil committed
180
    return MockSpec<F>(this, ::testing::make_tuple(m1, m2, m3, m4, m5));
181
182
183
  }

  R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
184
185
186
187
    // Even though gcc and MSVC don't enforce it, 'this->' is required
    // by the C++ standard [14.6.4] here, as the base class type is
    // dependent on the template argument (and thus shouldn't be
    // looked into when resolving InvokeWith).
Gennadiy Civil's avatar
Gennadiy Civil committed
188
189
190
    return this->InvokeWith(ArgumentTuple(internal::forward<A1>(a1),
        internal::forward<A2>(a2), internal::forward<A3>(a3),
        internal::forward<A4>(a4), internal::forward<A5>(a5)));
191
192
193
194
195
196
197
198
199
200
201
  }
};

template <typename R, typename A1, typename A2, typename A3, typename A4,
    typename A5, typename A6>
class FunctionMocker<R(A1, A2, A3, A4, A5, A6)> : public
    internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6)> {
 public:
  typedef R F(A1, A2, A3, A4, A5, A6);
  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;

Gennadiy Civil's avatar
Gennadiy Civil committed
202
  MockSpec<F> With(const Matcher<A1>& m1, const Matcher<A2>& m2,
203
204
      const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
      const Matcher<A6>& m6) {
Gennadiy Civil's avatar
Gennadiy Civil committed
205
    return MockSpec<F>(this, ::testing::make_tuple(m1, m2, m3, m4, m5, m6));
206
207
208
  }

  R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) {
209
210
211
212
    // Even though gcc and MSVC don't enforce it, 'this->' is required
    // by the C++ standard [14.6.4] here, as the base class type is
    // dependent on the template argument (and thus shouldn't be
    // looked into when resolving InvokeWith).
Gennadiy Civil's avatar
Gennadiy Civil committed
213
214
215
216
    return this->InvokeWith(ArgumentTuple(internal::forward<A1>(a1),
        internal::forward<A2>(a2), internal::forward<A3>(a3),
        internal::forward<A4>(a4), internal::forward<A5>(a5),
        internal::forward<A6>(a6)));
217
218
219
220
221
222
223
224
225
226
227
  }
};

template <typename R, typename A1, typename A2, typename A3, typename A4,
    typename A5, typename A6, typename A7>
class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7)> : public
    internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7)> {
 public:
  typedef R F(A1, A2, A3, A4, A5, A6, A7);
  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;

Gennadiy Civil's avatar
Gennadiy Civil committed
228
  MockSpec<F> With(const Matcher<A1>& m1, const Matcher<A2>& m2,
229
230
      const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
      const Matcher<A6>& m6, const Matcher<A7>& m7) {
Gennadiy Civil's avatar
Gennadiy Civil committed
231
    return MockSpec<F>(this, ::testing::make_tuple(m1, m2, m3, m4, m5, m6, m7));
232
233
234
  }

  R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) {
235
236
237
238
    // Even though gcc and MSVC don't enforce it, 'this->' is required
    // by the C++ standard [14.6.4] here, as the base class type is
    // dependent on the template argument (and thus shouldn't be
    // looked into when resolving InvokeWith).
Gennadiy Civil's avatar
Gennadiy Civil committed
239
240
241
242
    return this->InvokeWith(ArgumentTuple(internal::forward<A1>(a1),
        internal::forward<A2>(a2), internal::forward<A3>(a3),
        internal::forward<A4>(a4), internal::forward<A5>(a5),
        internal::forward<A6>(a6), internal::forward<A7>(a7)));
243
244
245
246
247
248
249
250
251
252
253
  }
};

template <typename R, typename A1, typename A2, typename A3, typename A4,
    typename A5, typename A6, typename A7, typename A8>
class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8)> : public
    internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8)> {
 public:
  typedef R F(A1, A2, A3, A4, A5, A6, A7, A8);
  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;

Gennadiy Civil's avatar
Gennadiy Civil committed
254
  MockSpec<F> With(const Matcher<A1>& m1, const Matcher<A2>& m2,
255
256
      const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
      const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8) {
Gennadiy Civil's avatar
Gennadiy Civil committed
257
258
    return MockSpec<F>(this, ::testing::make_tuple(m1, m2, m3, m4, m5, m6, m7,
        m8));
259
260
261
  }

  R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) {
262
263
264
265
    // Even though gcc and MSVC don't enforce it, 'this->' is required
    // by the C++ standard [14.6.4] here, as the base class type is
    // dependent on the template argument (and thus shouldn't be
    // looked into when resolving InvokeWith).
Gennadiy Civil's avatar
Gennadiy Civil committed
266
267
268
269
270
    return this->InvokeWith(ArgumentTuple(internal::forward<A1>(a1),
        internal::forward<A2>(a2), internal::forward<A3>(a3),
        internal::forward<A4>(a4), internal::forward<A5>(a5),
        internal::forward<A6>(a6), internal::forward<A7>(a7),
        internal::forward<A8>(a8)));
271
272
273
274
275
276
277
278
279
280
281
  }
};

template <typename R, typename A1, typename A2, typename A3, typename A4,
    typename A5, typename A6, typename A7, typename A8, typename A9>
class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> : public
    internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
 public:
  typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9);
  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;

Gennadiy Civil's avatar
Gennadiy Civil committed
282
  MockSpec<F> With(const Matcher<A1>& m1, const Matcher<A2>& m2,
283
284
285
      const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
      const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8,
      const Matcher<A9>& m9) {
Gennadiy Civil's avatar
Gennadiy Civil committed
286
287
    return MockSpec<F>(this, ::testing::make_tuple(m1, m2, m3, m4, m5, m6, m7,
        m8, m9));
288
289
290
  }

  R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) {
291
292
293
294
    // Even though gcc and MSVC don't enforce it, 'this->' is required
    // by the C++ standard [14.6.4] here, as the base class type is
    // dependent on the template argument (and thus shouldn't be
    // looked into when resolving InvokeWith).
Gennadiy Civil's avatar
Gennadiy Civil committed
295
296
297
298
299
    return this->InvokeWith(ArgumentTuple(internal::forward<A1>(a1),
        internal::forward<A2>(a2), internal::forward<A3>(a3),
        internal::forward<A4>(a4), internal::forward<A5>(a5),
        internal::forward<A6>(a6), internal::forward<A7>(a7),
        internal::forward<A8>(a8), internal::forward<A9>(a9)));
300
301
302
303
304
305
306
307
308
309
310
311
  }
};

template <typename R, typename A1, typename A2, typename A3, typename A4,
    typename A5, typename A6, typename A7, typename A8, typename A9,
    typename A10>
class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> : public
    internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> {
 public:
  typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
  typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;

Gennadiy Civil's avatar
Gennadiy Civil committed
312
  MockSpec<F> With(const Matcher<A1>& m1, const Matcher<A2>& m2,
313
314
315
      const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
      const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8,
      const Matcher<A9>& m9, const Matcher<A10>& m10) {
Gennadiy Civil's avatar
Gennadiy Civil committed
316
317
    return MockSpec<F>(this, ::testing::make_tuple(m1, m2, m3, m4, m5, m6, m7,
        m8, m9, m10));
318
319
320
321
  }

  R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9,
      A10 a10) {
322
323
324
325
    // Even though gcc and MSVC don't enforce it, 'this->' is required
    // by the C++ standard [14.6.4] here, as the base class type is
    // dependent on the template argument (and thus shouldn't be
    // looked into when resolving InvokeWith).
Gennadiy Civil's avatar
Gennadiy Civil committed
326
327
328
329
330
331
    return this->InvokeWith(ArgumentTuple(internal::forward<A1>(a1),
        internal::forward<A2>(a2), internal::forward<A3>(a3),
        internal::forward<A4>(a4), internal::forward<A5>(a5),
        internal::forward<A6>(a6), internal::forward<A7>(a7),
        internal::forward<A8>(a8), internal::forward<A9>(a9),
        internal::forward<A10>(a10)));
332
333
334
335
336
337
338
339
340
341
342
343
  }
};

}  // 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;

344
345
346
347
// 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).
348
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
349
350
#define GMOCK_RESULT_(tn, ...) \
    tn ::testing::internal::Function<__VA_ARGS__>::Result
351

352
// The type of argument N of the given function type.
353
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
354
355
#define GMOCK_ARG_(tn, N, ...) \
    tn ::testing::internal::Function<__VA_ARGS__>::Argument##N
356

357
// The matcher type for argument N of the given function type.
358
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
359
360
#define GMOCK_MATCHER_(tn, N, ...) \
    const ::testing::Matcher<GMOCK_ARG_(tn, N, __VA_ARGS__)>&
361
362
363

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

// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
368
369
370
#define GMOCK_METHOD0_(tn, constness, ct, Method, ...) \
  GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
      ) constness { \
371
    GTEST_COMPILE_ASSERT_((::testing::tuple_size<                          \
372
373
        tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
            == 0), \
374
        this_method_does_not_take_0_arguments); \
375
376
    GMOCK_MOCKER_(0, constness, Method).SetOwnerAndName(this, #Method); \
    return GMOCK_MOCKER_(0, constness, Method).Invoke(); \
377
  } \
Gennadiy Civil's avatar
Gennadiy Civil committed
378
  ::testing::MockSpec<__VA_ARGS__> \
379
      gmock_##Method() constness { \
380
381
    GMOCK_MOCKER_(0, constness, Method).RegisterOwner(this); \
    return GMOCK_MOCKER_(0, constness, Method).With(); \
382
  } \
383
384
  mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(0, constness, \
      Method)
385
386

// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
387
388
389
#define GMOCK_METHOD1_(tn, constness, ct, Method, ...) \
  GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
      GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1) constness { \
390
    GTEST_COMPILE_ASSERT_((::testing::tuple_size<                          \
391
392
        tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
            == 1), \
393
        this_method_does_not_take_1_argument); \
394
    GMOCK_MOCKER_(1, constness, Method).SetOwnerAndName(this, #Method); \
Gennadiy Civil's avatar
Gennadiy Civil committed
395
396
397
    return GMOCK_MOCKER_(1, constness, \
        Method).Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, \
        __VA_ARGS__)>(gmock_a1)); \
398
  } \
Gennadiy Civil's avatar
Gennadiy Civil committed
399
  ::testing::MockSpec<__VA_ARGS__> \
400
      gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1) constness { \
401
402
    GMOCK_MOCKER_(1, constness, Method).RegisterOwner(this); \
    return GMOCK_MOCKER_(1, constness, Method).With(gmock_a1); \
403
  } \
404
405
  mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(1, constness, \
      Method)
406
407

// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
408
409
#define GMOCK_METHOD2_(tn, constness, ct, Method, ...) \
  GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
Gennadiy Civil's avatar
Gennadiy Civil committed
410
411
      GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \
          __VA_ARGS__) gmock_a2) constness { \
412
    GTEST_COMPILE_ASSERT_((::testing::tuple_size<                          \
413
414
        tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
            == 2), \
415
        this_method_does_not_take_2_arguments); \
416
    GMOCK_MOCKER_(2, constness, Method).SetOwnerAndName(this, #Method); \
Gennadiy Civil's avatar
Gennadiy Civil committed
417
418
419
420
    return GMOCK_MOCKER_(2, constness, \
        Method).Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, \
        __VA_ARGS__)>(gmock_a1), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2)); \
421
  } \
Gennadiy Civil's avatar
Gennadiy Civil committed
422
  ::testing::MockSpec<__VA_ARGS__> \
423
424
      gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
                     GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2) constness { \
425
426
    GMOCK_MOCKER_(2, constness, Method).RegisterOwner(this); \
    return GMOCK_MOCKER_(2, constness, Method).With(gmock_a1, gmock_a2); \
427
  } \
428
429
  mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(2, constness, \
      Method)
430
431

// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
432
433
#define GMOCK_METHOD3_(tn, constness, ct, Method, ...) \
  GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
Gennadiy Civil's avatar
Gennadiy Civil committed
434
435
436
      GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \
          __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, \
          __VA_ARGS__) gmock_a3) constness { \
437
    GTEST_COMPILE_ASSERT_((::testing::tuple_size<                          \
438
439
        tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
            == 3), \
440
        this_method_does_not_take_3_arguments); \
441
    GMOCK_MOCKER_(3, constness, Method).SetOwnerAndName(this, #Method); \
Gennadiy Civil's avatar
Gennadiy Civil committed
442
443
444
445
446
    return GMOCK_MOCKER_(3, constness, \
        Method).Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, \
        __VA_ARGS__)>(gmock_a1), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3)); \
447
  } \
Gennadiy Civil's avatar
Gennadiy Civil committed
448
  ::testing::MockSpec<__VA_ARGS__> \
449
450
451
      gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
                     GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
                     GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3) constness { \
452
453
454
    GMOCK_MOCKER_(3, constness, Method).RegisterOwner(this); \
    return GMOCK_MOCKER_(3, constness, Method).With(gmock_a1, gmock_a2, \
        gmock_a3); \
455
  } \
456
457
  mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(3, constness, \
      Method)
458
459

// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
460
461
#define GMOCK_METHOD4_(tn, constness, ct, Method, ...) \
  GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
Gennadiy Civil's avatar
Gennadiy Civil committed
462
463
464
      GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \
          __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
          GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4) constness { \
465
    GTEST_COMPILE_ASSERT_((::testing::tuple_size<                          \
466
467
        tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
            == 4), \
468
        this_method_does_not_take_4_arguments); \
469
    GMOCK_MOCKER_(4, constness, Method).SetOwnerAndName(this, #Method); \
Gennadiy Civil's avatar
Gennadiy Civil committed
470
471
472
473
474
475
    return GMOCK_MOCKER_(4, constness, \
        Method).Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, \
        __VA_ARGS__)>(gmock_a1), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4)); \
476
  } \
Gennadiy Civil's avatar
Gennadiy Civil committed
477
  ::testing::MockSpec<__VA_ARGS__> \
478
479
480
481
      gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
                     GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
                     GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
                     GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4) constness { \
482
483
484
    GMOCK_MOCKER_(4, constness, Method).RegisterOwner(this); \
    return GMOCK_MOCKER_(4, constness, Method).With(gmock_a1, gmock_a2, \
        gmock_a3, gmock_a4); \
485
  } \
486
487
  mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(4, constness, \
      Method)
488
489

// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
490
491
#define GMOCK_METHOD5_(tn, constness, ct, Method, ...) \
  GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
Gennadiy Civil's avatar
Gennadiy Civil committed
492
493
494
495
      GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \
          __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
          GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(tn, 5, \
          __VA_ARGS__) gmock_a5) constness { \
496
    GTEST_COMPILE_ASSERT_((::testing::tuple_size<                          \
497
498
        tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
            == 5), \
499
        this_method_does_not_take_5_arguments); \
500
    GMOCK_MOCKER_(5, constness, Method).SetOwnerAndName(this, #Method); \
Gennadiy Civil's avatar
Gennadiy Civil committed
501
502
503
504
505
506
507
    return GMOCK_MOCKER_(5, constness, \
        Method).Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, \
        __VA_ARGS__)>(gmock_a1), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5)); \
508
  } \
Gennadiy Civil's avatar
Gennadiy Civil committed
509
  ::testing::MockSpec<__VA_ARGS__> \
510
511
512
513
514
      gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
                     GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
                     GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
                     GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
                     GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5) constness { \
515
516
517
    GMOCK_MOCKER_(5, constness, Method).RegisterOwner(this); \
    return GMOCK_MOCKER_(5, constness, Method).With(gmock_a1, gmock_a2, \
        gmock_a3, gmock_a4, gmock_a5); \
518
  } \
519
520
  mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(5, constness, \
      Method)
521
522

// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
523
524
#define GMOCK_METHOD6_(tn, constness, ct, Method, ...) \
  GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
Gennadiy Civil's avatar
Gennadiy Civil committed
525
526
527
528
529
      GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \
          __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
          GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(tn, 5, \
          __VA_ARGS__) gmock_a5, GMOCK_ARG_(tn, 6, \
          __VA_ARGS__) gmock_a6) constness { \
530
    GTEST_COMPILE_ASSERT_((::testing::tuple_size<                          \
531
532
        tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
            == 6), \
533
        this_method_does_not_take_6_arguments); \
534
    GMOCK_MOCKER_(6, constness, Method).SetOwnerAndName(this, #Method); \
Gennadiy Civil's avatar
Gennadiy Civil committed
535
536
537
538
539
540
541
542
    return GMOCK_MOCKER_(6, constness, \
        Method).Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, \
        __VA_ARGS__)>(gmock_a1), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(gmock_a6)); \
543
  } \
Gennadiy Civil's avatar
Gennadiy Civil committed
544
  ::testing::MockSpec<__VA_ARGS__> \
545
546
547
548
549
550
      gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
                     GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
                     GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
                     GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
                     GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
                     GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6) constness { \
551
552
553
    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); \
554
  } \
555
556
  mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(6, constness, \
      Method)
557
558

// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
559
560
#define GMOCK_METHOD7_(tn, constness, ct, Method, ...) \
  GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
Gennadiy Civil's avatar
Gennadiy Civil committed
561
562
563
564
565
      GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \
          __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
          GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(tn, 5, \
          __VA_ARGS__) gmock_a5, GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
          GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7) constness { \
566
    GTEST_COMPILE_ASSERT_((::testing::tuple_size<                          \
567
568
        tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
            == 7), \
569
        this_method_does_not_take_7_arguments); \
570
    GMOCK_MOCKER_(7, constness, Method).SetOwnerAndName(this, #Method); \
Gennadiy Civil's avatar
Gennadiy Civil committed
571
572
573
574
575
576
577
578
579
    return GMOCK_MOCKER_(7, constness, \
        Method).Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, \
        __VA_ARGS__)>(gmock_a1), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(gmock_a6), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(gmock_a7)); \
580
  } \
Gennadiy Civil's avatar
Gennadiy Civil committed
581
  ::testing::MockSpec<__VA_ARGS__> \
582
583
584
585
586
587
588
      gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
                     GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
                     GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
                     GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
                     GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
                     GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
                     GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7) constness { \
589
590
591
    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); \
592
  } \
593
594
  mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(7, constness, \
      Method)
595
596

// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
597
598
#define GMOCK_METHOD8_(tn, constness, ct, Method, ...) \
  GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
Gennadiy Civil's avatar
Gennadiy Civil committed
599
600
601
602
603
604
      GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \
          __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
          GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(tn, 5, \
          __VA_ARGS__) gmock_a5, GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
          GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, GMOCK_ARG_(tn, 8, \
          __VA_ARGS__) gmock_a8) constness { \
605
    GTEST_COMPILE_ASSERT_((::testing::tuple_size<                          \
606
607
        tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
            == 8), \
608
        this_method_does_not_take_8_arguments); \
609
    GMOCK_MOCKER_(8, constness, Method).SetOwnerAndName(this, #Method); \
Gennadiy Civil's avatar
Gennadiy Civil committed
610
611
612
613
614
615
616
617
618
619
    return GMOCK_MOCKER_(8, constness, \
        Method).Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, \
        __VA_ARGS__)>(gmock_a1), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(gmock_a6), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(gmock_a7), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 8, __VA_ARGS__)>(gmock_a8)); \
620
  } \
Gennadiy Civil's avatar
Gennadiy Civil committed
621
  ::testing::MockSpec<__VA_ARGS__> \
622
623
624
625
626
627
628
629
      gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
                     GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
                     GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
                     GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
                     GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
                     GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
                     GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
                     GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8) constness { \
630
631
632
    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); \
633
  } \
634
635
  mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(8, constness, \
      Method)
636
637

// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
638
639
#define GMOCK_METHOD9_(tn, constness, ct, Method, ...) \
  GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
Gennadiy Civil's avatar
Gennadiy Civil committed
640
641
642
643
644
645
646
      GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \
          __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
          GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(tn, 5, \
          __VA_ARGS__) gmock_a5, GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
          GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, GMOCK_ARG_(tn, 8, \
          __VA_ARGS__) gmock_a8, GMOCK_ARG_(tn, 9, \
          __VA_ARGS__) gmock_a9) constness { \
647
    GTEST_COMPILE_ASSERT_((::testing::tuple_size<                          \
648
649
        tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
            == 9), \
650
        this_method_does_not_take_9_arguments); \
651
    GMOCK_MOCKER_(9, constness, Method).SetOwnerAndName(this, #Method); \
Gennadiy Civil's avatar
Gennadiy Civil committed
652
653
654
655
656
657
658
659
660
661
662
    return GMOCK_MOCKER_(9, constness, \
        Method).Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, \
        __VA_ARGS__)>(gmock_a1), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(gmock_a6), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(gmock_a7), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 8, __VA_ARGS__)>(gmock_a8), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 9, __VA_ARGS__)>(gmock_a9)); \
663
  } \
Gennadiy Civil's avatar
Gennadiy Civil committed
664
  ::testing::MockSpec<__VA_ARGS__> \
665
666
667
668
669
670
671
672
673
      gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
                     GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
                     GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
                     GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
                     GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
                     GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
                     GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
                     GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \
                     GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9) constness { \
674
675
676
677
    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); \
678
  } \
679
680
  mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(9, constness, \
      Method)
681
682

// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
683
684
#define GMOCK_METHOD10_(tn, constness, ct, Method, ...) \
  GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
Gennadiy Civil's avatar
Gennadiy Civil committed
685
686
687
688
689
690
691
      GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, GMOCK_ARG_(tn, 2, \
          __VA_ARGS__) gmock_a2, GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
          GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, GMOCK_ARG_(tn, 5, \
          __VA_ARGS__) gmock_a5, GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
          GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, GMOCK_ARG_(tn, 8, \
          __VA_ARGS__) gmock_a8, GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9, \
          GMOCK_ARG_(tn, 10, __VA_ARGS__) gmock_a10) constness { \
692
    GTEST_COMPILE_ASSERT_((::testing::tuple_size<                          \
693
694
        tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
            == 10), \
695
        this_method_does_not_take_10_arguments); \
696
    GMOCK_MOCKER_(10, constness, Method).SetOwnerAndName(this, #Method); \
Gennadiy Civil's avatar
Gennadiy Civil committed
697
698
699
700
701
702
703
704
705
706
707
708
    return GMOCK_MOCKER_(10, constness, \
        Method).Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, \
        __VA_ARGS__)>(gmock_a1), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(gmock_a2), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(gmock_a3), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(gmock_a4), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(gmock_a5), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(gmock_a6), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(gmock_a7), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 8, __VA_ARGS__)>(gmock_a8), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 9, __VA_ARGS__)>(gmock_a9), \
  ::testing::internal::forward<GMOCK_ARG_(tn, 10, __VA_ARGS__)>(gmock_a10)); \
709
  } \
Gennadiy Civil's avatar
Gennadiy Civil committed
710
  ::testing::MockSpec<__VA_ARGS__> \
711
712
713
714
715
716
717
718
719
720
721
      gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
                     GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
                     GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
                     GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
                     GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
                     GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
                     GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
                     GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \
                     GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9, \
                     GMOCK_MATCHER_(tn, 10, \
                         __VA_ARGS__) gmock_a10) constness { \
722
723
724
    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, \
725
726
        gmock_a10); \
  } \
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
  mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(10, constness, \
      Method)

#define MOCK_METHOD0(m, ...) GMOCK_METHOD0_(, , , m, __VA_ARGS__)
#define MOCK_METHOD1(m, ...) GMOCK_METHOD1_(, , , m, __VA_ARGS__)
#define MOCK_METHOD2(m, ...) GMOCK_METHOD2_(, , , m, __VA_ARGS__)
#define MOCK_METHOD3(m, ...) GMOCK_METHOD3_(, , , m, __VA_ARGS__)
#define MOCK_METHOD4(m, ...) GMOCK_METHOD4_(, , , m, __VA_ARGS__)
#define MOCK_METHOD5(m, ...) GMOCK_METHOD5_(, , , m, __VA_ARGS__)
#define MOCK_METHOD6(m, ...) GMOCK_METHOD6_(, , , m, __VA_ARGS__)
#define MOCK_METHOD7(m, ...) GMOCK_METHOD7_(, , , m, __VA_ARGS__)
#define MOCK_METHOD8(m, ...) GMOCK_METHOD8_(, , , m, __VA_ARGS__)
#define MOCK_METHOD9(m, ...) GMOCK_METHOD9_(, , , m, __VA_ARGS__)
#define MOCK_METHOD10(m, ...) GMOCK_METHOD10_(, , , m, __VA_ARGS__)

#define MOCK_CONST_METHOD0(m, ...) GMOCK_METHOD0_(, const, , m, __VA_ARGS__)
#define MOCK_CONST_METHOD1(m, ...) GMOCK_METHOD1_(, const, , m, __VA_ARGS__)
#define MOCK_CONST_METHOD2(m, ...) GMOCK_METHOD2_(, const, , m, __VA_ARGS__)
#define MOCK_CONST_METHOD3(m, ...) GMOCK_METHOD3_(, const, , m, __VA_ARGS__)
#define MOCK_CONST_METHOD4(m, ...) GMOCK_METHOD4_(, const, , m, __VA_ARGS__)
#define MOCK_CONST_METHOD5(m, ...) GMOCK_METHOD5_(, const, , m, __VA_ARGS__)
#define MOCK_CONST_METHOD6(m, ...) GMOCK_METHOD6_(, const, , m, __VA_ARGS__)
#define MOCK_CONST_METHOD7(m, ...) GMOCK_METHOD7_(, const, , m, __VA_ARGS__)
#define MOCK_CONST_METHOD8(m, ...) GMOCK_METHOD8_(, const, , m, __VA_ARGS__)
#define MOCK_CONST_METHOD9(m, ...) GMOCK_METHOD9_(, const, , m, __VA_ARGS__)
#define MOCK_CONST_METHOD10(m, ...) GMOCK_METHOD10_(, const, , m, __VA_ARGS__)

#define MOCK_METHOD0_T(m, ...) GMOCK_METHOD0_(typename, , , m, __VA_ARGS__)
#define MOCK_METHOD1_T(m, ...) GMOCK_METHOD1_(typename, , , m, __VA_ARGS__)
#define MOCK_METHOD2_T(m, ...) GMOCK_METHOD2_(typename, , , m, __VA_ARGS__)
#define MOCK_METHOD3_T(m, ...) GMOCK_METHOD3_(typename, , , m, __VA_ARGS__)
#define MOCK_METHOD4_T(m, ...) GMOCK_METHOD4_(typename, , , m, __VA_ARGS__)
#define MOCK_METHOD5_T(m, ...) GMOCK_METHOD5_(typename, , , m, __VA_ARGS__)
#define MOCK_METHOD6_T(m, ...) GMOCK_METHOD6_(typename, , , m, __VA_ARGS__)
#define MOCK_METHOD7_T(m, ...) GMOCK_METHOD7_(typename, , , m, __VA_ARGS__)
#define MOCK_METHOD8_T(m, ...) GMOCK_METHOD8_(typename, , , m, __VA_ARGS__)
#define MOCK_METHOD9_T(m, ...) GMOCK_METHOD9_(typename, , , m, __VA_ARGS__)
#define MOCK_METHOD10_T(m, ...) GMOCK_METHOD10_(typename, , , m, __VA_ARGS__)

#define MOCK_CONST_METHOD0_T(m, ...) \
    GMOCK_METHOD0_(typename, const, , m, __VA_ARGS__)
#define MOCK_CONST_METHOD1_T(m, ...) \
    GMOCK_METHOD1_(typename, const, , m, __VA_ARGS__)
#define MOCK_CONST_METHOD2_T(m, ...) \
    GMOCK_METHOD2_(typename, const, , m, __VA_ARGS__)
#define MOCK_CONST_METHOD3_T(m, ...) \
    GMOCK_METHOD3_(typename, const, , m, __VA_ARGS__)
#define MOCK_CONST_METHOD4_T(m, ...) \
    GMOCK_METHOD4_(typename, const, , m, __VA_ARGS__)
#define MOCK_CONST_METHOD5_T(m, ...) \
    GMOCK_METHOD5_(typename, const, , m, __VA_ARGS__)
#define MOCK_CONST_METHOD6_T(m, ...) \
    GMOCK_METHOD6_(typename, const, , m, __VA_ARGS__)
#define MOCK_CONST_METHOD7_T(m, ...) \
    GMOCK_METHOD7_(typename, const, , m, __VA_ARGS__)
#define MOCK_CONST_METHOD8_T(m, ...) \
    GMOCK_METHOD8_(typename, const, , m, __VA_ARGS__)
#define MOCK_CONST_METHOD9_T(m, ...) \
    GMOCK_METHOD9_(typename, const, , m, __VA_ARGS__)
#define MOCK_CONST_METHOD10_T(m, ...) \
    GMOCK_METHOD10_(typename, const, , m, __VA_ARGS__)

#define MOCK_METHOD0_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD0_(, , ct, m, __VA_ARGS__)
#define MOCK_METHOD1_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD1_(, , ct, m, __VA_ARGS__)
#define MOCK_METHOD2_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD2_(, , ct, m, __VA_ARGS__)
#define MOCK_METHOD3_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD3_(, , ct, m, __VA_ARGS__)
#define MOCK_METHOD4_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD4_(, , ct, m, __VA_ARGS__)
#define MOCK_METHOD5_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD5_(, , ct, m, __VA_ARGS__)
#define MOCK_METHOD6_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD6_(, , ct, m, __VA_ARGS__)
#define MOCK_METHOD7_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD7_(, , ct, m, __VA_ARGS__)
#define MOCK_METHOD8_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD8_(, , ct, m, __VA_ARGS__)
#define MOCK_METHOD9_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD9_(, , ct, m, __VA_ARGS__)
#define MOCK_METHOD10_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD10_(, , ct, m, __VA_ARGS__)

#define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD0_(, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD1_(, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD2_(, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD3_(, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD4_(, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD5_(, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD6_(, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD7_(, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD8_(, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD9_(, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD10_(, const, ct, m, __VA_ARGS__)

#define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD0_(typename, , ct, m, __VA_ARGS__)
#define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD1_(typename, , ct, m, __VA_ARGS__)
#define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD2_(typename, , ct, m, __VA_ARGS__)
#define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD3_(typename, , ct, m, __VA_ARGS__)
#define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD4_(typename, , ct, m, __VA_ARGS__)
#define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD5_(typename, , ct, m, __VA_ARGS__)
#define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD6_(typename, , ct, m, __VA_ARGS__)
#define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD7_(typename, , ct, m, __VA_ARGS__)
#define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD8_(typename, , ct, m, __VA_ARGS__)
#define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD9_(typename, , ct, m, __VA_ARGS__)
#define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD10_(typename, , ct, m, __VA_ARGS__)

#define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD0_(typename, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD1_(typename, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD2_(typename, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD3_(typename, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD4_(typename, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD5_(typename, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD6_(typename, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD7_(typename, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD8_(typename, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD9_(typename, const, ct, m, __VA_ARGS__)
#define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
    GMOCK_METHOD10_(typename, const, ct, m, __VA_ARGS__)
880

881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
// A MockFunction<F> class has one mock method whose type is F.  It is
// useful when you just want your test code to emit some messages and
// have Google Mock verify the right messages are sent (and perhaps at
// the right times).  For example, if you are exercising code:
//
//   Foo(1);
//   Foo(2);
//   Foo(3);
//
// and want to verify that Foo(1) and Foo(3) both invoke
// mock.Bar("a"), but Foo(2) doesn't invoke anything, you can write:
//
// TEST(FooTest, InvokesBarCorrectly) {
//   MyMock mock;
//   MockFunction<void(string check_point_name)> check;
//   {
//     InSequence s;
//
//     EXPECT_CALL(mock, Bar("a"));
//     EXPECT_CALL(check, Call("1"));
//     EXPECT_CALL(check, Call("2"));
//     EXPECT_CALL(mock, Bar("a"));
//   }
//   Foo(1);
//   check.Call("1");
//   Foo(2);
//   check.Call("2");
//   Foo(3);
// }
//
// The expectation spec says that the first Bar("a") must happen
// before check point "1", the second Bar("a") must happen after check
// point "2", and nothing should happen between the two check
// points. The explicit check points make it easy to tell which
// Bar("a") is called by which call to Foo().
916
917
918
919
920
921
922
923
924
925
926
//
// MockFunction<F> can also be used to exercise code that accepts
// std::function<F> callbacks. To do so, use AsStdFunction() method
// to create std::function proxy forwarding to original object's Call.
// Example:
//
// TEST(FooTest, RunsCallbackWithBarArgument) {
//   MockFunction<int(string)> callback;
//   EXPECT_CALL(callback, Call("bar")).WillOnce(Return(1));
//   Foo(callback.AsStdFunction());
// }
927
928
929
930
931
932
template <typename F>
class MockFunction;

template <typename R>
class MockFunction<R()> {
 public:
933
934
  MockFunction() {}

935
  MOCK_METHOD0_T(Call, R());
936

937
#if GTEST_HAS_STD_FUNCTION_
Gennadiy Civil's avatar
Gennadiy Civil committed
938
  ::std::function<R()> AsStdFunction() {
939
    return [this]() -> R {
940
941
942
      return this->Call();
    };
  }
943
#endif  // GTEST_HAS_STD_FUNCTION_
944

945
946
 private:
  GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
947
948
949
950
951
};

template <typename R, typename A0>
class MockFunction<R(A0)> {
 public:
952
953
  MockFunction() {}

954
  MOCK_METHOD1_T(Call, R(A0));
955

956
#if GTEST_HAS_STD_FUNCTION_
Gennadiy Civil's avatar
Gennadiy Civil committed
957
  ::std::function<R(A0)> AsStdFunction() {
958
    return [this](A0 a0) -> R {
Gennadiy Civil's avatar
Gennadiy Civil committed
959
      return this->Call(::std::move(a0));
960
961
    };
  }
962
#endif  // GTEST_HAS_STD_FUNCTION_
963

964
965
 private:
  GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
966
967
968
969
970
};

template <typename R, typename A0, typename A1>
class MockFunction<R(A0, A1)> {
 public:
971
972
  MockFunction() {}

973
  MOCK_METHOD2_T(Call, R(A0, A1));
974

975
#if GTEST_HAS_STD_FUNCTION_
Gennadiy Civil's avatar
Gennadiy Civil committed
976
  ::std::function<R(A0, A1)> AsStdFunction() {
977
    return [this](A0 a0, A1 a1) -> R {
Gennadiy Civil's avatar
Gennadiy Civil committed
978
      return this->Call(::std::move(a0), ::std::move(a1));
979
980
    };
  }
981
#endif  // GTEST_HAS_STD_FUNCTION_
982

983
984
 private:
  GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
985
986
987
988
989
};

template <typename R, typename A0, typename A1, typename A2>
class MockFunction<R(A0, A1, A2)> {
 public:
990
991
  MockFunction() {}

992
  MOCK_METHOD3_T(Call, R(A0, A1, A2));
993

994
#if GTEST_HAS_STD_FUNCTION_
Gennadiy Civil's avatar
Gennadiy Civil committed
995
  ::std::function<R(A0, A1, A2)> AsStdFunction() {
996
    return [this](A0 a0, A1 a1, A2 a2) -> R {
Gennadiy Civil's avatar
Gennadiy Civil committed
997
      return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2));
998
999
    };
  }
1000
#endif  // GTEST_HAS_STD_FUNCTION_
1001

1002
1003
 private:
  GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1004
1005
1006
1007
1008
};

template <typename R, typename A0, typename A1, typename A2, typename A3>
class MockFunction<R(A0, A1, A2, A3)> {
 public:
1009
1010
  MockFunction() {}

1011
  MOCK_METHOD4_T(Call, R(A0, A1, A2, A3));
1012

1013
#if GTEST_HAS_STD_FUNCTION_
Gennadiy Civil's avatar
Gennadiy Civil committed
1014
  ::std::function<R(A0, A1, A2, A3)> AsStdFunction() {
1015
    return [this](A0 a0, A1 a1, A2 a2, A3 a3) -> R {
Gennadiy Civil's avatar
Gennadiy Civil committed
1016
1017
      return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2),
          ::std::move(a3));
1018
1019
    };
  }
1020
#endif  // GTEST_HAS_STD_FUNCTION_
1021

1022
1023
 private:
  GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1024
1025
1026
1027
1028
1029
};

template <typename R, typename A0, typename A1, typename A2, typename A3,
    typename A4>
class MockFunction<R(A0, A1, A2, A3, A4)> {
 public:
1030
1031
  MockFunction() {}

1032
  MOCK_METHOD5_T(Call, R(A0, A1, A2, A3, A4));
1033

1034
#if GTEST_HAS_STD_FUNCTION_
Gennadiy Civil's avatar
Gennadiy Civil committed
1035
  ::std::function<R(A0, A1, A2, A3, A4)> AsStdFunction() {
1036
    return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) -> R {
Gennadiy Civil's avatar
Gennadiy Civil committed
1037
1038
      return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2),
          ::std::move(a3), ::std::move(a4));
1039
1040
    };
  }
1041
#endif  // GTEST_HAS_STD_FUNCTION_
1042

1043
1044
 private:
  GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1045
1046
1047
1048
1049
1050
};

template <typename R, typename A0, typename A1, typename A2, typename A3,
    typename A4, typename A5>
class MockFunction<R(A0, A1, A2, A3, A4, A5)> {
 public:
1051
1052
  MockFunction() {}

1053
  MOCK_METHOD6_T(Call, R(A0, A1, A2, A3, A4, A5));
1054

1055
#if GTEST_HAS_STD_FUNCTION_
Gennadiy Civil's avatar
Gennadiy Civil committed
1056
  ::std::function<R(A0, A1, A2, A3, A4, A5)> AsStdFunction() {
1057
    return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -> R {
Gennadiy Civil's avatar
Gennadiy Civil committed
1058
1059
      return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2),
          ::std::move(a3), ::std::move(a4), ::std::move(a5));
1060
1061
    };
  }
1062
#endif  // GTEST_HAS_STD_FUNCTION_
1063

1064
1065
 private:
  GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1066
1067
1068
1069
1070
1071
};

template <typename R, typename A0, typename A1, typename A2, typename A3,
    typename A4, typename A5, typename A6>
class MockFunction<R(A0, A1, A2, A3, A4, A5, A6)> {
 public:
1072
1073
  MockFunction() {}

1074
  MOCK_METHOD7_T(Call, R(A0, A1, A2, A3, A4, A5, A6));
1075

1076
#if GTEST_HAS_STD_FUNCTION_
Gennadiy Civil's avatar
Gennadiy Civil committed
1077
  ::std::function<R(A0, A1, A2, A3, A4, A5, A6)> AsStdFunction() {
1078
    return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -> R {
Gennadiy Civil's avatar
Gennadiy Civil committed
1079
1080
      return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2),
          ::std::move(a3), ::std::move(a4), ::std::move(a5), ::std::move(a6));
1081
1082
    };
  }
1083
#endif  // GTEST_HAS_STD_FUNCTION_
1084

1085
1086
 private:
  GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1087
1088
1089
1090
1091
1092
};

template <typename R, typename A0, typename A1, typename A2, typename A3,
    typename A4, typename A5, typename A6, typename A7>
class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7)> {
 public:
1093
1094
  MockFunction() {}

1095
  MOCK_METHOD8_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7));
1096

1097
#if GTEST_HAS_STD_FUNCTION_
Gennadiy Civil's avatar
Gennadiy Civil committed
1098
  ::std::function<R(A0, A1, A2, A3, A4, A5, A6, A7)> AsStdFunction() {
1099
    return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -> R {
Gennadiy Civil's avatar
Gennadiy Civil committed
1100
1101
1102
      return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2),
          ::std::move(a3), ::std::move(a4), ::std::move(a5), ::std::move(a6),
          ::std::move(a7));
1103
1104
    };
  }
1105
#endif  // GTEST_HAS_STD_FUNCTION_
1106

1107
1108
 private:
  GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1109
1110
1111
1112
1113
1114
};

template <typename R, typename A0, typename A1, typename A2, typename A3,
    typename A4, typename A5, typename A6, typename A7, typename A8>
class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> {
 public:
1115
1116
  MockFunction() {}

1117
  MOCK_METHOD9_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8));
1118

1119
#if GTEST_HAS_STD_FUNCTION_
Gennadiy Civil's avatar
Gennadiy Civil committed
1120
  ::std::function<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> AsStdFunction() {
1121
    return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7,
1122
        A8 a8) -> R {
Gennadiy Civil's avatar
Gennadiy Civil committed
1123
1124
1125
      return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2),
          ::std::move(a3), ::std::move(a4), ::std::move(a5), ::std::move(a6),
          ::std::move(a7), ::std::move(a8));
1126
1127
    };
  }
1128
#endif  // GTEST_HAS_STD_FUNCTION_
1129

1130
1131
 private:
  GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1132
1133
1134
1135
1136
1137
1138
};

template <typename R, typename A0, typename A1, typename A2, typename A3,
    typename A4, typename A5, typename A6, typename A7, typename A8,
    typename A9>
class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
 public:
1139
1140
  MockFunction() {}

1141
  MOCK_METHOD10_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9));
1142

1143
#if GTEST_HAS_STD_FUNCTION_
Gennadiy Civil's avatar
Gennadiy Civil committed
1144
  ::std::function<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> AsStdFunction() {
1145
    return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7,
1146
        A8 a8, A9 a9) -> R {
Gennadiy Civil's avatar
Gennadiy Civil committed
1147
1148
1149
      return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2),
          ::std::move(a3), ::std::move(a4), ::std::move(a5), ::std::move(a6),
          ::std::move(a7), ::std::move(a8), ::std::move(a9));
1150
1151
    };
  }
1152
#endif  // GTEST_HAS_STD_FUNCTION_
1153

1154
1155
 private:
  GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1156
1157
};

1158
1159
1160
}  // namespace testing

#endif  // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_