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.
34 // Author: wan@google.com (Zhanyong Wan)
36 // Google Mock - a framework for writing C++ mock classes.
38 // This file implements function mockers of various arities.
40 #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
41 #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
43 #include "gmock/gmock-spec-builders.h"
44 #include "gmock/internal/gmock-internal-utils.h"
46 #if GTEST_HAS_STD_FUNCTION_
47 # include <functional>
54 class FunctionMockerBase
;
56 // Note: class FunctionMocker really belongs to the ::testing
57 // namespace. However if we define it in ::testing, MSVC will
58 // complain when classes in ::testing::internal declare it as a
59 // friend class template. To workaround this compiler bug, we define
60 // FunctionMocker in ::testing::internal and import it into ::testing.
65 class FunctionMocker
<R()> : public
66 internal::FunctionMockerBase
<R()> {
69 typedef typename
internal::Function
<F
>::ArgumentTuple ArgumentTuple
;
72 return MockSpec
<F
>(this, ::testing::make_tuple());
76 // Even though gcc and MSVC don't enforce it, 'this->' is required
77 // by the C++ standard [14.6.4] here, as the base class type is
78 // dependent on the template argument (and thus shouldn't be
79 // looked into when resolving InvokeWith).
80 return this->InvokeWith(ArgumentTuple());
84 template <typename R
, typename A1
>
85 class FunctionMocker
<R(A1
)> : public
86 internal::FunctionMockerBase
<R(A1
)> {
89 typedef typename
internal::Function
<F
>::ArgumentTuple ArgumentTuple
;
91 MockSpec
<F
> With(const Matcher
<A1
>& m1
) {
92 return MockSpec
<F
>(this, ::testing::make_tuple(m1
));
96 // Even though gcc and MSVC don't enforce it, 'this->' is required
97 // by the C++ standard [14.6.4] here, as the base class type is
98 // dependent on the template argument (and thus shouldn't be
99 // looked into when resolving InvokeWith).
100 return this->InvokeWith(ArgumentTuple(internal::forward
<A1
>(a1
)));
104 template <typename R
, typename A1
, typename A2
>
105 class FunctionMocker
<R(A1
, A2
)> : public
106 internal::FunctionMockerBase
<R(A1
, A2
)> {
109 typedef typename
internal::Function
<F
>::ArgumentTuple ArgumentTuple
;
111 MockSpec
<F
> With(const Matcher
<A1
>& m1
, const Matcher
<A2
>& m2
) {
112 return MockSpec
<F
>(this, ::testing::make_tuple(m1
, m2
));
115 R
Invoke(A1 a1
, A2 a2
) {
116 // Even though gcc and MSVC don't enforce it, 'this->' is required
117 // by the C++ standard [14.6.4] here, as the base class type is
118 // dependent on the template argument (and thus shouldn't be
119 // looked into when resolving InvokeWith).
120 return this->InvokeWith(ArgumentTuple(internal::forward
<A1
>(a1
),
121 internal::forward
<A2
>(a2
)));
125 template <typename R
, typename A1
, typename A2
, typename A3
>
126 class FunctionMocker
<R(A1
, A2
, A3
)> : public
127 internal::FunctionMockerBase
<R(A1
, A2
, A3
)> {
129 typedef R
F(A1
, A2
, A3
);
130 typedef typename
internal::Function
<F
>::ArgumentTuple ArgumentTuple
;
132 MockSpec
<F
> With(const Matcher
<A1
>& m1
, const Matcher
<A2
>& m2
,
133 const Matcher
<A3
>& m3
) {
134 return MockSpec
<F
>(this, ::testing::make_tuple(m1
, m2
, m3
));
137 R
Invoke(A1 a1
, A2 a2
, A3 a3
) {
138 // Even though gcc and MSVC don't enforce it, 'this->' is required
139 // by the C++ standard [14.6.4] here, as the base class type is
140 // dependent on the template argument (and thus shouldn't be
141 // looked into when resolving InvokeWith).
142 return this->InvokeWith(ArgumentTuple(internal::forward
<A1
>(a1
),
143 internal::forward
<A2
>(a2
), internal::forward
<A3
>(a3
)));
147 template <typename R
, typename A1
, typename A2
, typename A3
, typename A4
>
148 class FunctionMocker
<R(A1
, A2
, A3
, A4
)> : public
149 internal::FunctionMockerBase
<R(A1
, A2
, A3
, A4
)> {
151 typedef R
F(A1
, A2
, A3
, A4
);
152 typedef typename
internal::Function
<F
>::ArgumentTuple ArgumentTuple
;
154 MockSpec
<F
> With(const Matcher
<A1
>& m1
, const Matcher
<A2
>& m2
,
155 const Matcher
<A3
>& m3
, const Matcher
<A4
>& m4
) {
156 return MockSpec
<F
>(this, ::testing::make_tuple(m1
, m2
, m3
, m4
));
159 R
Invoke(A1 a1
, A2 a2
, A3 a3
, A4 a4
) {
160 // Even though gcc and MSVC don't enforce it, 'this->' is required
161 // by the C++ standard [14.6.4] here, as the base class type is
162 // dependent on the template argument (and thus shouldn't be
163 // looked into when resolving InvokeWith).
164 return this->InvokeWith(ArgumentTuple(internal::forward
<A1
>(a1
),
165 internal::forward
<A2
>(a2
), internal::forward
<A3
>(a3
),
166 internal::forward
<A4
>(a4
)));
170 template <typename R
, typename A1
, typename A2
, typename A3
, typename A4
,
172 class FunctionMocker
<R(A1
, A2
, A3
, A4
, A5
)> : public
173 internal::FunctionMockerBase
<R(A1
, A2
, A3
, A4
, A5
)> {
175 typedef R
F(A1
, A2
, A3
, A4
, A5
);
176 typedef typename
internal::Function
<F
>::ArgumentTuple ArgumentTuple
;
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
) {
180 return MockSpec
<F
>(this, ::testing::make_tuple(m1
, m2
, m3
, m4
, m5
));
183 R
Invoke(A1 a1
, A2 a2
, A3 a3
, A4 a4
, A5 a5
) {
184 // Even though gcc and MSVC don't enforce it, 'this->' is required
185 // by the C++ standard [14.6.4] here, as the base class type is
186 // dependent on the template argument (and thus shouldn't be
187 // looked into when resolving InvokeWith).
188 return this->InvokeWith(ArgumentTuple(internal::forward
<A1
>(a1
),
189 internal::forward
<A2
>(a2
), internal::forward
<A3
>(a3
),
190 internal::forward
<A4
>(a4
), internal::forward
<A5
>(a5
)));
194 template <typename R
, typename A1
, typename A2
, typename A3
, typename A4
,
195 typename A5
, typename A6
>
196 class FunctionMocker
<R(A1
, A2
, A3
, A4
, A5
, A6
)> : public
197 internal::FunctionMockerBase
<R(A1
, A2
, A3
, A4
, A5
, A6
)> {
199 typedef R
F(A1
, A2
, A3
, A4
, A5
, A6
);
200 typedef typename
internal::Function
<F
>::ArgumentTuple ArgumentTuple
;
202 MockSpec
<F
> With(const Matcher
<A1
>& m1
, const Matcher
<A2
>& m2
,
203 const Matcher
<A3
>& m3
, const Matcher
<A4
>& m4
, const Matcher
<A5
>& m5
,
204 const Matcher
<A6
>& m6
) {
205 return MockSpec
<F
>(this, ::testing::make_tuple(m1
, m2
, m3
, m4
, m5
, m6
));
208 R
Invoke(A1 a1
, A2 a2
, A3 a3
, A4 a4
, A5 a5
, A6 a6
) {
209 // Even though gcc and MSVC don't enforce it, 'this->' is required
210 // by the C++ standard [14.6.4] here, as the base class type is
211 // dependent on the template argument (and thus shouldn't be
212 // looked into when resolving InvokeWith).
213 return this->InvokeWith(ArgumentTuple(internal::forward
<A1
>(a1
),
214 internal::forward
<A2
>(a2
), internal::forward
<A3
>(a3
),
215 internal::forward
<A4
>(a4
), internal::forward
<A5
>(a5
),
216 internal::forward
<A6
>(a6
)));
220 template <typename R
, typename A1
, typename A2
, typename A3
, typename A4
,
221 typename A5
, typename A6
, typename A7
>
222 class FunctionMocker
<R(A1
, A2
, A3
, A4
, A5
, A6
, A7
)> : public
223 internal::FunctionMockerBase
<R(A1
, A2
, A3
, A4
, A5
, A6
, A7
)> {
225 typedef R
F(A1
, A2
, A3
, A4
, A5
, A6
, A7
);
226 typedef typename
internal::Function
<F
>::ArgumentTuple ArgumentTuple
;
228 MockSpec
<F
> With(const Matcher
<A1
>& m1
, const Matcher
<A2
>& m2
,
229 const Matcher
<A3
>& m3
, const Matcher
<A4
>& m4
, const Matcher
<A5
>& m5
,
230 const Matcher
<A6
>& m6
, const Matcher
<A7
>& m7
) {
231 return MockSpec
<F
>(this, ::testing::make_tuple(m1
, m2
, m3
, m4
, m5
, m6
, m7
));
234 R
Invoke(A1 a1
, A2 a2
, A3 a3
, A4 a4
, A5 a5
, A6 a6
, A7 a7
) {
235 // Even though gcc and MSVC don't enforce it, 'this->' is required
236 // by the C++ standard [14.6.4] here, as the base class type is
237 // dependent on the template argument (and thus shouldn't be
238 // looked into when resolving InvokeWith).
239 return this->InvokeWith(ArgumentTuple(internal::forward
<A1
>(a1
),
240 internal::forward
<A2
>(a2
), internal::forward
<A3
>(a3
),
241 internal::forward
<A4
>(a4
), internal::forward
<A5
>(a5
),
242 internal::forward
<A6
>(a6
), internal::forward
<A7
>(a7
)));
246 template <typename R
, typename A1
, typename A2
, typename A3
, typename A4
,
247 typename A5
, typename A6
, typename A7
, typename A8
>
248 class FunctionMocker
<R(A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
)> : public
249 internal::FunctionMockerBase
<R(A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
)> {
251 typedef R
F(A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
);
252 typedef typename
internal::Function
<F
>::ArgumentTuple ArgumentTuple
;
254 MockSpec
<F
> With(const Matcher
<A1
>& m1
, const Matcher
<A2
>& m2
,
255 const Matcher
<A3
>& m3
, const Matcher
<A4
>& m4
, const Matcher
<A5
>& m5
,
256 const Matcher
<A6
>& m6
, const Matcher
<A7
>& m7
, const Matcher
<A8
>& m8
) {
257 return MockSpec
<F
>(this, ::testing::make_tuple(m1
, m2
, m3
, m4
, m5
, m6
, m7
,
261 R
Invoke(A1 a1
, A2 a2
, A3 a3
, A4 a4
, A5 a5
, A6 a6
, A7 a7
, A8 a8
) {
262 // Even though gcc and MSVC don't enforce it, 'this->' is required
263 // by the C++ standard [14.6.4] here, as the base class type is
264 // dependent on the template argument (and thus shouldn't be
265 // looked into when resolving InvokeWith).
266 return this->InvokeWith(ArgumentTuple(internal::forward
<A1
>(a1
),
267 internal::forward
<A2
>(a2
), internal::forward
<A3
>(a3
),
268 internal::forward
<A4
>(a4
), internal::forward
<A5
>(a5
),
269 internal::forward
<A6
>(a6
), internal::forward
<A7
>(a7
),
270 internal::forward
<A8
>(a8
)));
274 template <typename R
, typename A1
, typename A2
, typename A3
, typename A4
,
275 typename A5
, typename A6
, typename A7
, typename A8
, typename A9
>
276 class FunctionMocker
<R(A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
, A9
)> : public
277 internal::FunctionMockerBase
<R(A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
, A9
)> {
279 typedef R
F(A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
, A9
);
280 typedef typename
internal::Function
<F
>::ArgumentTuple ArgumentTuple
;
282 MockSpec
<F
> With(const Matcher
<A1
>& m1
, const Matcher
<A2
>& m2
,
283 const Matcher
<A3
>& m3
, const Matcher
<A4
>& m4
, const Matcher
<A5
>& m5
,
284 const Matcher
<A6
>& m6
, const Matcher
<A7
>& m7
, const Matcher
<A8
>& m8
,
285 const Matcher
<A9
>& m9
) {
286 return MockSpec
<F
>(this, ::testing::make_tuple(m1
, m2
, m3
, m4
, m5
, m6
, m7
,
290 R
Invoke(A1 a1
, A2 a2
, A3 a3
, A4 a4
, A5 a5
, A6 a6
, A7 a7
, A8 a8
, A9 a9
) {
291 // Even though gcc and MSVC don't enforce it, 'this->' is required
292 // by the C++ standard [14.6.4] here, as the base class type is
293 // dependent on the template argument (and thus shouldn't be
294 // looked into when resolving InvokeWith).
295 return this->InvokeWith(ArgumentTuple(internal::forward
<A1
>(a1
),
296 internal::forward
<A2
>(a2
), internal::forward
<A3
>(a3
),
297 internal::forward
<A4
>(a4
), internal::forward
<A5
>(a5
),
298 internal::forward
<A6
>(a6
), internal::forward
<A7
>(a7
),
299 internal::forward
<A8
>(a8
), internal::forward
<A9
>(a9
)));
303 template <typename R
, typename A1
, typename A2
, typename A3
, typename A4
,
304 typename A5
, typename A6
, typename A7
, typename A8
, typename A9
,
306 class FunctionMocker
<R(A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
, A9
, A10
)> : public
307 internal::FunctionMockerBase
<R(A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
, A9
, A10
)> {
309 typedef R
F(A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
, A9
, A10
);
310 typedef typename
internal::Function
<F
>::ArgumentTuple ArgumentTuple
;
312 MockSpec
<F
> With(const Matcher
<A1
>& m1
, const Matcher
<A2
>& m2
,
313 const Matcher
<A3
>& m3
, const Matcher
<A4
>& m4
, const Matcher
<A5
>& m5
,
314 const Matcher
<A6
>& m6
, const Matcher
<A7
>& m7
, const Matcher
<A8
>& m8
,
315 const Matcher
<A9
>& m9
, const Matcher
<A10
>& m10
) {
316 return MockSpec
<F
>(this, ::testing::make_tuple(m1
, m2
, m3
, m4
, m5
, m6
, m7
,
320 R
Invoke(A1 a1
, A2 a2
, A3 a3
, A4 a4
, A5 a5
, A6 a6
, A7 a7
, A8 a8
, A9 a9
,
322 // Even though gcc and MSVC don't enforce it, 'this->' is required
323 // by the C++ standard [14.6.4] here, as the base class type is
324 // dependent on the template argument (and thus shouldn't be
325 // looked into when resolving InvokeWith).
326 return this->InvokeWith(ArgumentTuple(internal::forward
<A1
>(a1
),
327 internal::forward
<A2
>(a2
), internal::forward
<A3
>(a3
),
328 internal::forward
<A4
>(a4
), internal::forward
<A5
>(a5
),
329 internal::forward
<A6
>(a6
), internal::forward
<A7
>(a7
),
330 internal::forward
<A8
>(a8
), internal::forward
<A9
>(a9
),
331 internal::forward
<A10
>(a10
)));
335 // Removes the given pointer; this is a helper for the expectation setter method
336 // for parameterless matchers.
338 // We want to make sure that the user cannot set a parameterless expectation on
339 // overloaded methods, including methods which are overloaded on const. Example:
342 // MOCK_METHOD0(GetName, string&());
343 // MOCK_CONST_METHOD0(GetName, const string&());
347 // // This should be an error, as it's not clear which overload is expected.
348 // EXPECT_CALL(mock, GetName).WillOnce(ReturnRef(value));
351 // Here are the generated expectation-setter methods:
355 // MockSpec<string&()> gmock_GetName() { … }
356 // // Overload 2. Declared const so that the compiler will generate an
357 // // error when trying to resolve between this and overload 4 in
358 // // 'gmock_GetName(WithoutMatchers(), nullptr)'.
359 // MockSpec<string&()> gmock_GetName(
360 // const WithoutMatchers&, const Function<string&()>*) const {
361 // // Removes const from this, calls overload 1
362 // return AdjustConstness_(this)->gmock_GetName();
366 // const string& gmock_GetName() const { … }
368 // MockSpec<const string&()> gmock_GetName(
369 // const WithoutMatchers&, const Function<const string&()>*) const {
370 // // Does not remove const, calls overload 3
371 // return AdjustConstness_const(this)->gmock_GetName();
375 template <typename MockType
>
376 const MockType
* AdjustConstness_const(const MockType
* mock
) {
380 // Removes const from and returns the given pointer; this is a helper for the
381 // expectation setter method for parameterless matchers.
382 template <typename MockType
>
383 MockType
* AdjustConstness_(const MockType
* mock
) {
384 return const_cast<MockType
*>(mock
);
387 } // namespace internal
389 // The style guide prohibits "using" statements in a namespace scope
390 // inside a header file. However, the FunctionMocker class template
391 // is meant to be defined in the ::testing namespace. The following
392 // line is just a trick for working around a bug in MSVC 8.0, which
393 // cannot handle it if we define FunctionMocker in ::testing.
394 using internal::FunctionMocker
;
396 // GMOCK_RESULT_(tn, F) expands to the result type of function type F.
397 // We define this as a variadic macro in case F contains unprotected
398 // commas (the same reason that we use variadic macros in other places
400 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
401 #define GMOCK_RESULT_(tn, ...) \
402 tn ::testing::internal::Function<__VA_ARGS__>::Result
404 // The type of argument N of the given function type.
405 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
406 #define GMOCK_ARG_(tn, N, ...) \
407 tn ::testing::internal::Function<__VA_ARGS__>::Argument##N
409 // The matcher type for argument N of the given function type.
410 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
411 #define GMOCK_MATCHER_(tn, N, ...) \
412 const ::testing::Matcher<GMOCK_ARG_(tn, N, __VA_ARGS__)>&
414 // The variable for mocking the given method.
415 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
416 #define GMOCK_MOCKER_(arity, constness, Method) \
417 GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__)
419 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
420 #define GMOCK_METHOD0_(tn, constness, ct, Method, ...) \
421 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method() constness { \
422 GTEST_COMPILE_ASSERT_( \
423 (::testing::tuple_size<tn ::testing::internal::Function< \
424 __VA_ARGS__>::ArgumentTuple>::value == 0), \
425 this_method_does_not_take_0_arguments); \
426 GMOCK_MOCKER_(0, constness, Method).SetOwnerAndName(this, #Method); \
427 return GMOCK_MOCKER_(0, constness, Method).Invoke(); \
429 ::testing::MockSpec<__VA_ARGS__> gmock_##Method() constness { \
430 GMOCK_MOCKER_(0, constness, Method).RegisterOwner(this); \
431 return GMOCK_MOCKER_(0, constness, Method).With(); \
433 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
434 const ::testing::internal::WithoutMatchers&, \
435 constness ::testing::internal::Function<__VA_ARGS__>*) const { \
436 return ::testing::internal::AdjustConstness_##constness(this) \
437 ->gmock_##Method(); \
439 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(0, constness, \
442 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
443 #define GMOCK_METHOD1_(tn, constness, ct, Method, ...) \
444 GMOCK_RESULT_(tn, __VA_ARGS__) \
445 ct Method(GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1) constness { \
446 GTEST_COMPILE_ASSERT_( \
447 (::testing::tuple_size<tn ::testing::internal::Function< \
448 __VA_ARGS__>::ArgumentTuple>::value == 1), \
449 this_method_does_not_take_1_argument); \
450 GMOCK_MOCKER_(1, constness, Method).SetOwnerAndName(this, #Method); \
451 return GMOCK_MOCKER_(1, constness, Method) \
452 .Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, __VA_ARGS__)>( \
455 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
456 GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1) constness { \
457 GMOCK_MOCKER_(1, constness, Method).RegisterOwner(this); \
458 return GMOCK_MOCKER_(1, constness, Method).With(gmock_a1); \
460 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
461 const ::testing::internal::WithoutMatchers&, \
462 constness ::testing::internal::Function<__VA_ARGS__>*) const { \
463 return ::testing::internal::AdjustConstness_##constness(this) \
464 ->gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>()); \
466 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(1, constness, \
469 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
470 #define GMOCK_METHOD2_(tn, constness, ct, Method, ...) \
471 GMOCK_RESULT_(tn, __VA_ARGS__) \
472 ct Method(GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
473 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2) constness { \
474 GTEST_COMPILE_ASSERT_( \
475 (::testing::tuple_size<tn ::testing::internal::Function< \
476 __VA_ARGS__>::ArgumentTuple>::value == 2), \
477 this_method_does_not_take_2_arguments); \
478 GMOCK_MOCKER_(2, constness, Method).SetOwnerAndName(this, #Method); \
479 return GMOCK_MOCKER_(2, constness, Method) \
480 .Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, __VA_ARGS__)>( \
482 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
485 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
486 GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
487 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2) constness { \
488 GMOCK_MOCKER_(2, constness, Method).RegisterOwner(this); \
489 return GMOCK_MOCKER_(2, constness, Method).With(gmock_a1, gmock_a2); \
491 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
492 const ::testing::internal::WithoutMatchers&, \
493 constness ::testing::internal::Function<__VA_ARGS__>*) const { \
494 return ::testing::internal::AdjustConstness_##constness(this) \
495 ->gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \
496 ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>()); \
498 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(2, constness, \
501 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
502 #define GMOCK_METHOD3_(tn, constness, ct, Method, ...) \
503 GMOCK_RESULT_(tn, __VA_ARGS__) \
504 ct Method(GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
505 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
506 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3) constness { \
507 GTEST_COMPILE_ASSERT_( \
508 (::testing::tuple_size<tn ::testing::internal::Function< \
509 __VA_ARGS__>::ArgumentTuple>::value == 3), \
510 this_method_does_not_take_3_arguments); \
511 GMOCK_MOCKER_(3, constness, Method).SetOwnerAndName(this, #Method); \
512 return GMOCK_MOCKER_(3, constness, Method) \
513 .Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, __VA_ARGS__)>( \
515 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
517 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
520 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
521 GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
522 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
523 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3) constness { \
524 GMOCK_MOCKER_(3, constness, Method).RegisterOwner(this); \
525 return GMOCK_MOCKER_(3, constness, Method) \
526 .With(gmock_a1, gmock_a2, gmock_a3); \
528 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
529 const ::testing::internal::WithoutMatchers&, \
530 constness ::testing::internal::Function<__VA_ARGS__>*) const { \
531 return ::testing::internal::AdjustConstness_##constness(this) \
532 ->gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \
533 ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \
534 ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>()); \
536 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(3, constness, \
539 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
540 #define GMOCK_METHOD4_(tn, constness, ct, Method, ...) \
541 GMOCK_RESULT_(tn, __VA_ARGS__) \
542 ct Method(GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
543 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
544 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
545 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4) constness { \
546 GTEST_COMPILE_ASSERT_( \
547 (::testing::tuple_size<tn ::testing::internal::Function< \
548 __VA_ARGS__>::ArgumentTuple>::value == 4), \
549 this_method_does_not_take_4_arguments); \
550 GMOCK_MOCKER_(4, constness, Method).SetOwnerAndName(this, #Method); \
551 return GMOCK_MOCKER_(4, constness, Method) \
552 .Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, __VA_ARGS__)>( \
554 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
556 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
558 ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>( \
561 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
562 GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
563 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
564 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
565 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4) constness { \
566 GMOCK_MOCKER_(4, constness, Method).RegisterOwner(this); \
567 return GMOCK_MOCKER_(4, constness, Method) \
568 .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4); \
570 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
571 const ::testing::internal::WithoutMatchers&, \
572 constness ::testing::internal::Function<__VA_ARGS__>*) const { \
573 return ::testing::internal::AdjustConstness_##constness(this) \
574 ->gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \
575 ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \
576 ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(), \
577 ::testing::A<GMOCK_ARG_(tn, 4, __VA_ARGS__)>()); \
579 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(4, constness, \
582 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
583 #define GMOCK_METHOD5_(tn, constness, ct, Method, ...) \
584 GMOCK_RESULT_(tn, __VA_ARGS__) \
585 ct Method(GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
586 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
587 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
588 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
589 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5) constness { \
590 GTEST_COMPILE_ASSERT_( \
591 (::testing::tuple_size<tn ::testing::internal::Function< \
592 __VA_ARGS__>::ArgumentTuple>::value == 5), \
593 this_method_does_not_take_5_arguments); \
594 GMOCK_MOCKER_(5, constness, Method).SetOwnerAndName(this, #Method); \
595 return GMOCK_MOCKER_(5, constness, Method) \
596 .Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, __VA_ARGS__)>( \
598 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
600 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
602 ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>( \
604 ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>( \
607 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
608 GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
609 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
610 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
611 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
612 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5) constness { \
613 GMOCK_MOCKER_(5, constness, Method).RegisterOwner(this); \
614 return GMOCK_MOCKER_(5, constness, Method) \
615 .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5); \
617 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
618 const ::testing::internal::WithoutMatchers&, \
619 constness ::testing::internal::Function<__VA_ARGS__>*) const { \
620 return ::testing::internal::AdjustConstness_##constness(this) \
621 ->gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \
622 ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \
623 ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(), \
624 ::testing::A<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(), \
625 ::testing::A<GMOCK_ARG_(tn, 5, __VA_ARGS__)>()); \
627 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(5, constness, \
630 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
631 #define GMOCK_METHOD6_(tn, constness, ct, Method, ...) \
632 GMOCK_RESULT_(tn, __VA_ARGS__) \
633 ct Method(GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
634 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
635 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
636 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
637 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
638 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6) constness { \
639 GTEST_COMPILE_ASSERT_( \
640 (::testing::tuple_size<tn ::testing::internal::Function< \
641 __VA_ARGS__>::ArgumentTuple>::value == 6), \
642 this_method_does_not_take_6_arguments); \
643 GMOCK_MOCKER_(6, constness, Method).SetOwnerAndName(this, #Method); \
644 return GMOCK_MOCKER_(6, constness, Method) \
645 .Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, __VA_ARGS__)>( \
647 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
649 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
651 ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>( \
653 ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>( \
655 ::testing::internal::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>( \
658 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
659 GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
660 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
661 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
662 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
663 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
664 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6) constness { \
665 GMOCK_MOCKER_(6, constness, Method).RegisterOwner(this); \
666 return GMOCK_MOCKER_(6, constness, Method) \
667 .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6); \
669 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
670 const ::testing::internal::WithoutMatchers&, \
671 constness ::testing::internal::Function<__VA_ARGS__>*) const { \
672 return ::testing::internal::AdjustConstness_##constness(this) \
673 ->gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \
674 ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \
675 ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(), \
676 ::testing::A<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(), \
677 ::testing::A<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(), \
678 ::testing::A<GMOCK_ARG_(tn, 6, __VA_ARGS__)>()); \
680 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(6, constness, \
683 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
684 #define GMOCK_METHOD7_(tn, constness, ct, Method, ...) \
685 GMOCK_RESULT_(tn, __VA_ARGS__) \
686 ct Method(GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
687 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
688 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
689 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
690 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
691 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
692 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7) constness { \
693 GTEST_COMPILE_ASSERT_( \
694 (::testing::tuple_size<tn ::testing::internal::Function< \
695 __VA_ARGS__>::ArgumentTuple>::value == 7), \
696 this_method_does_not_take_7_arguments); \
697 GMOCK_MOCKER_(7, constness, Method).SetOwnerAndName(this, #Method); \
698 return GMOCK_MOCKER_(7, constness, Method) \
699 .Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, __VA_ARGS__)>( \
701 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
703 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
705 ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>( \
707 ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>( \
709 ::testing::internal::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>( \
711 ::testing::internal::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>( \
714 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
715 GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
716 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
717 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
718 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
719 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
720 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
721 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7) constness { \
722 GMOCK_MOCKER_(7, constness, Method).RegisterOwner(this); \
723 return GMOCK_MOCKER_(7, constness, Method) \
724 .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6, \
727 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
728 const ::testing::internal::WithoutMatchers&, \
729 constness ::testing::internal::Function<__VA_ARGS__>*) const { \
730 return ::testing::internal::AdjustConstness_##constness(this) \
731 ->gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \
732 ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \
733 ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(), \
734 ::testing::A<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(), \
735 ::testing::A<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(), \
736 ::testing::A<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(), \
737 ::testing::A<GMOCK_ARG_(tn, 7, __VA_ARGS__)>()); \
739 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(7, constness, \
742 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
743 #define GMOCK_METHOD8_(tn, constness, ct, Method, ...) \
744 GMOCK_RESULT_(tn, __VA_ARGS__) \
745 ct Method(GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
746 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
747 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
748 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
749 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
750 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
751 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
752 GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8) constness { \
753 GTEST_COMPILE_ASSERT_( \
754 (::testing::tuple_size<tn ::testing::internal::Function< \
755 __VA_ARGS__>::ArgumentTuple>::value == 8), \
756 this_method_does_not_take_8_arguments); \
757 GMOCK_MOCKER_(8, constness, Method).SetOwnerAndName(this, #Method); \
758 return GMOCK_MOCKER_(8, constness, Method) \
759 .Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, __VA_ARGS__)>( \
761 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
763 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
765 ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>( \
767 ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>( \
769 ::testing::internal::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>( \
771 ::testing::internal::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>( \
773 ::testing::internal::forward<GMOCK_ARG_(tn, 8, __VA_ARGS__)>( \
776 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
777 GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
778 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
779 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
780 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
781 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
782 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
783 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
784 GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8) constness { \
785 GMOCK_MOCKER_(8, constness, Method).RegisterOwner(this); \
786 return GMOCK_MOCKER_(8, constness, Method) \
787 .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6, \
788 gmock_a7, gmock_a8); \
790 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
791 const ::testing::internal::WithoutMatchers&, \
792 constness ::testing::internal::Function<__VA_ARGS__>*) const { \
793 return ::testing::internal::AdjustConstness_##constness(this) \
794 ->gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \
795 ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \
796 ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(), \
797 ::testing::A<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(), \
798 ::testing::A<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(), \
799 ::testing::A<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(), \
800 ::testing::A<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(), \
801 ::testing::A<GMOCK_ARG_(tn, 8, __VA_ARGS__)>()); \
803 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(8, constness, \
806 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
807 #define GMOCK_METHOD9_(tn, constness, ct, Method, ...) \
808 GMOCK_RESULT_(tn, __VA_ARGS__) \
809 ct Method(GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
810 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
811 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
812 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
813 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
814 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
815 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
816 GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8, \
817 GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9) constness { \
818 GTEST_COMPILE_ASSERT_( \
819 (::testing::tuple_size<tn ::testing::internal::Function< \
820 __VA_ARGS__>::ArgumentTuple>::value == 9), \
821 this_method_does_not_take_9_arguments); \
822 GMOCK_MOCKER_(9, constness, Method).SetOwnerAndName(this, #Method); \
823 return GMOCK_MOCKER_(9, constness, Method) \
824 .Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, __VA_ARGS__)>( \
826 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
828 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
830 ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>( \
832 ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>( \
834 ::testing::internal::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>( \
836 ::testing::internal::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>( \
838 ::testing::internal::forward<GMOCK_ARG_(tn, 8, __VA_ARGS__)>( \
840 ::testing::internal::forward<GMOCK_ARG_(tn, 9, __VA_ARGS__)>( \
843 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
844 GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
845 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
846 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
847 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
848 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
849 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
850 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
851 GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \
852 GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9) constness { \
853 GMOCK_MOCKER_(9, constness, Method).RegisterOwner(this); \
854 return GMOCK_MOCKER_(9, constness, Method) \
855 .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6, \
856 gmock_a7, gmock_a8, gmock_a9); \
858 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
859 const ::testing::internal::WithoutMatchers&, \
860 constness ::testing::internal::Function<__VA_ARGS__>*) const { \
861 return ::testing::internal::AdjustConstness_##constness(this) \
862 ->gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \
863 ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \
864 ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(), \
865 ::testing::A<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(), \
866 ::testing::A<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(), \
867 ::testing::A<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(), \
868 ::testing::A<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(), \
869 ::testing::A<GMOCK_ARG_(tn, 8, __VA_ARGS__)>(), \
870 ::testing::A<GMOCK_ARG_(tn, 9, __VA_ARGS__)>()); \
872 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(9, constness, \
875 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
876 #define GMOCK_METHOD10_(tn, constness, ct, Method, ...) \
877 GMOCK_RESULT_(tn, __VA_ARGS__) \
878 ct Method(GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
879 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
880 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
881 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
882 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
883 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
884 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
885 GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8, \
886 GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9, \
887 GMOCK_ARG_(tn, 10, __VA_ARGS__) gmock_a10) constness { \
888 GTEST_COMPILE_ASSERT_( \
889 (::testing::tuple_size<tn ::testing::internal::Function< \
890 __VA_ARGS__>::ArgumentTuple>::value == 10), \
891 this_method_does_not_take_10_arguments); \
892 GMOCK_MOCKER_(10, constness, Method).SetOwnerAndName(this, #Method); \
893 return GMOCK_MOCKER_(10, constness, Method) \
894 .Invoke(::testing::internal::forward<GMOCK_ARG_(tn, 1, __VA_ARGS__)>( \
896 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
898 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
900 ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>( \
902 ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>( \
904 ::testing::internal::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>( \
906 ::testing::internal::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>( \
908 ::testing::internal::forward<GMOCK_ARG_(tn, 8, __VA_ARGS__)>( \
910 ::testing::internal::forward<GMOCK_ARG_(tn, 9, __VA_ARGS__)>( \
912 ::testing::internal::forward<GMOCK_ARG_(tn, 10, __VA_ARGS__)>( \
915 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
916 GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
917 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
918 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
919 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
920 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
921 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
922 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
923 GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \
924 GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9, \
925 GMOCK_MATCHER_(tn, 10, __VA_ARGS__) gmock_a10) constness { \
926 GMOCK_MOCKER_(10, constness, Method).RegisterOwner(this); \
927 return GMOCK_MOCKER_(10, constness, Method) \
928 .With(gmock_a1, gmock_a2, gmock_a3, gmock_a4, gmock_a5, gmock_a6, \
929 gmock_a7, gmock_a8, gmock_a9, gmock_a10); \
931 ::testing::MockSpec<__VA_ARGS__> gmock_##Method( \
932 const ::testing::internal::WithoutMatchers&, \
933 constness ::testing::internal::Function<__VA_ARGS__>*) const { \
934 return ::testing::internal::AdjustConstness_##constness(this) \
935 ->gmock_##Method(::testing::A<GMOCK_ARG_(tn, 1, __VA_ARGS__)>(), \
936 ::testing::A<GMOCK_ARG_(tn, 2, __VA_ARGS__)>(), \
937 ::testing::A<GMOCK_ARG_(tn, 3, __VA_ARGS__)>(), \
938 ::testing::A<GMOCK_ARG_(tn, 4, __VA_ARGS__)>(), \
939 ::testing::A<GMOCK_ARG_(tn, 5, __VA_ARGS__)>(), \
940 ::testing::A<GMOCK_ARG_(tn, 6, __VA_ARGS__)>(), \
941 ::testing::A<GMOCK_ARG_(tn, 7, __VA_ARGS__)>(), \
942 ::testing::A<GMOCK_ARG_(tn, 8, __VA_ARGS__)>(), \
943 ::testing::A<GMOCK_ARG_(tn, 9, __VA_ARGS__)>(), \
944 ::testing::A<GMOCK_ARG_(tn, 10, __VA_ARGS__)>()); \
946 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(10, constness, \
949 #define MOCK_METHOD0(m, ...) GMOCK_METHOD0_(, , , m, __VA_ARGS__)
950 #define MOCK_METHOD1(m, ...) GMOCK_METHOD1_(, , , m, __VA_ARGS__)
951 #define MOCK_METHOD2(m, ...) GMOCK_METHOD2_(, , , m, __VA_ARGS__)
952 #define MOCK_METHOD3(m, ...) GMOCK_METHOD3_(, , , m, __VA_ARGS__)
953 #define MOCK_METHOD4(m, ...) GMOCK_METHOD4_(, , , m, __VA_ARGS__)
954 #define MOCK_METHOD5(m, ...) GMOCK_METHOD5_(, , , m, __VA_ARGS__)
955 #define MOCK_METHOD6(m, ...) GMOCK_METHOD6_(, , , m, __VA_ARGS__)
956 #define MOCK_METHOD7(m, ...) GMOCK_METHOD7_(, , , m, __VA_ARGS__)
957 #define MOCK_METHOD8(m, ...) GMOCK_METHOD8_(, , , m, __VA_ARGS__)
958 #define MOCK_METHOD9(m, ...) GMOCK_METHOD9_(, , , m, __VA_ARGS__)
959 #define MOCK_METHOD10(m, ...) GMOCK_METHOD10_(, , , m, __VA_ARGS__)
961 #define MOCK_CONST_METHOD0(m, ...) GMOCK_METHOD0_(, const, , m, __VA_ARGS__)
962 #define MOCK_CONST_METHOD1(m, ...) GMOCK_METHOD1_(, const, , m, __VA_ARGS__)
963 #define MOCK_CONST_METHOD2(m, ...) GMOCK_METHOD2_(, const, , m, __VA_ARGS__)
964 #define MOCK_CONST_METHOD3(m, ...) GMOCK_METHOD3_(, const, , m, __VA_ARGS__)
965 #define MOCK_CONST_METHOD4(m, ...) GMOCK_METHOD4_(, const, , m, __VA_ARGS__)
966 #define MOCK_CONST_METHOD5(m, ...) GMOCK_METHOD5_(, const, , m, __VA_ARGS__)
967 #define MOCK_CONST_METHOD6(m, ...) GMOCK_METHOD6_(, const, , m, __VA_ARGS__)
968 #define MOCK_CONST_METHOD7(m, ...) GMOCK_METHOD7_(, const, , m, __VA_ARGS__)
969 #define MOCK_CONST_METHOD8(m, ...) GMOCK_METHOD8_(, const, , m, __VA_ARGS__)
970 #define MOCK_CONST_METHOD9(m, ...) GMOCK_METHOD9_(, const, , m, __VA_ARGS__)
971 #define MOCK_CONST_METHOD10(m, ...) GMOCK_METHOD10_(, const, , m, __VA_ARGS__)
973 #define MOCK_METHOD0_T(m, ...) GMOCK_METHOD0_(typename, , , m, __VA_ARGS__)
974 #define MOCK_METHOD1_T(m, ...) GMOCK_METHOD1_(typename, , , m, __VA_ARGS__)
975 #define MOCK_METHOD2_T(m, ...) GMOCK_METHOD2_(typename, , , m, __VA_ARGS__)
976 #define MOCK_METHOD3_T(m, ...) GMOCK_METHOD3_(typename, , , m, __VA_ARGS__)
977 #define MOCK_METHOD4_T(m, ...) GMOCK_METHOD4_(typename, , , m, __VA_ARGS__)
978 #define MOCK_METHOD5_T(m, ...) GMOCK_METHOD5_(typename, , , m, __VA_ARGS__)
979 #define MOCK_METHOD6_T(m, ...) GMOCK_METHOD6_(typename, , , m, __VA_ARGS__)
980 #define MOCK_METHOD7_T(m, ...) GMOCK_METHOD7_(typename, , , m, __VA_ARGS__)
981 #define MOCK_METHOD8_T(m, ...) GMOCK_METHOD8_(typename, , , m, __VA_ARGS__)
982 #define MOCK_METHOD9_T(m, ...) GMOCK_METHOD9_(typename, , , m, __VA_ARGS__)
983 #define MOCK_METHOD10_T(m, ...) GMOCK_METHOD10_(typename, , , m, __VA_ARGS__)
985 #define MOCK_CONST_METHOD0_T(m, ...) \
986 GMOCK_METHOD0_(typename, const, , m, __VA_ARGS__)
987 #define MOCK_CONST_METHOD1_T(m, ...) \
988 GMOCK_METHOD1_(typename, const, , m, __VA_ARGS__)
989 #define MOCK_CONST_METHOD2_T(m, ...) \
990 GMOCK_METHOD2_(typename, const, , m, __VA_ARGS__)
991 #define MOCK_CONST_METHOD3_T(m, ...) \
992 GMOCK_METHOD3_(typename, const, , m, __VA_ARGS__)
993 #define MOCK_CONST_METHOD4_T(m, ...) \
994 GMOCK_METHOD4_(typename, const, , m, __VA_ARGS__)
995 #define MOCK_CONST_METHOD5_T(m, ...) \
996 GMOCK_METHOD5_(typename, const, , m, __VA_ARGS__)
997 #define MOCK_CONST_METHOD6_T(m, ...) \
998 GMOCK_METHOD6_(typename, const, , m, __VA_ARGS__)
999 #define MOCK_CONST_METHOD7_T(m, ...) \
1000 GMOCK_METHOD7_(typename, const, , m, __VA_ARGS__)
1001 #define MOCK_CONST_METHOD8_T(m, ...) \
1002 GMOCK_METHOD8_(typename, const, , m, __VA_ARGS__)
1003 #define MOCK_CONST_METHOD9_T(m, ...) \
1004 GMOCK_METHOD9_(typename, const, , m, __VA_ARGS__)
1005 #define MOCK_CONST_METHOD10_T(m, ...) \
1006 GMOCK_METHOD10_(typename, const, , m, __VA_ARGS__)
1008 #define MOCK_METHOD0_WITH_CALLTYPE(ct, m, ...) \
1009 GMOCK_METHOD0_(, , ct, m, __VA_ARGS__)
1010 #define MOCK_METHOD1_WITH_CALLTYPE(ct, m, ...) \
1011 GMOCK_METHOD1_(, , ct, m, __VA_ARGS__)
1012 #define MOCK_METHOD2_WITH_CALLTYPE(ct, m, ...) \
1013 GMOCK_METHOD2_(, , ct, m, __VA_ARGS__)
1014 #define MOCK_METHOD3_WITH_CALLTYPE(ct, m, ...) \
1015 GMOCK_METHOD3_(, , ct, m, __VA_ARGS__)
1016 #define MOCK_METHOD4_WITH_CALLTYPE(ct, m, ...) \
1017 GMOCK_METHOD4_(, , ct, m, __VA_ARGS__)
1018 #define MOCK_METHOD5_WITH_CALLTYPE(ct, m, ...) \
1019 GMOCK_METHOD5_(, , ct, m, __VA_ARGS__)
1020 #define MOCK_METHOD6_WITH_CALLTYPE(ct, m, ...) \
1021 GMOCK_METHOD6_(, , ct, m, __VA_ARGS__)
1022 #define MOCK_METHOD7_WITH_CALLTYPE(ct, m, ...) \
1023 GMOCK_METHOD7_(, , ct, m, __VA_ARGS__)
1024 #define MOCK_METHOD8_WITH_CALLTYPE(ct, m, ...) \
1025 GMOCK_METHOD8_(, , ct, m, __VA_ARGS__)
1026 #define MOCK_METHOD9_WITH_CALLTYPE(ct, m, ...) \
1027 GMOCK_METHOD9_(, , ct, m, __VA_ARGS__)
1028 #define MOCK_METHOD10_WITH_CALLTYPE(ct, m, ...) \
1029 GMOCK_METHOD10_(, , ct, m, __VA_ARGS__)
1031 #define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, ...) \
1032 GMOCK_METHOD0_(, const, ct, m, __VA_ARGS__)
1033 #define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, ...) \
1034 GMOCK_METHOD1_(, const, ct, m, __VA_ARGS__)
1035 #define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, ...) \
1036 GMOCK_METHOD2_(, const, ct, m, __VA_ARGS__)
1037 #define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, ...) \
1038 GMOCK_METHOD3_(, const, ct, m, __VA_ARGS__)
1039 #define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, ...) \
1040 GMOCK_METHOD4_(, const, ct, m, __VA_ARGS__)
1041 #define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, ...) \
1042 GMOCK_METHOD5_(, const, ct, m, __VA_ARGS__)
1043 #define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, ...) \
1044 GMOCK_METHOD6_(, const, ct, m, __VA_ARGS__)
1045 #define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, ...) \
1046 GMOCK_METHOD7_(, const, ct, m, __VA_ARGS__)
1047 #define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, ...) \
1048 GMOCK_METHOD8_(, const, ct, m, __VA_ARGS__)
1049 #define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, ...) \
1050 GMOCK_METHOD9_(, const, ct, m, __VA_ARGS__)
1051 #define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, ...) \
1052 GMOCK_METHOD10_(, const, ct, m, __VA_ARGS__)
1054 #define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
1055 GMOCK_METHOD0_(typename, , ct, m, __VA_ARGS__)
1056 #define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
1057 GMOCK_METHOD1_(typename, , ct, m, __VA_ARGS__)
1058 #define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
1059 GMOCK_METHOD2_(typename, , ct, m, __VA_ARGS__)
1060 #define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
1061 GMOCK_METHOD3_(typename, , ct, m, __VA_ARGS__)
1062 #define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
1063 GMOCK_METHOD4_(typename, , ct, m, __VA_ARGS__)
1064 #define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
1065 GMOCK_METHOD5_(typename, , ct, m, __VA_ARGS__)
1066 #define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
1067 GMOCK_METHOD6_(typename, , ct, m, __VA_ARGS__)
1068 #define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
1069 GMOCK_METHOD7_(typename, , ct, m, __VA_ARGS__)
1070 #define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
1071 GMOCK_METHOD8_(typename, , ct, m, __VA_ARGS__)
1072 #define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
1073 GMOCK_METHOD9_(typename, , ct, m, __VA_ARGS__)
1074 #define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
1075 GMOCK_METHOD10_(typename, , ct, m, __VA_ARGS__)
1077 #define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
1078 GMOCK_METHOD0_(typename, const, ct, m, __VA_ARGS__)
1079 #define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
1080 GMOCK_METHOD1_(typename, const, ct, m, __VA_ARGS__)
1081 #define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
1082 GMOCK_METHOD2_(typename, const, ct, m, __VA_ARGS__)
1083 #define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
1084 GMOCK_METHOD3_(typename, const, ct, m, __VA_ARGS__)
1085 #define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
1086 GMOCK_METHOD4_(typename, const, ct, m, __VA_ARGS__)
1087 #define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
1088 GMOCK_METHOD5_(typename, const, ct, m, __VA_ARGS__)
1089 #define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
1090 GMOCK_METHOD6_(typename, const, ct, m, __VA_ARGS__)
1091 #define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
1092 GMOCK_METHOD7_(typename, const, ct, m, __VA_ARGS__)
1093 #define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
1094 GMOCK_METHOD8_(typename, const, ct, m, __VA_ARGS__)
1095 #define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
1096 GMOCK_METHOD9_(typename, const, ct, m, __VA_ARGS__)
1097 #define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
1098 GMOCK_METHOD10_(typename, const, ct, m, __VA_ARGS__)
1100 // A MockFunction<F> class has one mock method whose type is F. It is
1101 // useful when you just want your test code to emit some messages and
1102 // have Google Mock verify the right messages are sent (and perhaps at
1103 // the right times). For example, if you are exercising code:
1109 // and want to verify that Foo(1) and Foo(3) both invoke
1110 // mock.Bar("a"), but Foo(2) doesn't invoke anything, you can write:
1112 // TEST(FooTest, InvokesBarCorrectly) {
1114 // MockFunction<void(string check_point_name)> check;
1118 // EXPECT_CALL(mock, Bar("a"));
1119 // EXPECT_CALL(check, Call("1"));
1120 // EXPECT_CALL(check, Call("2"));
1121 // EXPECT_CALL(mock, Bar("a"));
1130 // The expectation spec says that the first Bar("a") must happen
1131 // before check point "1", the second Bar("a") must happen after check
1132 // point "2", and nothing should happen between the two check
1133 // points. The explicit check points make it easy to tell which
1134 // Bar("a") is called by which call to Foo().
1136 // MockFunction<F> can also be used to exercise code that accepts
1137 // std::function<F> callbacks. To do so, use AsStdFunction() method
1138 // to create std::function proxy forwarding to original object's Call.
1141 // TEST(FooTest, RunsCallbackWithBarArgument) {
1142 // MockFunction<int(string)> callback;
1143 // EXPECT_CALL(callback, Call("bar")).WillOnce(Return(1));
1144 // Foo(callback.AsStdFunction());
1146 template <typename F
>
1149 template <typename R
>
1150 class MockFunction
<R()> {
1154 MOCK_METHOD0_T(Call
, R());
1156 #if GTEST_HAS_STD_FUNCTION_
1157 ::std::function
<R()> AsStdFunction() {
1158 return [this]() -> R
{
1159 return this->Call();
1162 #endif // GTEST_HAS_STD_FUNCTION_
1165 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction
);
1168 template <typename R
, typename A0
>
1169 class MockFunction
<R(A0
)> {
1173 MOCK_METHOD1_T(Call
, R(A0
));
1175 #if GTEST_HAS_STD_FUNCTION_
1176 ::std::function
<R(A0
)> AsStdFunction() {
1177 return [this](A0 a0
) -> R
{
1178 return this->Call(::std::move(a0
));
1181 #endif // GTEST_HAS_STD_FUNCTION_
1184 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction
);
1187 template <typename R
, typename A0
, typename A1
>
1188 class MockFunction
<R(A0
, A1
)> {
1192 MOCK_METHOD2_T(Call
, R(A0
, A1
));
1194 #if GTEST_HAS_STD_FUNCTION_
1195 ::std::function
<R(A0
, A1
)> AsStdFunction() {
1196 return [this](A0 a0
, A1 a1
) -> R
{
1197 return this->Call(::std::move(a0
), ::std::move(a1
));
1200 #endif // GTEST_HAS_STD_FUNCTION_
1203 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction
);
1206 template <typename R
, typename A0
, typename A1
, typename A2
>
1207 class MockFunction
<R(A0
, A1
, A2
)> {
1211 MOCK_METHOD3_T(Call
, R(A0
, A1
, A2
));
1213 #if GTEST_HAS_STD_FUNCTION_
1214 ::std::function
<R(A0
, A1
, A2
)> AsStdFunction() {
1215 return [this](A0 a0
, A1 a1
, A2 a2
) -> R
{
1216 return this->Call(::std::move(a0
), ::std::move(a1
), ::std::move(a2
));
1219 #endif // GTEST_HAS_STD_FUNCTION_
1222 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction
);
1225 template <typename R
, typename A0
, typename A1
, typename A2
, typename A3
>
1226 class MockFunction
<R(A0
, A1
, A2
, A3
)> {
1230 MOCK_METHOD4_T(Call
, R(A0
, A1
, A2
, A3
));
1232 #if GTEST_HAS_STD_FUNCTION_
1233 ::std::function
<R(A0
, A1
, A2
, A3
)> AsStdFunction() {
1234 return [this](A0 a0
, A1 a1
, A2 a2
, A3 a3
) -> R
{
1235 return this->Call(::std::move(a0
), ::std::move(a1
), ::std::move(a2
),
1239 #endif // GTEST_HAS_STD_FUNCTION_
1242 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction
);
1245 template <typename R
, typename A0
, typename A1
, typename A2
, typename A3
,
1247 class MockFunction
<R(A0
, A1
, A2
, A3
, A4
)> {
1251 MOCK_METHOD5_T(Call
, R(A0
, A1
, A2
, A3
, A4
));
1253 #if GTEST_HAS_STD_FUNCTION_
1254 ::std::function
<R(A0
, A1
, A2
, A3
, A4
)> AsStdFunction() {
1255 return [this](A0 a0
, A1 a1
, A2 a2
, A3 a3
, A4 a4
) -> R
{
1256 return this->Call(::std::move(a0
), ::std::move(a1
), ::std::move(a2
),
1257 ::std::move(a3
), ::std::move(a4
));
1260 #endif // GTEST_HAS_STD_FUNCTION_
1263 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction
);
1266 template <typename R
, typename A0
, typename A1
, typename A2
, typename A3
,
1267 typename A4
, typename A5
>
1268 class MockFunction
<R(A0
, A1
, A2
, A3
, A4
, A5
)> {
1272 MOCK_METHOD6_T(Call
, R(A0
, A1
, A2
, A3
, A4
, A5
));
1274 #if GTEST_HAS_STD_FUNCTION_
1275 ::std::function
<R(A0
, A1
, A2
, A3
, A4
, A5
)> AsStdFunction() {
1276 return [this](A0 a0
, A1 a1
, A2 a2
, A3 a3
, A4 a4
, A5 a5
) -> R
{
1277 return this->Call(::std::move(a0
), ::std::move(a1
), ::std::move(a2
),
1278 ::std::move(a3
), ::std::move(a4
), ::std::move(a5
));
1281 #endif // GTEST_HAS_STD_FUNCTION_
1284 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction
);
1287 template <typename R
, typename A0
, typename A1
, typename A2
, typename A3
,
1288 typename A4
, typename A5
, typename A6
>
1289 class MockFunction
<R(A0
, A1
, A2
, A3
, A4
, A5
, A6
)> {
1293 MOCK_METHOD7_T(Call
, R(A0
, A1
, A2
, A3
, A4
, A5
, A6
));
1295 #if GTEST_HAS_STD_FUNCTION_
1296 ::std::function
<R(A0
, A1
, A2
, A3
, A4
, A5
, A6
)> AsStdFunction() {
1297 return [this](A0 a0
, A1 a1
, A2 a2
, A3 a3
, A4 a4
, A5 a5
, A6 a6
) -> R
{
1298 return this->Call(::std::move(a0
), ::std::move(a1
), ::std::move(a2
),
1299 ::std::move(a3
), ::std::move(a4
), ::std::move(a5
), ::std::move(a6
));
1302 #endif // GTEST_HAS_STD_FUNCTION_
1305 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction
);
1308 template <typename R
, typename A0
, typename A1
, typename A2
, typename A3
,
1309 typename A4
, typename A5
, typename A6
, typename A7
>
1310 class MockFunction
<R(A0
, A1
, A2
, A3
, A4
, A5
, A6
, A7
)> {
1314 MOCK_METHOD8_T(Call
, R(A0
, A1
, A2
, A3
, A4
, A5
, A6
, A7
));
1316 #if GTEST_HAS_STD_FUNCTION_
1317 ::std::function
<R(A0
, A1
, A2
, A3
, A4
, A5
, A6
, A7
)> AsStdFunction() {
1318 return [this](A0 a0
, A1 a1
, A2 a2
, A3 a3
, A4 a4
, A5 a5
, A6 a6
, A7 a7
) -> R
{
1319 return this->Call(::std::move(a0
), ::std::move(a1
), ::std::move(a2
),
1320 ::std::move(a3
), ::std::move(a4
), ::std::move(a5
), ::std::move(a6
),
1324 #endif // GTEST_HAS_STD_FUNCTION_
1327 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction
);
1330 template <typename R
, typename A0
, typename A1
, typename A2
, typename A3
,
1331 typename A4
, typename A5
, typename A6
, typename A7
, typename A8
>
1332 class MockFunction
<R(A0
, A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
)> {
1336 MOCK_METHOD9_T(Call
, R(A0
, A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
));
1338 #if GTEST_HAS_STD_FUNCTION_
1339 ::std::function
<R(A0
, A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
)> AsStdFunction() {
1340 return [this](A0 a0
, A1 a1
, A2 a2
, A3 a3
, A4 a4
, A5 a5
, A6 a6
, A7 a7
,
1342 return this->Call(::std::move(a0
), ::std::move(a1
), ::std::move(a2
),
1343 ::std::move(a3
), ::std::move(a4
), ::std::move(a5
), ::std::move(a6
),
1344 ::std::move(a7
), ::std::move(a8
));
1347 #endif // GTEST_HAS_STD_FUNCTION_
1350 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction
);
1353 template <typename R
, typename A0
, typename A1
, typename A2
, typename A3
,
1354 typename A4
, typename A5
, typename A6
, typename A7
, typename A8
,
1356 class MockFunction
<R(A0
, A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
, A9
)> {
1360 MOCK_METHOD10_T(Call
, R(A0
, A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
, A9
));
1362 #if GTEST_HAS_STD_FUNCTION_
1363 ::std::function
<R(A0
, A1
, A2
, A3
, A4
, A5
, A6
, A7
, A8
, A9
)> AsStdFunction() {
1364 return [this](A0 a0
, A1 a1
, A2 a2
, A3 a3
, A4 a4
, A5 a5
, A6 a6
, A7 a7
,
1365 A8 a8
, A9 a9
) -> R
{
1366 return this->Call(::std::move(a0
), ::std::move(a1
), ::std::move(a2
),
1367 ::std::move(a3
), ::std::move(a4
), ::std::move(a5
), ::std::move(a6
),
1368 ::std::move(a7
), ::std::move(a8
), ::std::move(a9
));
1371 #endif // GTEST_HAS_STD_FUNCTION_
1374 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction
);
1377 } // namespace testing
1379 #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_