1 // This file was GENERATED by command:
2 // pump.py gmock-generated-function-mockers.h.pump
3 // DO NOT EDIT BY HAND!!!
5 // Copyright 2007, Google Inc.
6 // All rights reserved.
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions are
12 // * Redistributions of source code must retain the above copyright
13 // notice, this list of conditions and the following disclaimer.
14 // * Redistributions in binary form must reproduce the above
15 // copyright notice, this list of conditions and the following disclaimer
16 // in the documentation and/or other materials provided with the
18 // * Neither the name of Google Inc. nor the names of its
19 // contributors may be used to endorse or promote products derived from
20 // this software without specific prior written permission.
22 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 // Google Mock - a framework for writing C++ mock classes.
37 // This file implements function mockers of various arities.
39 // GOOGLETEST_CM0002 DO NOT DELETE
41 #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
42 #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
44 #include "gmock/gmock-spec-builders.h"
45 #include "gmock/internal/gmock-internal-utils.h"
47 #if GTEST_HAS_STD_FUNCTION_
48 # include <functional>
55 class FunctionMockerBase;
57 // Note: class FunctionMocker really belongs to the ::testing
58 // namespace. However if we define it in ::testing, MSVC will
59 // complain when classes in ::testing::internal declare it as a
60 // friend class template. To workaround this compiler bug, we define
61 // FunctionMocker in ::testing::internal and import it into ::testing.
66 class FunctionMocker<R()> : public
67 internal::FunctionMockerBase<R()> {
70 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
73 return MockSpec<F>(this, ::testing::make_tuple());
77 // Even though gcc and MSVC don't enforce it, 'this->' is required
78 // by the C++ standard [14.6.4] here, as the base class type is
79 // dependent on the template argument (and thus shouldn't be
80 // looked into when resolving InvokeWith).
81 return this->InvokeWith(ArgumentTuple());
85 template <typename R, typename A1>
86 class FunctionMocker<R(A1)> : public
87 internal::FunctionMockerBase<R(A1)> {
90 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
92 MockSpec<F> With(const Matcher<A1>& m1) {
93 return MockSpec<F>(this, ::testing::make_tuple(m1));
97 // Even though gcc and MSVC don't enforce it, 'this->' is required
98 // by the C++ standard [14.6.4] here, as the base class type is
99 // dependent on the template argument (and thus shouldn't be
100 // looked into when resolving InvokeWith).
101 return this->InvokeWith(ArgumentTuple(internal::forward<A1>(a1)));
105 template <typename R, typename A1, typename A2>
106 class FunctionMocker<R(A1, A2)> : public
107 internal::FunctionMockerBase<R(A1, A2)> {
110 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
112 MockSpec<F> With(const Matcher<A1>& m1, const Matcher<A2>& m2) {
113 return MockSpec<F>(this, ::testing::make_tuple(m1, m2));
116 R Invoke(A1 a1, A2 a2) {
117 // Even though gcc and MSVC don't enforce it, 'this->' is required
118 // by the C++ standard [14.6.4] here, as the base class type is
119 // dependent on the template argument (and thus shouldn't be
120 // looked into when resolving InvokeWith).
121 return this->InvokeWith(ArgumentTuple(internal::forward<A1>(a1),
122 internal::forward<A2>(a2)));
126 template <typename R, typename A1, typename A2, typename A3>
127 class FunctionMocker<R(A1, A2, A3)> : public
128 internal::FunctionMockerBase<R(A1, A2, A3)> {
130 typedef R F(A1, A2, A3);
131 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
133 MockSpec<F> With(const Matcher<A1>& m1, const Matcher<A2>& m2,
134 const Matcher<A3>& m3) {
135 return MockSpec<F>(this, ::testing::make_tuple(m1, m2, m3));
138 R Invoke(A1 a1, A2 a2, A3 a3) {
139 // Even though gcc and MSVC don't enforce it, 'this->' is required
140 // by the C++ standard [14.6.4] here, as the base class type is
141 // dependent on the template argument (and thus shouldn't be
142 // looked into when resolving InvokeWith).
143 return this->InvokeWith(ArgumentTuple(internal::forward<A1>(a1),
144 internal::forward<A2>(a2), internal::forward<A3>(a3)));
148 template <typename R, typename A1, typename A2, typename A3, typename A4>
149 class FunctionMocker<R(A1, A2, A3, A4)> : public
150 internal::FunctionMockerBase<R(A1, A2, A3, A4)> {
152 typedef R F(A1, A2, A3, A4);
153 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
155 MockSpec<F> With(const Matcher<A1>& m1, const Matcher<A2>& m2,
156 const Matcher<A3>& m3, const Matcher<A4>& m4) {
157 return MockSpec<F>(this, ::testing::make_tuple(m1, m2, m3, m4));
160 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4) {
161 // Even though gcc and MSVC don't enforce it, 'this->' is required
162 // by the C++ standard [14.6.4] here, as the base class type is
163 // dependent on the template argument (and thus shouldn't be
164 // looked into when resolving InvokeWith).
165 return this->InvokeWith(ArgumentTuple(internal::forward<A1>(a1),
166 internal::forward<A2>(a2), internal::forward<A3>(a3),
167 internal::forward<A4>(a4)));
171 template <typename R, typename A1, typename A2, typename A3, typename A4,
173 class FunctionMocker<R(A1, A2, A3, A4, A5)> : public
174 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5)> {
176 typedef R F(A1, A2, A3, A4, A5);
177 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
179 MockSpec<F> With(const Matcher<A1>& m1, const Matcher<A2>& m2,
180 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5) {
181 return MockSpec<F>(this, ::testing::make_tuple(m1, m2, m3, m4, m5));
184 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
185 // Even though gcc and MSVC don't enforce it, 'this->' is required
186 // by the C++ standard [14.6.4] here, as the base class type is
187 // dependent on the template argument (and thus shouldn't be
188 // looked into when resolving InvokeWith).
189 return this->InvokeWith(ArgumentTuple(internal::forward<A1>(a1),
190 internal::forward<A2>(a2), internal::forward<A3>(a3),
191 internal::forward<A4>(a4), internal::forward<A5>(a5)));
195 template <typename R, typename A1, typename A2, typename A3, typename A4,
196 typename A5, typename A6>
197 class FunctionMocker<R(A1, A2, A3, A4, A5, A6)> : public
198 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6)> {
200 typedef R F(A1, A2, A3, A4, A5, A6);
201 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
203 MockSpec<F> With(const Matcher<A1>& m1, const Matcher<A2>& m2,
204 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
205 const Matcher<A6>& m6) {
206 return MockSpec<F>(this, ::testing::make_tuple(m1, m2, m3, m4, m5, m6));
209 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) {
210 // Even though gcc and MSVC don't enforce it, 'this->' is required
211 // by the C++ standard [14.6.4] here, as the base class type is
212 // dependent on the template argument (and thus shouldn't be
213 // looked into when resolving InvokeWith).
214 return this->InvokeWith(ArgumentTuple(internal::forward<A1>(a1),
215 internal::forward<A2>(a2), internal::forward<A3>(a3),
216 internal::forward<A4>(a4), internal::forward<A5>(a5),
217 internal::forward<A6>(a6)));
221 template <typename R, typename A1, typename A2, typename A3, typename A4,
222 typename A5, typename A6, typename A7>
223 class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7)> : public
224 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7)> {
226 typedef R F(A1, A2, A3, A4, A5, A6, A7);
227 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
229 MockSpec<F> With(const Matcher<A1>& m1, const Matcher<A2>& m2,
230 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
231 const Matcher<A6>& m6, const Matcher<A7>& m7) {
232 return MockSpec<F>(this, ::testing::make_tuple(m1, m2, m3, m4, m5, m6, m7));
235 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) {
236 // Even though gcc and MSVC don't enforce it, 'this->' is required
237 // by the C++ standard [14.6.4] here, as the base class type is
238 // dependent on the template argument (and thus shouldn't be
239 // looked into when resolving InvokeWith).
240 return this->InvokeWith(ArgumentTuple(internal::forward<A1>(a1),
241 internal::forward<A2>(a2), internal::forward<A3>(a3),
242 internal::forward<A4>(a4), internal::forward<A5>(a5),
243 internal::forward<A6>(a6), internal::forward<A7>(a7)));
247 template <typename R, typename A1, typename A2, typename A3, typename A4,
248 typename A5, typename A6, typename A7, typename A8>
249 class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8)> : public
250 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8)> {
252 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8);
253 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
255 MockSpec<F> With(const Matcher<A1>& m1, const Matcher<A2>& m2,
256 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
257 const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8) {
258 return MockSpec<F>(this, ::testing::make_tuple(m1, m2, m3, m4, m5, m6, m7,
262 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) {
263 // Even though gcc and MSVC don't enforce it, 'this->' is required
264 // by the C++ standard [14.6.4] here, as the base class type is
265 // dependent on the template argument (and thus shouldn't be
266 // looked into when resolving InvokeWith).
267 return this->InvokeWith(ArgumentTuple(internal::forward<A1>(a1),
268 internal::forward<A2>(a2), internal::forward<A3>(a3),
269 internal::forward<A4>(a4), internal::forward<A5>(a5),
270 internal::forward<A6>(a6), internal::forward<A7>(a7),
271 internal::forward<A8>(a8)));
275 template <typename R, typename A1, typename A2, typename A3, typename A4,
276 typename A5, typename A6, typename A7, typename A8, typename A9>
277 class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> : public
278 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
280 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9);
281 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
283 MockSpec<F> With(const Matcher<A1>& m1, const Matcher<A2>& m2,
284 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
285 const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8,
286 const Matcher<A9>& m9) {
287 return MockSpec<F>(this, ::testing::make_tuple(m1, m2, m3, m4, m5, m6, m7,
291 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) {
292 // Even though gcc and MSVC don't enforce it, 'this->' is required
293 // by the C++ standard [14.6.4] here, as the base class type is
294 // dependent on the template argument (and thus shouldn't be
295 // looked into when resolving InvokeWith).
296 return this->InvokeWith(ArgumentTuple(internal::forward<A1>(a1),
297 internal::forward<A2>(a2), internal::forward<A3>(a3),
298 internal::forward<A4>(a4), internal::forward<A5>(a5),
299 internal::forward<A6>(a6), internal::forward<A7>(a7),
300 internal::forward<A8>(a8), internal::forward<A9>(a9)));
304 template <typename R, typename A1, typename A2, typename A3, typename A4,
305 typename A5, typename A6, typename A7, typename A8, typename A9,
307 class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> : public
308 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> {
310 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
311 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
313 MockSpec<F> With(const Matcher<A1>& m1, const Matcher<A2>& m2,
314 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
315 const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8,
316 const Matcher<A9>& m9, const Matcher<A10>& m10) {
317 return MockSpec<F>(this, ::testing::make_tuple(m1, m2, m3, m4, m5, m6, m7,
321 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9,
323 // Even though gcc and MSVC don't enforce it, 'this->' is required
324 // by the C++ standard [14.6.4] here, as the base class type is
325 // dependent on the template argument (and thus shouldn't be
326 // looked into when resolving InvokeWith).
327 return this->InvokeWith(ArgumentTuple(internal::forward<A1>(a1),
328 internal::forward<A2>(a2), internal::forward<A3>(a3),
329 internal::forward<A4>(a4), internal::forward<A5>(a5),
330 internal::forward<A6>(a6), internal::forward<A7>(a7),
331 internal::forward<A8>(a8), internal::forward<A9>(a9),
332 internal::forward<A10>(a10)));
336 // Removes the given pointer; this is a helper for the expectation setter method
337 // for parameterless matchers.
339 // We want to make sure that the user cannot set a parameterless expectation on
340 // overloaded methods, including methods which are overloaded on const. Example:
343 // MOCK_METHOD0(GetName, string&());
344 // MOCK_CONST_METHOD0(GetName, const string&());
348 // // This should be an error, as it's not clear which overload is expected.
349 // EXPECT_CALL(mock, GetName).WillOnce(ReturnRef(value));
352 // Here are the generated expectation-setter methods:
356 // MockSpec<string&()> gmock_GetName() { ... }
357 // // Overload 2. Declared const so that the compiler will generate an
358 // // error when trying to resolve between this and overload 4 in
359 // // 'gmock_GetName(WithoutMatchers(), nullptr)'.
360 // MockSpec<string&()> gmock_GetName(
361 // const WithoutMatchers&, const Function<string&()>*) const {
362 // // Removes const from this, calls overload 1
363 // return AdjustConstness_(this)->gmock_GetName();
367 // const string& gmock_GetName() const { ... }
369 // MockSpec<const string&()> gmock_GetName(
370 // const WithoutMatchers&, const Function<const string&()>*) const {
371 // // Does not remove const, calls overload 3
372 // return AdjustConstness_const(this)->gmock_GetName();
376 template <typename MockType>
377 const MockType* AdjustConstness_const(const MockType* mock) {
381 // Removes const from and returns the given pointer; this is a helper for the
382 // expectation setter method for parameterless matchers.
383 template <typename MockType>
384 MockType* AdjustConstness_(const MockType* mock) {
385 return const_cast<MockType*>(mock);
388 } // namespace internal
390 // The style guide prohibits "using" statements in a namespace scope
391 // inside a header file. However, the FunctionMocker class template
392 // is meant to be defined in the ::testing namespace. The following
393 // line is just a trick for working around a bug in MSVC 8.0, which
394 // cannot handle it if we define FunctionMocker in ::testing.
395 using internal::FunctionMocker;
397 // GMOCK_RESULT_(tn, F) expands to the result type of function type F.
398 // We define this as a variadic macro in case F contains unprotected
399 // commas (the same reason that we use variadic macros in other places
401 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
402 #define GMOCK_RESULT_(tn, ...) \
403 tn ::testing::internal::Function<__VA_ARGS__>::Result
405 // The type of argument N of the given function type.
406 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
407 #define GMOCK_ARG_(tn, N, ...) \
408 tn ::testing::internal::Function<__VA_ARGS__>::Argument##N
410 // The matcher type for argument N of the given function type.
411 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
412 #define GMOCK_MATCHER_(tn, N, ...) \
413 const ::testing::Matcher<GMOCK_ARG_(tn, N, __VA_ARGS__)>&
415 // The variable for mocking the given method.
416 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
417 #define GMOCK_MOCKER_(arity, constness, Method) \
418 GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__)
420 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
421 #define GMOCK_METHOD0_(tn, constness, ct, Method, ...) \
422 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method() constness { \
423 GTEST_COMPILE_ASSERT_( \
424 (::testing::tuple_size<tn ::testing::internal::Function< \
425 __VA_ARGS__>::ArgumentTuple>::value == 0), \
426 this_method_does_not_take_0_arguments); \
427 GMOCK_MOCKER_(0, constness, Method).SetOwnerAndName(this, #Method); \
428 return GMOCK_MOCKER_(0, constness, Method).Invoke(); \
430 ::testing::MockSpec<__VA_ARGS__> gmock_##Method() constness { \
431 GMOCK_MOCKER_(0, constness, Method).RegisterOwner(this); \
432 return GMOCK_MOCKER_(0, constness, Method).With(); \
434 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
435 const ::testing::internal::WithoutMatchers&, \
436 constness ::testing::internal::Function<__VA_ARGS__>*) const { \
437 return ::testing::internal::AdjustConstness_##constness(this) \
438 ->gmock_##Method(); \
440 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(0, constness, \
443 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
444 #define GMOCK_METHOD1_(tn, constness, ct, Method, ...) \
445 GMOCK_RESULT_(tn, __VA_ARGS__) \
446 ct Method(GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1) constness { \
447 GTEST_COMPILE_ASSERT_( \
448 (::testing::tuple_size<tn ::testing::internal::Function< \
449 __VA_ARGS__>::ArgumentTuple>::value == 1), \
450 this_method_does_not_take_1_argument); \
451 GMOCK_MOCKER_(1, constness, Method).SetOwnerAndName(this, #Method); \
452 return GMOCK_MOCKER_(1, constness, Method) \
453 .Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, __VA_ARGS__)>( \
456 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
457 GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1) constness { \
458 GMOCK_MOCKER_(1, constness, Method).RegisterOwner(this); \
459 return GMOCK_MOCKER_(1, constness, Method).With(gmock_a1); \
461 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
462 const ::testing::internal::WithoutMatchers&, \
463 constness ::testing::internal::Function<__VA_ARGS__>*) const { \
464 return ::testing::internal::AdjustConstness_##constness(this) \
465 ->gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>()); \
467 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(1, constness, \
470 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
471 #define GMOCK_METHOD2_(tn, constness, ct, Method, ...) \
472 GMOCK_RESULT_(tn, __VA_ARGS__) \
473 ct Method(GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
474 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2) constness { \
475 GTEST_COMPILE_ASSERT_( \
476 (::testing::tuple_size<tn ::testing::internal::Function< \
477 __VA_ARGS__>::ArgumentTuple>::value == 2), \
478 this_method_does_not_take_2_arguments); \
479 GMOCK_MOCKER_(2, constness, Method).SetOwnerAndName(this, #Method); \
480 return GMOCK_MOCKER_(2, constness, Method) \
481 .Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, __VA_ARGS__)>( \
483 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
486 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
487 GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
488 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2) constness { \
489 GMOCK_MOCKER_(2, constness, Method).RegisterOwner(this); \
490 return GMOCK_MOCKER_(2, constness, Method).With(gmock_a1, gmock_a2); \
492 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
493 const ::testing::internal::WithoutMatchers&, \
494 constness ::testing::internal::Function<__VA_ARGS__>*) const { \
495 return ::testing::internal::AdjustConstness_##constness(this) \
496 ->gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \
497 ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>()); \
499 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(2, constness, \
502 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
503 #define GMOCK_METHOD3_(tn, constness, ct, Method, ...) \
504 GMOCK_RESULT_(tn, __VA_ARGS__) \
505 ct Method(GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
506 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
507 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3) constness { \
508 GTEST_COMPILE_ASSERT_( \
509 (::testing::tuple_size<tn ::testing::internal::Function< \
510 __VA_ARGS__>::ArgumentTuple>::value == 3), \
511 this_method_does_not_take_3_arguments); \
512 GMOCK_MOCKER_(3, constness, Method).SetOwnerAndName(this, #Method); \
513 return GMOCK_MOCKER_(3, constness, Method) \
514 .Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, __VA_ARGS__)>( \
516 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
518 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
521 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
522 GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
523 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
524 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3) constness { \
525 GMOCK_MOCKER_(3, constness, Method).RegisterOwner(this); \
526 return GMOCK_MOCKER_(3, constness, Method) \
527 .With(gmock_a1, gmock_a2, gmock_a3); \
529 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
530 const ::testing::internal::WithoutMatchers&, \
531 constness ::testing::internal::Function<__VA_ARGS__>*) const { \
532 return ::testing::internal::AdjustConstness_##constness(this) \
533 ->gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \
534 ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \
535 ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>()); \
537 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(3, constness, \
540 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
541 #define GMOCK_METHOD4_(tn, constness, ct, Method, ...) \
542 GMOCK_RESULT_(tn, __VA_ARGS__) \
543 ct Method(GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
544 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
545 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
546 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4) constness { \
547 GTEST_COMPILE_ASSERT_( \
548 (::testing::tuple_size<tn ::testing::internal::Function< \
549 __VA_ARGS__>::ArgumentTuple>::value == 4), \
550 this_method_does_not_take_4_arguments); \
551 GMOCK_MOCKER_(4, constness, Method).SetOwnerAndName(this, #Method); \
552 return GMOCK_MOCKER_(4, constness, Method) \
553 .Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, __VA_ARGS__)>( \
555 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
557 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
559 ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>( \
562 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
563 GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
564 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
565 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
566 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4) constness { \
567 GMOCK_MOCKER_(4, constness, Method).RegisterOwner(this); \
568 return GMOCK_MOCKER_(4, constness, Method) \
569 .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4); \
571 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
572 const ::testing::internal::WithoutMatchers&, \
573 constness ::testing::internal::Function<__VA_ARGS__>*) const { \
574 return ::testing::internal::AdjustConstness_##constness(this) \
575 ->gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \
576 ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \
577 ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(), \
578 ::testing::A<GMOCK_ARG_(tn, 4, __VA_ARGS__)>()); \
580 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(4, constness, \
583 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
584 #define GMOCK_METHOD5_(tn, constness, ct, Method, ...) \
585 GMOCK_RESULT_(tn, __VA_ARGS__) \
586 ct Method(GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
587 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
588 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
589 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
590 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5) constness { \
591 GTEST_COMPILE_ASSERT_( \
592 (::testing::tuple_size<tn ::testing::internal::Function< \
593 __VA_ARGS__>::ArgumentTuple>::value == 5), \
594 this_method_does_not_take_5_arguments); \
595 GMOCK_MOCKER_(5, constness, Method).SetOwnerAndName(this, #Method); \
596 return GMOCK_MOCKER_(5, constness, Method) \
597 .Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, __VA_ARGS__)>( \
599 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
601 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
603 ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>( \
605 ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>( \
608 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
609 GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
610 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
611 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
612 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
613 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5) constness { \
614 GMOCK_MOCKER_(5, constness, Method).RegisterOwner(this); \
615 return GMOCK_MOCKER_(5, constness, Method) \
616 .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5); \
618 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
619 const ::testing::internal::WithoutMatchers&, \
620 constness ::testing::internal::Function<__VA_ARGS__>*) const { \
621 return ::testing::internal::AdjustConstness_##constness(this) \
622 ->gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \
623 ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \
624 ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(), \
625 ::testing::A<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(), \
626 ::testing::A<GMOCK_ARG_(tn, 5, __VA_ARGS__)>()); \
628 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(5, constness, \
631 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
632 #define GMOCK_METHOD6_(tn, constness, ct, Method, ...) \
633 GMOCK_RESULT_(tn, __VA_ARGS__) \
634 ct Method(GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
635 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
636 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
637 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
638 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
639 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6) constness { \
640 GTEST_COMPILE_ASSERT_( \
641 (::testing::tuple_size<tn ::testing::internal::Function< \
642 __VA_ARGS__>::ArgumentTuple>::value == 6), \
643 this_method_does_not_take_6_arguments); \
644 GMOCK_MOCKER_(6, constness, Method).SetOwnerAndName(this, #Method); \
645 return GMOCK_MOCKER_(6, constness, Method) \
646 .Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, __VA_ARGS__)>( \
648 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
650 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
652 ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>( \
654 ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>( \
656 ::testing::internal::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>( \
659 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
660 GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
661 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
662 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
663 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
664 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
665 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6) constness { \
666 GMOCK_MOCKER_(6, constness, Method).RegisterOwner(this); \
667 return GMOCK_MOCKER_(6, constness, Method) \
668 .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6); \
670 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
671 const ::testing::internal::WithoutMatchers&, \
672 constness ::testing::internal::Function<__VA_ARGS__>*) const { \
673 return ::testing::internal::AdjustConstness_##constness(this) \
674 ->gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \
675 ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \
676 ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(), \
677 ::testing::A<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(), \
678 ::testing::A<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(), \
679 ::testing::A<GMOCK_ARG_(tn, 6, __VA_ARGS__)>()); \
681 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(6, constness, \
684 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
685 #define GMOCK_METHOD7_(tn, constness, ct, Method, ...) \
686 GMOCK_RESULT_(tn, __VA_ARGS__) \
687 ct Method(GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
688 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
689 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
690 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
691 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
692 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
693 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7) constness { \
694 GTEST_COMPILE_ASSERT_( \
695 (::testing::tuple_size<tn ::testing::internal::Function< \
696 __VA_ARGS__>::ArgumentTuple>::value == 7), \
697 this_method_does_not_take_7_arguments); \
698 GMOCK_MOCKER_(7, constness, Method).SetOwnerAndName(this, #Method); \
699 return GMOCK_MOCKER_(7, constness, Method) \
700 .Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, __VA_ARGS__)>( \
702 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
704 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
706 ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>( \
708 ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>( \
710 ::testing::internal::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>( \
712 ::testing::internal::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>( \
715 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
716 GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
717 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
718 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
719 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
720 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
721 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
722 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7) constness { \
723 GMOCK_MOCKER_(7, constness, Method).RegisterOwner(this); \
724 return GMOCK_MOCKER_(7, constness, Method) \
725 .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6, \
728 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
729 const ::testing::internal::WithoutMatchers&, \
730 constness ::testing::internal::Function<__VA_ARGS__>*) const { \
731 return ::testing::internal::AdjustConstness_##constness(this) \
732 ->gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \
733 ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \
734 ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(), \
735 ::testing::A<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(), \
736 ::testing::A<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(), \
737 ::testing::A<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(), \
738 ::testing::A<GMOCK_ARG_(tn, 7, __VA_ARGS__)>()); \
740 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(7, constness, \
743 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
744 #define GMOCK_METHOD8_(tn, constness, ct, Method, ...) \
745 GMOCK_RESULT_(tn, __VA_ARGS__) \
746 ct Method(GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
747 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
748 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
749 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
750 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
751 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
752 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
753 GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8) constness { \
754 GTEST_COMPILE_ASSERT_( \
755 (::testing::tuple_size<tn ::testing::internal::Function< \
756 __VA_ARGS__>::ArgumentTuple>::value == 8), \
757 this_method_does_not_take_8_arguments); \
758 GMOCK_MOCKER_(8, constness, Method).SetOwnerAndName(this, #Method); \
759 return GMOCK_MOCKER_(8, constness, Method) \
760 .Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, __VA_ARGS__)>( \
762 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
764 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
766 ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>( \
768 ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>( \
770 ::testing::internal::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>( \
772 ::testing::internal::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>( \
774 ::testing::internal::forward<GMOCK_ARG_(tn, 8, __VA_ARGS__)>( \
777 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
778 GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
779 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
780 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
781 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
782 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
783 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
784 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
785 GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8) constness { \
786 GMOCK_MOCKER_(8, constness, Method).RegisterOwner(this); \
787 return GMOCK_MOCKER_(8, constness, Method) \
788 .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6, \
789 gmock_a7, gmock_a8); \
791 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
792 const ::testing::internal::WithoutMatchers&, \
793 constness ::testing::internal::Function<__VA_ARGS__>*) const { \
794 return ::testing::internal::AdjustConstness_##constness(this) \
795 ->gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \
796 ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \
797 ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(), \
798 ::testing::A<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(), \
799 ::testing::A<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(), \
800 ::testing::A<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(), \
801 ::testing::A<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(), \
802 ::testing::A<GMOCK_ARG_(tn, 8, __VA_ARGS__)>()); \
804 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(8, constness, \
807 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
808 #define GMOCK_METHOD9_(tn, constness, ct, Method, ...) \
809 GMOCK_RESULT_(tn, __VA_ARGS__) \
810 ct Method(GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
811 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
812 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
813 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
814 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
815 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
816 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
817 GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8, \
818 GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9) constness { \
819 GTEST_COMPILE_ASSERT_( \
820 (::testing::tuple_size<tn ::testing::internal::Function< \
821 __VA_ARGS__>::ArgumentTuple>::value == 9), \
822 this_method_does_not_take_9_arguments); \
823 GMOCK_MOCKER_(9, constness, Method).SetOwnerAndName(this, #Method); \
824 return GMOCK_MOCKER_(9, constness, Method) \
825 .Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, __VA_ARGS__)>( \
827 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
829 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
831 ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>( \
833 ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>( \
835 ::testing::internal::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>( \
837 ::testing::internal::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>( \
839 ::testing::internal::forward<GMOCK_ARG_(tn, 8, __VA_ARGS__)>( \
841 ::testing::internal::forward<GMOCK_ARG_(tn, 9, __VA_ARGS__)>( \
844 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
845 GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
846 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
847 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
848 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
849 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
850 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
851 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
852 GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \
853 GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9) constness { \
854 GMOCK_MOCKER_(9, constness, Method).RegisterOwner(this); \
855 return GMOCK_MOCKER_(9, constness, Method) \
856 .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6, \
857 gmock_a7, gmock_a8, gmock_a9); \
859 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
860 const ::testing::internal::WithoutMatchers&, \
861 constness ::testing::internal::Function<__VA_ARGS__>*) const { \
862 return ::testing::internal::AdjustConstness_##constness(this) \
863 ->gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \
864 ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \
865 ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(), \
866 ::testing::A<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(), \
867 ::testing::A<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(), \
868 ::testing::A<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(), \
869 ::testing::A<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(), \
870 ::testing::A<GMOCK_ARG_(tn, 8, __VA_ARGS__)>(), \
871 ::testing::A<GMOCK_ARG_(tn, 9, __VA_ARGS__)>()); \
873 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(9, constness, \
876 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
877 #define GMOCK_METHOD10_(tn, constness, ct, Method, ...) \
878 GMOCK_RESULT_(tn, __VA_ARGS__) \
879 ct Method(GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
880 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
881 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
882 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
883 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
884 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
885 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
886 GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8, \
887 GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9, \
888 GMOCK_ARG_(tn, 10, __VA_ARGS__) gmock_a10) constness { \
889 GTEST_COMPILE_ASSERT_( \
890 (::testing::tuple_size<tn ::testing::internal::Function< \
891 __VA_ARGS__>::ArgumentTuple>::value == 10), \
892 this_method_does_not_take_10_arguments); \
893 GMOCK_MOCKER_(10, constness, Method).SetOwnerAndName(this, #Method); \
894 return GMOCK_MOCKER_(10, constness, Method) \
895 .Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, __VA_ARGS__)>( \
897 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
899 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
901 ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>( \
903 ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>( \
905 ::testing::internal::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>( \
907 ::testing::internal::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>( \
909 ::testing::internal::forward<GMOCK_ARG_(tn, 8, __VA_ARGS__)>( \
911 ::testing::internal::forward<GMOCK_ARG_(tn, 9, __VA_ARGS__)>( \
913 ::testing::internal::forward<GMOCK_ARG_(tn, 10, __VA_ARGS__)>( \
916 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
917 GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
918 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
919 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
920 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
921 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
922 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
923 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
924 GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \
925 GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9, \
926 GMOCK_MATCHER_(tn, 10, __VA_ARGS__) gmock_a10) constness { \
927 GMOCK_MOCKER_(10, constness, Method).RegisterOwner(this); \
928 return GMOCK_MOCKER_(10, constness, Method) \
929 .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6, \
930 gmock_a7, gmock_a8, gmock_a9, gmock_a10); \
932 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
933 const ::testing::internal::WithoutMatchers&, \
934 constness ::testing::internal::Function<__VA_ARGS__>*) const { \
935 return ::testing::internal::AdjustConstness_##constness(this) \
936 ->gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \
937 ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \
938 ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(), \
939 ::testing::A<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(), \
940 ::testing::A<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(), \
941 ::testing::A<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(), \
942 ::testing::A<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(), \
943 ::testing::A<GMOCK_ARG_(tn, 8, __VA_ARGS__)>(), \
944 ::testing::A<GMOCK_ARG_(tn, 9, __VA_ARGS__)>(), \
945 ::testing::A<GMOCK_ARG_(tn, 10, __VA_ARGS__)>()); \
947 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(10, constness, \
950 #define MOCK_METHOD0(m, ...) GMOCK_METHOD0_(, , , m, __VA_ARGS__)
951 #define MOCK_METHOD1(m, ...) GMOCK_METHOD1_(, , , m, __VA_ARGS__)
952 #define MOCK_METHOD2(m, ...) GMOCK_METHOD2_(, , , m, __VA_ARGS__)
953 #define MOCK_METHOD3(m, ...) GMOCK_METHOD3_(, , , m, __VA_ARGS__)
954 #define MOCK_METHOD4(m, ...) GMOCK_METHOD4_(, , , m, __VA_ARGS__)
955 #define MOCK_METHOD5(m, ...) GMOCK_METHOD5_(, , , m, __VA_ARGS__)
956 #define MOCK_METHOD6(m, ...) GMOCK_METHOD6_(, , , m, __VA_ARGS__)
957 #define MOCK_METHOD7(m, ...) GMOCK_METHOD7_(, , , m, __VA_ARGS__)
958 #define MOCK_METHOD8(m, ...) GMOCK_METHOD8_(, , , m, __VA_ARGS__)
959 #define MOCK_METHOD9(m, ...) GMOCK_METHOD9_(, , , m, __VA_ARGS__)
960 #define MOCK_METHOD10(m, ...) GMOCK_METHOD10_(, , , m, __VA_ARGS__)
962 #define MOCK_CONST_METHOD0(m, ...) GMOCK_METHOD0_(, const, , m, __VA_ARGS__)
963 #define MOCK_CONST_METHOD1(m, ...) GMOCK_METHOD1_(, const, , m, __VA_ARGS__)
964 #define MOCK_CONST_METHOD2(m, ...) GMOCK_METHOD2_(, const, , m, __VA_ARGS__)
965 #define MOCK_CONST_METHOD3(m, ...) GMOCK_METHOD3_(, const, , m, __VA_ARGS__)
966 #define MOCK_CONST_METHOD4(m, ...) GMOCK_METHOD4_(, const, , m, __VA_ARGS__)
967 #define MOCK_CONST_METHOD5(m, ...) GMOCK_METHOD5_(, const, , m, __VA_ARGS__)
968 #define MOCK_CONST_METHOD6(m, ...) GMOCK_METHOD6_(, const, , m, __VA_ARGS__)
969 #define MOCK_CONST_METHOD7(m, ...) GMOCK_METHOD7_(, const, , m, __VA_ARGS__)
970 #define MOCK_CONST_METHOD8(m, ...) GMOCK_METHOD8_(, const, , m, __VA_ARGS__)
971 #define MOCK_CONST_METHOD9(m, ...) GMOCK_METHOD9_(, const, , m, __VA_ARGS__)
972 #define MOCK_CONST_METHOD10(m, ...) GMOCK_METHOD10_(, const, , m, __VA_ARGS__)
974 #define MOCK_METHOD0_T(m, ...) GMOCK_METHOD0_(typename, , , m, __VA_ARGS__)
975 #define MOCK_METHOD1_T(m, ...) GMOCK_METHOD1_(typename, , , m, __VA_ARGS__)
976 #define MOCK_METHOD2_T(m, ...) GMOCK_METHOD2_(typename, , , m, __VA_ARGS__)
977 #define MOCK_METHOD3_T(m, ...) GMOCK_METHOD3_(typename, , , m, __VA_ARGS__)
978 #define MOCK_METHOD4_T(m, ...) GMOCK_METHOD4_(typename, , , m, __VA_ARGS__)
979 #define MOCK_METHOD5_T(m, ...) GMOCK_METHOD5_(typename, , , m, __VA_ARGS__)
980 #define MOCK_METHOD6_T(m, ...) GMOCK_METHOD6_(typename, , , m, __VA_ARGS__)
981 #define MOCK_METHOD7_T(m, ...) GMOCK_METHOD7_(typename, , , m, __VA_ARGS__)
982 #define MOCK_METHOD8_T(m, ...) GMOCK_METHOD8_(typename, , , m, __VA_ARGS__)
983 #define MOCK_METHOD9_T(m, ...) GMOCK_METHOD9_(typename, , , m, __VA_ARGS__)
984 #define MOCK_METHOD10_T(m, ...) GMOCK_METHOD10_(typename, , , m, __VA_ARGS__)
986 #define MOCK_CONST_METHOD0_T(m, ...) \
987 GMOCK_METHOD0_(typename, const, , m, __VA_ARGS__)
988 #define MOCK_CONST_METHOD1_T(m, ...) \
989 GMOCK_METHOD1_(typename, const, , m, __VA_ARGS__)
990 #define MOCK_CONST_METHOD2_T(m, ...) \
991 GMOCK_METHOD2_(typename, const, , m, __VA_ARGS__)
992 #define MOCK_CONST_METHOD3_T(m, ...) \
993 GMOCK_METHOD3_(typename, const, , m, __VA_ARGS__)
994 #define MOCK_CONST_METHOD4_T(m, ...) \
995 GMOCK_METHOD4_(typename, const, , m, __VA_ARGS__)
996 #define MOCK_CONST_METHOD5_T(m, ...) \
997 GMOCK_METHOD5_(typename, const, , m, __VA_ARGS__)
998 #define MOCK_CONST_METHOD6_T(m, ...) \
999 GMOCK_METHOD6_(typename, const, , m, __VA_ARGS__)
1000 #define MOCK_CONST_METHOD7_T(m, ...) \
1001 GMOCK_METHOD7_(typename, const, , m, __VA_ARGS__)
1002 #define MOCK_CONST_METHOD8_T(m, ...) \
1003 GMOCK_METHOD8_(typename, const, , m, __VA_ARGS__)
1004 #define MOCK_CONST_METHOD9_T(m, ...) \
1005 GMOCK_METHOD9_(typename, const, , m, __VA_ARGS__)
1006 #define MOCK_CONST_METHOD10_T(m, ...) \
1007 GMOCK_METHOD10_(typename, const, , m, __VA_ARGS__)
1009 #define MOCK_METHOD0_WITH_CALLTYPE(ct, m, ...) \
1010 GMOCK_METHOD0_(, , ct, m, __VA_ARGS__)
1011 #define MOCK_METHOD1_WITH_CALLTYPE(ct, m, ...) \
1012 GMOCK_METHOD1_(, , ct, m, __VA_ARGS__)
1013 #define MOCK_METHOD2_WITH_CALLTYPE(ct, m, ...) \
1014 GMOCK_METHOD2_(, , ct, m, __VA_ARGS__)
1015 #define MOCK_METHOD3_WITH_CALLTYPE(ct, m, ...) \
1016 GMOCK_METHOD3_(, , ct, m, __VA_ARGS__)
1017 #define MOCK_METHOD4_WITH_CALLTYPE(ct, m, ...) \
1018 GMOCK_METHOD4_(, , ct, m, __VA_ARGS__)
1019 #define MOCK_METHOD5_WITH_CALLTYPE(ct, m, ...) \
1020 GMOCK_METHOD5_(, , ct, m, __VA_ARGS__)
1021 #define MOCK_METHOD6_WITH_CALLTYPE(ct, m, ...) \
1022 GMOCK_METHOD6_(, , ct, m, __VA_ARGS__)
1023 #define MOCK_METHOD7_WITH_CALLTYPE(ct, m, ...) \
1024 GMOCK_METHOD7_(, , ct, m, __VA_ARGS__)
1025 #define MOCK_METHOD8_WITH_CALLTYPE(ct, m, ...) \
1026 GMOCK_METHOD8_(, , ct, m, __VA_ARGS__)
1027 #define MOCK_METHOD9_WITH_CALLTYPE(ct, m, ...) \
1028 GMOCK_METHOD9_(, , ct, m, __VA_ARGS__)
1029 #define MOCK_METHOD10_WITH_CALLTYPE(ct, m, ...) \
1030 GMOCK_METHOD10_(, , ct, m, __VA_ARGS__)
1032 #define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, ...) \
1033 GMOCK_METHOD0_(, const, ct, m, __VA_ARGS__)
1034 #define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, ...) \
1035 GMOCK_METHOD1_(, const, ct, m, __VA_ARGS__)
1036 #define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, ...) \
1037 GMOCK_METHOD2_(, const, ct, m, __VA_ARGS__)
1038 #define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, ...) \
1039 GMOCK_METHOD3_(, const, ct, m, __VA_ARGS__)
1040 #define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, ...) \
1041 GMOCK_METHOD4_(, const, ct, m, __VA_ARGS__)
1042 #define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, ...) \
1043 GMOCK_METHOD5_(, const, ct, m, __VA_ARGS__)
1044 #define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, ...) \
1045 GMOCK_METHOD6_(, const, ct, m, __VA_ARGS__)
1046 #define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, ...) \
1047 GMOCK_METHOD7_(, const, ct, m, __VA_ARGS__)
1048 #define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, ...) \
1049 GMOCK_METHOD8_(, const, ct, m, __VA_ARGS__)
1050 #define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, ...) \
1051 GMOCK_METHOD9_(, const, ct, m, __VA_ARGS__)
1052 #define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, ...) \
1053 GMOCK_METHOD10_(, const, ct, m, __VA_ARGS__)
1055 #define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
1056 GMOCK_METHOD0_(typename, , ct, m, __VA_ARGS__)
1057 #define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
1058 GMOCK_METHOD1_(typename, , ct, m, __VA_ARGS__)
1059 #define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
1060 GMOCK_METHOD2_(typename, , ct, m, __VA_ARGS__)
1061 #define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
1062 GMOCK_METHOD3_(typename, , ct, m, __VA_ARGS__)
1063 #define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
1064 GMOCK_METHOD4_(typename, , ct, m, __VA_ARGS__)
1065 #define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
1066 GMOCK_METHOD5_(typename, , ct, m, __VA_ARGS__)
1067 #define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
1068 GMOCK_METHOD6_(typename, , ct, m, __VA_ARGS__)
1069 #define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
1070 GMOCK_METHOD7_(typename, , ct, m, __VA_ARGS__)
1071 #define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
1072 GMOCK_METHOD8_(typename, , ct, m, __VA_ARGS__)
1073 #define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
1074 GMOCK_METHOD9_(typename, , ct, m, __VA_ARGS__)
1075 #define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
1076 GMOCK_METHOD10_(typename, , ct, m, __VA_ARGS__)
1078 #define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
1079 GMOCK_METHOD0_(typename, const, ct, m, __VA_ARGS__)
1080 #define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
1081 GMOCK_METHOD1_(typename, const, ct, m, __VA_ARGS__)
1082 #define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
1083 GMOCK_METHOD2_(typename, const, ct, m, __VA_ARGS__)
1084 #define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
1085 GMOCK_METHOD3_(typename, const, ct, m, __VA_ARGS__)
1086 #define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
1087 GMOCK_METHOD4_(typename, const, ct, m, __VA_ARGS__)
1088 #define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
1089 GMOCK_METHOD5_(typename, const, ct, m, __VA_ARGS__)
1090 #define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
1091 GMOCK_METHOD6_(typename, const, ct, m, __VA_ARGS__)
1092 #define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
1093 GMOCK_METHOD7_(typename, const, ct, m, __VA_ARGS__)
1094 #define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
1095 GMOCK_METHOD8_(typename, const, ct, m, __VA_ARGS__)
1096 #define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
1097 GMOCK_METHOD9_(typename, const, ct, m, __VA_ARGS__)
1098 #define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
1099 GMOCK_METHOD10_(typename, const, ct, m, __VA_ARGS__)
1101 // A MockFunction<F> class has one mock method whose type is F. It is
1102 // useful when you just want your test code to emit some messages and
1103 // have Google Mock verify the right messages are sent (and perhaps at
1104 // the right times). For example, if you are exercising code:
1110 // and want to verify that Foo(1) and Foo(3) both invoke
1111 // mock.Bar("a"), but Foo(2) doesn't invoke anything, you can write:
1113 // TEST(FooTest, InvokesBarCorrectly) {
1115 // MockFunction<void(string check_point_name)> check;
1119 // EXPECT_CALL(mock, Bar("a"));
1120 // EXPECT_CALL(check, Call("1"));
1121 // EXPECT_CALL(check, Call("2"));
1122 // EXPECT_CALL(mock, Bar("a"));
1131 // The expectation spec says that the first Bar("a") must happen
1132 // before check point "1", the second Bar("a") must happen after check
1133 // point "2", and nothing should happen between the two check
1134 // points. The explicit check points make it easy to tell which
1135 // Bar("a") is called by which call to Foo().
1137 // MockFunction<F> can also be used to exercise code that accepts
1138 // std::function<F> callbacks. To do so, use AsStdFunction() method
1139 // to create std::function proxy forwarding to original object's Call.
1142 // TEST(FooTest, RunsCallbackWithBarArgument) {
1143 // MockFunction<int(string)> callback;
1144 // EXPECT_CALL(callback, Call("bar")).WillOnce(Return(1));
1145 // Foo(callback.AsStdFunction());
1147 template <typename F>
1150 template <typename R>
1151 class MockFunction<R()> {
1155 MOCK_METHOD0_T(Call, R());
1157 #if GTEST_HAS_STD_FUNCTION_
1158 ::std::function<R()> AsStdFunction() {
1159 return [this]() -> R {
1160 return this->Call();
1163 #endif // GTEST_HAS_STD_FUNCTION_
1166 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1169 template <typename R, typename A0>
1170 class MockFunction<R(A0)> {
1174 MOCK_METHOD1_T(Call, R(A0));
1176 #if GTEST_HAS_STD_FUNCTION_
1177 ::std::function<R(A0)> AsStdFunction() {
1178 return [this](A0 a0) -> R {
1179 return this->Call(::std::move(a0));
1182 #endif // GTEST_HAS_STD_FUNCTION_
1185 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1188 template <typename R, typename A0, typename A1>
1189 class MockFunction<R(A0, A1)> {
1193 MOCK_METHOD2_T(Call, R(A0, A1));
1195 #if GTEST_HAS_STD_FUNCTION_
1196 ::std::function<R(A0, A1)> AsStdFunction() {
1197 return [this](A0 a0, A1 a1) -> R {
1198 return this->Call(::std::move(a0), ::std::move(a1));
1201 #endif // GTEST_HAS_STD_FUNCTION_
1204 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1207 template <typename R, typename A0, typename A1, typename A2>
1208 class MockFunction<R(A0, A1, A2)> {
1212 MOCK_METHOD3_T(Call, R(A0, A1, A2));
1214 #if GTEST_HAS_STD_FUNCTION_
1215 ::std::function<R(A0, A1, A2)> AsStdFunction() {
1216 return [this](A0 a0, A1 a1, A2 a2) -> R {
1217 return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2));
1220 #endif // GTEST_HAS_STD_FUNCTION_
1223 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1226 template <typename R, typename A0, typename A1, typename A2, typename A3>
1227 class MockFunction<R(A0, A1, A2, A3)> {
1231 MOCK_METHOD4_T(Call, R(A0, A1, A2, A3));
1233 #if GTEST_HAS_STD_FUNCTION_
1234 ::std::function<R(A0, A1, A2, A3)> AsStdFunction() {
1235 return [this](A0 a0, A1 a1, A2 a2, A3 a3) -> R {
1236 return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2),
1240 #endif // GTEST_HAS_STD_FUNCTION_
1243 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1246 template <typename R, typename A0, typename A1, typename A2, typename A3,
1248 class MockFunction<R(A0, A1, A2, A3, A4)> {
1252 MOCK_METHOD5_T(Call, R(A0, A1, A2, A3, A4));
1254 #if GTEST_HAS_STD_FUNCTION_
1255 ::std::function<R(A0, A1, A2, A3, A4)> AsStdFunction() {
1256 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) -> R {
1257 return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2),
1258 ::std::move(a3), ::std::move(a4));
1261 #endif // GTEST_HAS_STD_FUNCTION_
1264 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1267 template <typename R, typename A0, typename A1, typename A2, typename A3,
1268 typename A4, typename A5>
1269 class MockFunction<R(A0, A1, A2, A3, A4, A5)> {
1273 MOCK_METHOD6_T(Call, R(A0, A1, A2, A3, A4, A5));
1275 #if GTEST_HAS_STD_FUNCTION_
1276 ::std::function<R(A0, A1, A2, A3, A4, A5)> AsStdFunction() {
1277 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -> R {
1278 return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2),
1279 ::std::move(a3), ::std::move(a4), ::std::move(a5));
1282 #endif // GTEST_HAS_STD_FUNCTION_
1285 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1288 template <typename R, typename A0, typename A1, typename A2, typename A3,
1289 typename A4, typename A5, typename A6>
1290 class MockFunction<R(A0, A1, A2, A3, A4, A5, A6)> {
1294 MOCK_METHOD7_T(Call, R(A0, A1, A2, A3, A4, A5, A6));
1296 #if GTEST_HAS_STD_FUNCTION_
1297 ::std::function<R(A0, A1, A2, A3, A4, A5, A6)> AsStdFunction() {
1298 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -> R {
1299 return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2),
1300 ::std::move(a3), ::std::move(a4), ::std::move(a5), ::std::move(a6));
1303 #endif // GTEST_HAS_STD_FUNCTION_
1306 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1309 template <typename R, typename A0, typename A1, typename A2, typename A3,
1310 typename A4, typename A5, typename A6, typename A7>
1311 class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7)> {
1315 MOCK_METHOD8_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7));
1317 #if GTEST_HAS_STD_FUNCTION_
1318 ::std::function<R(A0, A1, A2, A3, A4, A5, A6, A7)> AsStdFunction() {
1319 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -> R {
1320 return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2),
1321 ::std::move(a3), ::std::move(a4), ::std::move(a5), ::std::move(a6),
1325 #endif // GTEST_HAS_STD_FUNCTION_
1328 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1331 template <typename R, typename A0, typename A1, typename A2, typename A3,
1332 typename A4, typename A5, typename A6, typename A7, typename A8>
1333 class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> {
1337 MOCK_METHOD9_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8));
1339 #if GTEST_HAS_STD_FUNCTION_
1340 ::std::function<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> AsStdFunction() {
1341 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7,
1343 return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2),
1344 ::std::move(a3), ::std::move(a4), ::std::move(a5), ::std::move(a6),
1345 ::std::move(a7), ::std::move(a8));
1348 #endif // GTEST_HAS_STD_FUNCTION_
1351 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1354 template <typename R, typename A0, typename A1, typename A2, typename A3,
1355 typename A4, typename A5, typename A6, typename A7, typename A8,
1357 class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
1361 MOCK_METHOD10_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9));
1363 #if GTEST_HAS_STD_FUNCTION_
1364 ::std::function<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> AsStdFunction() {
1365 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7,
1366 A8 a8, A9 a9) -> R {
1367 return this->Call(::std::move(a0), ::std::move(a1), ::std::move(a2),
1368 ::std::move(a3), ::std::move(a4), ::std::move(a5), ::std::move(a6),
1369 ::std::move(a7), ::std::move(a8), ::std::move(a9));
1372 #endif // GTEST_HAS_STD_FUNCTION_
1375 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1378 } // namespace testing
1380 #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_