]> git.proxmox.com Git - ceph.git/blob - ceph/src/s3select/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-generated-function-mockers.h
126c48c739bac25cf4143e04cecd6576a03ff8ca
[ceph.git] / ceph / src / s3select / rapidjson / thirdparty / gtest / googlemock / include / gmock / gmock-generated-function-mockers.h
1 // This file was GENERATED by command:
2 // pump.py gmock-generated-function-mockers.h.pump
3 // DO NOT EDIT BY HAND!!!
4
5 // Copyright 2007, Google Inc.
6 // All rights reserved.
7 //
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions are
10 // met:
11 //
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
17 // distribution.
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.
21 //
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.
33 //
34 // Author: wan@google.com (Zhanyong Wan)
35
36 // Google Mock - a framework for writing C++ mock classes.
37 //
38 // This file implements function mockers of various arities.
39
40 #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
41 #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
42
43 #include "gmock/gmock-spec-builders.h"
44 #include "gmock/internal/gmock-internal-utils.h"
45
46 #if GTEST_HAS_STD_FUNCTION_
47 # include <functional>
48 #endif
49
50 namespace testing {
51 namespace internal {
52
53 template <typename F>
54 class FunctionMockerBase;
55
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.
61 template <typename F>
62 class FunctionMocker;
63
64 template <typename R>
65 class FunctionMocker<R()> : public
66 internal::FunctionMockerBase<R()> {
67 public:
68 typedef R F();
69 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
70
71 MockSpec<F> With() {
72 return MockSpec<F>(this, ::testing::make_tuple());
73 }
74
75 R Invoke() {
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());
81 }
82 };
83
84 template <typename R, typename A1>
85 class FunctionMocker<R(A1)> : public
86 internal::FunctionMockerBase<R(A1)> {
87 public:
88 typedef R F(A1);
89 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
90
91 MockSpec<F> With(const Matcher<A1>& m1) {
92 return MockSpec<F>(this, ::testing::make_tuple(m1));
93 }
94
95 R Invoke(A1 a1) {
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)));
101 }
102 };
103
104 template <typename R, typename A1, typename A2>
105 class FunctionMocker<R(A1, A2)> : public
106 internal::FunctionMockerBase<R(A1, A2)> {
107 public:
108 typedef R F(A1, A2);
109 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
110
111 MockSpec<F> With(const Matcher<A1>& m1, const Matcher<A2>& m2) {
112 return MockSpec<F>(this, ::testing::make_tuple(m1, m2));
113 }
114
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)));
122 }
123 };
124
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)> {
128 public:
129 typedef R F(A1, A2, A3);
130 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
131
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));
135 }
136
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)));
144 }
145 };
146
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)> {
150 public:
151 typedef R F(A1, A2, A3, A4);
152 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
153
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));
157 }
158
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)));
167 }
168 };
169
170 template <typename R, typename A1, typename A2, typename A3, typename A4,
171 typename A5>
172 class FunctionMocker<R(A1, A2, A3, A4, A5)> : public
173 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5)> {
174 public:
175 typedef R F(A1, A2, A3, A4, A5);
176 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
177
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));
181 }
182
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)));
191 }
192 };
193
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)> {
198 public:
199 typedef R F(A1, A2, A3, A4, A5, A6);
200 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
201
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));
206 }
207
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)));
217 }
218 };
219
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)> {
224 public:
225 typedef R F(A1, A2, A3, A4, A5, A6, A7);
226 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
227
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));
232 }
233
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)));
243 }
244 };
245
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)> {
250 public:
251 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8);
252 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
253
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,
258 m8));
259 }
260
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)));
271 }
272 };
273
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)> {
278 public:
279 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9);
280 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
281
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,
287 m8, m9));
288 }
289
290 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) {
291 // 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)));
300 }
301 };
302
303 template <typename R, typename A1, typename A2, typename A3, typename A4,
304 typename A5, typename A6, typename A7, typename A8, typename A9,
305 typename A10>
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)> {
308 public:
309 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
310 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
311
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,
317 m8, m9, m10));
318 }
319
320 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9,
321 A10 a10) {
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)));
332 }
333 };
334
335 // Removes the given pointer; this is a helper for the expectation setter method
336 // for parameterless matchers.
337 //
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:
340 //
341 // class MockClass {
342 // MOCK_METHOD0(GetName, string&());
343 // MOCK_CONST_METHOD0(GetName, const string&());
344 // };
345 //
346 // TEST() {
347 // // This should be an error, as it's not clear which overload is expected.
348 // EXPECT_CALL(mock, GetName).WillOnce(ReturnRef(value));
349 // }
350 //
351 // Here are the generated expectation-setter methods:
352 //
353 // class MockClass {
354 // // Overload 1
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();
363 // }
364 //
365 // // Overload 3
366 // const string& gmock_GetName() const { … }
367 // // Overload 4
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();
372 // }
373 // }
374 //
375 template <typename MockType>
376 const MockType* AdjustConstness_const(const MockType* mock) {
377 return mock;
378 }
379
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);
385 }
386
387 } // namespace internal
388
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;
395
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
399 // in this file).
400 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
401 #define GMOCK_RESULT_(tn, ...) \
402 tn ::testing::internal::Function<__VA_ARGS__>::Result
403
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
408
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__)>&
413
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__)
418
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(); \
428 } \
429 ::testing::MockSpec<__VA_ARGS__> gmock_##Method() constness { \
430 GMOCK_MOCKER_(0, constness, Method).RegisterOwner(this); \
431 return GMOCK_MOCKER_(0, constness, Method).With(); \
432 } \
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(); \
438 } \
439 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(0, constness, \
440 Method)
441
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__)>( \
453 gmock_a1)); \
454 } \
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); \
459 } \
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__)>()); \
465 } \
466 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(1, constness, \
467 Method)
468
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__)>( \
481 gmock_a1), \
482 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
483 gmock_a2)); \
484 } \
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); \
490 } \
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__)>()); \
497 } \
498 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(2, constness, \
499 Method)
500
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__)>( \
514 gmock_a1), \
515 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
516 gmock_a2), \
517 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
518 gmock_a3)); \
519 } \
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); \
527 } \
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__)>()); \
535 } \
536 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(3, constness, \
537 Method)
538
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__)>( \
553 gmock_a1), \
554 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
555 gmock_a2), \
556 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
557 gmock_a3), \
558 ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>( \
559 gmock_a4)); \
560 } \
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); \
569 } \
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__)>()); \
578 } \
579 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(4, constness, \
580 Method)
581
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__)>( \
597 gmock_a1), \
598 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
599 gmock_a2), \
600 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
601 gmock_a3), \
602 ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>( \
603 gmock_a4), \
604 ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>( \
605 gmock_a5)); \
606 } \
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); \
616 } \
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__)>()); \
626 } \
627 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(5, constness, \
628 Method)
629
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__)>( \
646 gmock_a1), \
647 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
648 gmock_a2), \
649 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
650 gmock_a3), \
651 ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>( \
652 gmock_a4), \
653 ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>( \
654 gmock_a5), \
655 ::testing::internal::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>( \
656 gmock_a6)); \
657 } \
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); \
668 } \
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__)>()); \
679 } \
680 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(6, constness, \
681 Method)
682
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__)>( \
700 gmock_a1), \
701 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
702 gmock_a2), \
703 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
704 gmock_a3), \
705 ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>( \
706 gmock_a4), \
707 ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>( \
708 gmock_a5), \
709 ::testing::internal::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>( \
710 gmock_a6), \
711 ::testing::internal::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>( \
712 gmock_a7)); \
713 } \
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, \
725 gmock_a7); \
726 } \
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__)>()); \
738 } \
739 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(7, constness, \
740 Method)
741
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__)>( \
760 gmock_a1), \
761 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
762 gmock_a2), \
763 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
764 gmock_a3), \
765 ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>( \
766 gmock_a4), \
767 ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>( \
768 gmock_a5), \
769 ::testing::internal::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>( \
770 gmock_a6), \
771 ::testing::internal::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>( \
772 gmock_a7), \
773 ::testing::internal::forward<GMOCK_ARG_(tn, 8, __VA_ARGS__)>( \
774 gmock_a8)); \
775 } \
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); \
789 } \
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__)>()); \
802 } \
803 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(8, constness, \
804 Method)
805
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__)>( \
825 gmock_a1), \
826 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
827 gmock_a2), \
828 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
829 gmock_a3), \
830 ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>( \
831 gmock_a4), \
832 ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>( \
833 gmock_a5), \
834 ::testing::internal::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>( \
835 gmock_a6), \
836 ::testing::internal::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>( \
837 gmock_a7), \
838 ::testing::internal::forward<GMOCK_ARG_(tn, 8, __VA_ARGS__)>( \
839 gmock_a8), \
840 ::testing::internal::forward<GMOCK_ARG_(tn, 9, __VA_ARGS__)>( \
841 gmock_a9)); \
842 } \
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); \
857 } \
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__)>()); \
871 } \
872 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(9, constness, \
873 Method)
874
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__)>( \
895 gmock_a1), \
896 ::testing::internal::forward<GMOCK_ARG_(tn, 2, __VA_ARGS__)>( \
897 gmock_a2), \
898 ::testing::internal::forward<GMOCK_ARG_(tn, 3, __VA_ARGS__)>( \
899 gmock_a3), \
900 ::testing::internal::forward<GMOCK_ARG_(tn, 4, __VA_ARGS__)>( \
901 gmock_a4), \
902 ::testing::internal::forward<GMOCK_ARG_(tn, 5, __VA_ARGS__)>( \
903 gmock_a5), \
904 ::testing::internal::forward<GMOCK_ARG_(tn, 6, __VA_ARGS__)>( \
905 gmock_a6), \
906 ::testing::internal::forward<GMOCK_ARG_(tn, 7, __VA_ARGS__)>( \
907 gmock_a7), \
908 ::testing::internal::forward<GMOCK_ARG_(tn, 8, __VA_ARGS__)>( \
909 gmock_a8), \
910 ::testing::internal::forward<GMOCK_ARG_(tn, 9, __VA_ARGS__)>( \
911 gmock_a9), \
912 ::testing::internal::forward<GMOCK_ARG_(tn, 10, __VA_ARGS__)>( \
913 gmock_a10)); \
914 } \
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); \
930 } \
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__)>()); \
945 } \
946 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(10, constness, \
947 Method)
948
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__)
960
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__)
972
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__)
984
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__)
1007
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__)
1030
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__)
1053
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__)
1076
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__)
1099
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:
1104 //
1105 // Foo(1);
1106 // Foo(2);
1107 // Foo(3);
1108 //
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:
1111 //
1112 // TEST(FooTest, InvokesBarCorrectly) {
1113 // MyMock mock;
1114 // MockFunction<void(string check_point_name)> check;
1115 // {
1116 // InSequence s;
1117 //
1118 // EXPECT_CALL(mock, Bar("a"));
1119 // EXPECT_CALL(check, Call("1"));
1120 // EXPECT_CALL(check, Call("2"));
1121 // EXPECT_CALL(mock, Bar("a"));
1122 // }
1123 // Foo(1);
1124 // check.Call("1");
1125 // Foo(2);
1126 // check.Call("2");
1127 // Foo(3);
1128 // }
1129 //
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().
1135 //
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.
1139 // Example:
1140 //
1141 // TEST(FooTest, RunsCallbackWithBarArgument) {
1142 // MockFunction<int(string)> callback;
1143 // EXPECT_CALL(callback, Call("bar")).WillOnce(Return(1));
1144 // Foo(callback.AsStdFunction());
1145 // }
1146 template <typename F>
1147 class MockFunction;
1148
1149 template <typename R>
1150 class MockFunction<R()> {
1151 public:
1152 MockFunction() {}
1153
1154 MOCK_METHOD0_T(Call, R());
1155
1156 #if GTEST_HAS_STD_FUNCTION_
1157 ::std::function<R()> AsStdFunction() {
1158 return [this]() -> R {
1159 return this->Call();
1160 };
1161 }
1162 #endif // GTEST_HAS_STD_FUNCTION_
1163
1164 private:
1165 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1166 };
1167
1168 template <typename R, typename A0>
1169 class MockFunction<R(A0)> {
1170 public:
1171 MockFunction() {}
1172
1173 MOCK_METHOD1_T(Call, R(A0));
1174
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));
1179 };
1180 }
1181 #endif // GTEST_HAS_STD_FUNCTION_
1182
1183 private:
1184 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1185 };
1186
1187 template <typename R, typename A0, typename A1>
1188 class MockFunction<R(A0, A1)> {
1189 public:
1190 MockFunction() {}
1191
1192 MOCK_METHOD2_T(Call, R(A0, A1));
1193
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));
1198 };
1199 }
1200 #endif // GTEST_HAS_STD_FUNCTION_
1201
1202 private:
1203 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1204 };
1205
1206 template <typename R, typename A0, typename A1, typename A2>
1207 class MockFunction<R(A0, A1, A2)> {
1208 public:
1209 MockFunction() {}
1210
1211 MOCK_METHOD3_T(Call, R(A0, A1, A2));
1212
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));
1217 };
1218 }
1219 #endif // GTEST_HAS_STD_FUNCTION_
1220
1221 private:
1222 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1223 };
1224
1225 template <typename R, typename A0, typename A1, typename A2, typename A3>
1226 class MockFunction<R(A0, A1, A2, A3)> {
1227 public:
1228 MockFunction() {}
1229
1230 MOCK_METHOD4_T(Call, R(A0, A1, A2, A3));
1231
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),
1236 ::std::move(a3));
1237 };
1238 }
1239 #endif // GTEST_HAS_STD_FUNCTION_
1240
1241 private:
1242 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1243 };
1244
1245 template <typename R, typename A0, typename A1, typename A2, typename A3,
1246 typename A4>
1247 class MockFunction<R(A0, A1, A2, A3, A4)> {
1248 public:
1249 MockFunction() {}
1250
1251 MOCK_METHOD5_T(Call, R(A0, A1, A2, A3, A4));
1252
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));
1258 };
1259 }
1260 #endif // GTEST_HAS_STD_FUNCTION_
1261
1262 private:
1263 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1264 };
1265
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)> {
1269 public:
1270 MockFunction() {}
1271
1272 MOCK_METHOD6_T(Call, R(A0, A1, A2, A3, A4, A5));
1273
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));
1279 };
1280 }
1281 #endif // GTEST_HAS_STD_FUNCTION_
1282
1283 private:
1284 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1285 };
1286
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)> {
1290 public:
1291 MockFunction() {}
1292
1293 MOCK_METHOD7_T(Call, R(A0, A1, A2, A3, A4, A5, A6));
1294
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));
1300 };
1301 }
1302 #endif // GTEST_HAS_STD_FUNCTION_
1303
1304 private:
1305 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1306 };
1307
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)> {
1311 public:
1312 MockFunction() {}
1313
1314 MOCK_METHOD8_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7));
1315
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),
1321 ::std::move(a7));
1322 };
1323 }
1324 #endif // GTEST_HAS_STD_FUNCTION_
1325
1326 private:
1327 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1328 };
1329
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)> {
1333 public:
1334 MockFunction() {}
1335
1336 MOCK_METHOD9_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8));
1337
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,
1341 A8 a8) -> R {
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));
1345 };
1346 }
1347 #endif // GTEST_HAS_STD_FUNCTION_
1348
1349 private:
1350 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1351 };
1352
1353 template <typename R, typename A0, typename A1, typename A2, typename A3,
1354 typename A4, typename A5, typename A6, typename A7, typename A8,
1355 typename A9>
1356 class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
1357 public:
1358 MockFunction() {}
1359
1360 MOCK_METHOD10_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9));
1361
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));
1369 };
1370 }
1371 #endif // GTEST_HAS_STD_FUNCTION_
1372
1373 private:
1374 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1375 };
1376
1377 } // namespace testing
1378
1379 #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_