[InstCombine] Signed saturation patterns
[llvm-complete.git] / utils / unittest / googlemock / include / gmock / gmock-generated-function-mockers.h
blobfeec9857827bfe1db69925a5087cf3b771f6995e
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.
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:
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.
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 // IWYU pragma: private, include "gmock/gmock.h"
42 #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
43 #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
45 #include "gmock/gmock-spec-builders.h"
46 #include "gmock/internal/gmock-internal-utils.h"
48 #if GTEST_HAS_STD_FUNCTION_
49 # include <functional>
50 #endif
52 namespace testing {
53 namespace internal {
55 template <typename F>
56 class FunctionMockerBase;
58 // Note: class FunctionMocker really belongs to the ::testing
59 // namespace. However if we define it in ::testing, MSVC will
60 // complain when classes in ::testing::internal declare it as a
61 // friend class template. To workaround this compiler bug, we define
62 // FunctionMocker in ::testing::internal and import it into ::testing.
63 template <typename F>
64 class FunctionMocker;
66 template <typename R>
67 class FunctionMocker<R()> : public
68 internal::FunctionMockerBase<R()> {
69 public:
70 typedef R F();
71 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
73 MockSpec<F>& With() {
74 return this->current_spec();
77 R Invoke() {
78 // Even though gcc and MSVC don't enforce it, 'this->' is required
79 // by the C++ standard [14.6.4] here, as the base class type is
80 // dependent on the template argument (and thus shouldn't be
81 // looked into when resolving InvokeWith).
82 return this->InvokeWith(ArgumentTuple());
86 template <typename R, typename A1>
87 class FunctionMocker<R(A1)> : public
88 internal::FunctionMockerBase<R(A1)> {
89 public:
90 typedef R F(A1);
91 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
93 MockSpec<F>& With(const Matcher<A1>& m1) {
94 this->current_spec().SetMatchers(::testing::make_tuple(m1));
95 return this->current_spec();
98 R Invoke(A1 a1) {
99 // Even though gcc and MSVC don't enforce it, 'this->' is required
100 // by the C++ standard [14.6.4] here, as the base class type is
101 // dependent on the template argument (and thus shouldn't be
102 // looked into when resolving InvokeWith).
103 return this->InvokeWith(ArgumentTuple(a1));
107 template <typename R, typename A1, typename A2>
108 class FunctionMocker<R(A1, A2)> : public
109 internal::FunctionMockerBase<R(A1, A2)> {
110 public:
111 typedef R F(A1, A2);
112 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
114 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2) {
115 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2));
116 return this->current_spec();
119 R Invoke(A1 a1, A2 a2) {
120 // Even though gcc and MSVC don't enforce it, 'this->' is required
121 // by the C++ standard [14.6.4] here, as the base class type is
122 // dependent on the template argument (and thus shouldn't be
123 // looked into when resolving InvokeWith).
124 return this->InvokeWith(ArgumentTuple(a1, a2));
128 template <typename R, typename A1, typename A2, typename A3>
129 class FunctionMocker<R(A1, A2, A3)> : public
130 internal::FunctionMockerBase<R(A1, A2, A3)> {
131 public:
132 typedef R F(A1, A2, A3);
133 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
135 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
136 const Matcher<A3>& m3) {
137 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3));
138 return this->current_spec();
141 R Invoke(A1 a1, A2 a2, A3 a3) {
142 // Even though gcc and MSVC don't enforce it, 'this->' is required
143 // by the C++ standard [14.6.4] here, as the base class type is
144 // dependent on the template argument (and thus shouldn't be
145 // looked into when resolving InvokeWith).
146 return this->InvokeWith(ArgumentTuple(a1, a2, a3));
150 template <typename R, typename A1, typename A2, typename A3, typename A4>
151 class FunctionMocker<R(A1, A2, A3, A4)> : public
152 internal::FunctionMockerBase<R(A1, A2, A3, A4)> {
153 public:
154 typedef R F(A1, A2, A3, A4);
155 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
157 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
158 const Matcher<A3>& m3, const Matcher<A4>& m4) {
159 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4));
160 return this->current_spec();
163 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4) {
164 // Even though gcc and MSVC don't enforce it, 'this->' is required
165 // by the C++ standard [14.6.4] here, as the base class type is
166 // dependent on the template argument (and thus shouldn't be
167 // looked into when resolving InvokeWith).
168 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4));
172 template <typename R, typename A1, typename A2, typename A3, typename A4,
173 typename A5>
174 class FunctionMocker<R(A1, A2, A3, A4, A5)> : public
175 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5)> {
176 public:
177 typedef R F(A1, A2, A3, A4, A5);
178 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
180 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
181 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5) {
182 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5));
183 return this->current_spec();
186 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
187 // Even though gcc and MSVC don't enforce it, 'this->' is required
188 // by the C++ standard [14.6.4] here, as the base class type is
189 // dependent on the template argument (and thus shouldn't be
190 // looked into when resolving InvokeWith).
191 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5));
195 template <typename R, typename A1, typename A2, typename A3, typename A4,
196 typename A5, typename A6>
197 class FunctionMocker<R(A1, A2, A3, A4, A5, A6)> : public
198 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6)> {
199 public:
200 typedef R F(A1, A2, A3, A4, A5, A6);
201 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
203 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
204 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
205 const Matcher<A6>& m6) {
206 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5,
207 m6));
208 return this->current_spec();
211 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) {
212 // Even though gcc and MSVC don't enforce it, 'this->' is required
213 // by the C++ standard [14.6.4] here, as the base class type is
214 // dependent on the template argument (and thus shouldn't be
215 // looked into when resolving InvokeWith).
216 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, 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)> {
224 public:
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 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5,
232 m6, m7));
233 return this->current_spec();
236 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) {
237 // Even though gcc and MSVC don't enforce it, 'this->' is required
238 // by the C++ standard [14.6.4] here, as the base class type is
239 // dependent on the template argument (and thus shouldn't be
240 // looked into when resolving InvokeWith).
241 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7));
245 template <typename R, typename A1, typename A2, typename A3, typename A4,
246 typename A5, typename A6, typename A7, typename A8>
247 class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8)> : public
248 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8)> {
249 public:
250 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8);
251 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
253 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
254 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
255 const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8) {
256 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5,
257 m6, m7, m8));
258 return this->current_spec();
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(a1, a2, a3, a4, a5, a6, a7, a8));
270 template <typename R, typename A1, typename A2, typename A3, typename A4,
271 typename A5, typename A6, typename A7, typename A8, typename A9>
272 class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> : public
273 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
274 public:
275 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9);
276 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
278 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
279 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
280 const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8,
281 const Matcher<A9>& m9) {
282 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5,
283 m6, m7, m8, m9));
284 return this->current_spec();
287 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) {
288 // Even though gcc and MSVC don't enforce it, 'this->' is required
289 // by the C++ standard [14.6.4] here, as the base class type is
290 // dependent on the template argument (and thus shouldn't be
291 // looked into when resolving InvokeWith).
292 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8, a9));
296 template <typename R, typename A1, typename A2, typename A3, typename A4,
297 typename A5, typename A6, typename A7, typename A8, typename A9,
298 typename A10>
299 class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> : public
300 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> {
301 public:
302 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
303 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
305 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
306 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
307 const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8,
308 const Matcher<A9>& m9, const Matcher<A10>& m10) {
309 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5,
310 m6, m7, m8, m9, m10));
311 return this->current_spec();
314 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9,
315 A10 a10) {
316 // Even though gcc and MSVC don't enforce it, 'this->' is required
317 // by the C++ standard [14.6.4] here, as the base class type is
318 // dependent on the template argument (and thus shouldn't be
319 // looked into when resolving InvokeWith).
320 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8, a9,
321 a10));
325 } // namespace internal
327 // The style guide prohibits "using" statements in a namespace scope
328 // inside a header file. However, the FunctionMocker class template
329 // is meant to be defined in the ::testing namespace. The following
330 // line is just a trick for working around a bug in MSVC 8.0, which
331 // cannot handle it if we define FunctionMocker in ::testing.
332 using internal::FunctionMocker;
334 // GMOCK_RESULT_(tn, F) expands to the result type of function type F.
335 // We define this as a variadic macro in case F contains unprotected
336 // commas (the same reason that we use variadic macros in other places
337 // in this file).
338 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
339 #define GMOCK_RESULT_(tn, ...) \
340 tn ::testing::internal::Function<__VA_ARGS__>::Result
342 // The type of argument N of the given function type.
343 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
344 #define GMOCK_ARG_(tn, N, ...) \
345 tn ::testing::internal::Function<__VA_ARGS__>::Argument##N
347 // The matcher type for argument N of the given function type.
348 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
349 #define GMOCK_MATCHER_(tn, N, ...) \
350 const ::testing::Matcher<GMOCK_ARG_(tn, N, __VA_ARGS__)>&
352 // The variable for mocking the given method.
353 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
354 #define GMOCK_MOCKER_(arity, constness, Method) \
355 GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__)
357 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
358 #define GMOCK_METHOD0_(tn, constness, ct, Method, ...) \
359 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
360 ) constness { \
361 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
362 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
363 == 0), \
364 this_method_does_not_take_0_arguments); \
365 GMOCK_MOCKER_(0, constness, Method).SetOwnerAndName(this, #Method); \
366 return GMOCK_MOCKER_(0, constness, Method).Invoke(); \
368 ::testing::MockSpec<__VA_ARGS__>& \
369 gmock_##Method() constness { \
370 GMOCK_MOCKER_(0, constness, Method).RegisterOwner(this); \
371 return GMOCK_MOCKER_(0, constness, Method).With(); \
373 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(0, constness, \
374 Method)
376 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
377 #define GMOCK_METHOD1_(tn, constness, ct, Method, ...) \
378 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
379 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1) constness { \
380 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
381 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
382 == 1), \
383 this_method_does_not_take_1_argument); \
384 GMOCK_MOCKER_(1, constness, Method).SetOwnerAndName(this, #Method); \
385 return GMOCK_MOCKER_(1, constness, Method).Invoke(gmock_a1); \
387 ::testing::MockSpec<__VA_ARGS__>& \
388 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1) constness { \
389 GMOCK_MOCKER_(1, constness, Method).RegisterOwner(this); \
390 return GMOCK_MOCKER_(1, constness, Method).With(gmock_a1); \
392 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(1, constness, \
393 Method)
395 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
396 #define GMOCK_METHOD2_(tn, constness, ct, Method, ...) \
397 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
398 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
399 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2) constness { \
400 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
401 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
402 == 2), \
403 this_method_does_not_take_2_arguments); \
404 GMOCK_MOCKER_(2, constness, Method).SetOwnerAndName(this, #Method); \
405 return GMOCK_MOCKER_(2, constness, Method).Invoke(gmock_a1, gmock_a2); \
407 ::testing::MockSpec<__VA_ARGS__>& \
408 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
409 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2) constness { \
410 GMOCK_MOCKER_(2, constness, Method).RegisterOwner(this); \
411 return GMOCK_MOCKER_(2, constness, Method).With(gmock_a1, gmock_a2); \
413 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(2, constness, \
414 Method)
416 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
417 #define GMOCK_METHOD3_(tn, constness, ct, Method, ...) \
418 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
419 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
420 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
421 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3) constness { \
422 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
423 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
424 == 3), \
425 this_method_does_not_take_3_arguments); \
426 GMOCK_MOCKER_(3, constness, Method).SetOwnerAndName(this, #Method); \
427 return GMOCK_MOCKER_(3, constness, Method).Invoke(gmock_a1, gmock_a2, \
428 gmock_a3); \
430 ::testing::MockSpec<__VA_ARGS__>& \
431 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
432 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
433 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3) constness { \
434 GMOCK_MOCKER_(3, constness, Method).RegisterOwner(this); \
435 return GMOCK_MOCKER_(3, constness, Method).With(gmock_a1, gmock_a2, \
436 gmock_a3); \
438 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(3, constness, \
439 Method)
441 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
442 #define GMOCK_METHOD4_(tn, constness, ct, Method, ...) \
443 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
444 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
445 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
446 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
447 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4) constness { \
448 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
449 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
450 == 4), \
451 this_method_does_not_take_4_arguments); \
452 GMOCK_MOCKER_(4, constness, Method).SetOwnerAndName(this, #Method); \
453 return GMOCK_MOCKER_(4, constness, Method).Invoke(gmock_a1, gmock_a2, \
454 gmock_a3, gmock_a4); \
456 ::testing::MockSpec<__VA_ARGS__>& \
457 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
458 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
459 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
460 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4) constness { \
461 GMOCK_MOCKER_(4, constness, Method).RegisterOwner(this); \
462 return GMOCK_MOCKER_(4, constness, Method).With(gmock_a1, gmock_a2, \
463 gmock_a3, gmock_a4); \
465 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(4, constness, \
466 Method)
468 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
469 #define GMOCK_METHOD5_(tn, constness, ct, Method, ...) \
470 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
471 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
472 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
473 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
474 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
475 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5) constness { \
476 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
477 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
478 == 5), \
479 this_method_does_not_take_5_arguments); \
480 GMOCK_MOCKER_(5, constness, Method).SetOwnerAndName(this, #Method); \
481 return GMOCK_MOCKER_(5, constness, Method).Invoke(gmock_a1, gmock_a2, \
482 gmock_a3, gmock_a4, gmock_a5); \
484 ::testing::MockSpec<__VA_ARGS__>& \
485 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
486 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
487 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
488 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
489 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5) constness { \
490 GMOCK_MOCKER_(5, constness, Method).RegisterOwner(this); \
491 return GMOCK_MOCKER_(5, constness, Method).With(gmock_a1, gmock_a2, \
492 gmock_a3, gmock_a4, gmock_a5); \
494 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(5, constness, \
495 Method)
497 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
498 #define GMOCK_METHOD6_(tn, constness, ct, Method, ...) \
499 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
500 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
501 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
502 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
503 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
504 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
505 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6) constness { \
506 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
507 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
508 == 6), \
509 this_method_does_not_take_6_arguments); \
510 GMOCK_MOCKER_(6, constness, Method).SetOwnerAndName(this, #Method); \
511 return GMOCK_MOCKER_(6, constness, Method).Invoke(gmock_a1, gmock_a2, \
512 gmock_a3, gmock_a4, gmock_a5, gmock_a6); \
514 ::testing::MockSpec<__VA_ARGS__>& \
515 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
516 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
517 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
518 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
519 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
520 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6) constness { \
521 GMOCK_MOCKER_(6, constness, Method).RegisterOwner(this); \
522 return GMOCK_MOCKER_(6, constness, Method).With(gmock_a1, gmock_a2, \
523 gmock_a3, gmock_a4, gmock_a5, gmock_a6); \
525 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(6, constness, \
526 Method)
528 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
529 #define GMOCK_METHOD7_(tn, constness, ct, Method, ...) \
530 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
531 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
532 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
533 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
534 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
535 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
536 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
537 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7) constness { \
538 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
539 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
540 == 7), \
541 this_method_does_not_take_7_arguments); \
542 GMOCK_MOCKER_(7, constness, Method).SetOwnerAndName(this, #Method); \
543 return GMOCK_MOCKER_(7, constness, Method).Invoke(gmock_a1, gmock_a2, \
544 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \
546 ::testing::MockSpec<__VA_ARGS__>& \
547 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
548 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
549 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
550 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
551 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
552 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
553 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7) constness { \
554 GMOCK_MOCKER_(7, constness, Method).RegisterOwner(this); \
555 return GMOCK_MOCKER_(7, constness, Method).With(gmock_a1, gmock_a2, \
556 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \
558 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(7, constness, \
559 Method)
561 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
562 #define GMOCK_METHOD8_(tn, constness, ct, Method, ...) \
563 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
564 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
565 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
566 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
567 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
568 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
569 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
570 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
571 GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8) constness { \
572 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
573 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
574 == 8), \
575 this_method_does_not_take_8_arguments); \
576 GMOCK_MOCKER_(8, constness, Method).SetOwnerAndName(this, #Method); \
577 return GMOCK_MOCKER_(8, constness, Method).Invoke(gmock_a1, gmock_a2, \
578 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \
580 ::testing::MockSpec<__VA_ARGS__>& \
581 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
582 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
583 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
584 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
585 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
586 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
587 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
588 GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8) constness { \
589 GMOCK_MOCKER_(8, constness, Method).RegisterOwner(this); \
590 return GMOCK_MOCKER_(8, constness, Method).With(gmock_a1, gmock_a2, \
591 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \
593 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(8, constness, \
594 Method)
596 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
597 #define GMOCK_METHOD9_(tn, constness, ct, Method, ...) \
598 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
599 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
600 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
601 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
602 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
603 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
604 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
605 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
606 GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8, \
607 GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9) constness { \
608 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
609 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
610 == 9), \
611 this_method_does_not_take_9_arguments); \
612 GMOCK_MOCKER_(9, constness, Method).SetOwnerAndName(this, #Method); \
613 return GMOCK_MOCKER_(9, constness, Method).Invoke(gmock_a1, gmock_a2, \
614 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \
615 gmock_a9); \
617 ::testing::MockSpec<__VA_ARGS__>& \
618 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
619 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
620 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
621 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
622 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
623 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
624 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
625 GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \
626 GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9) constness { \
627 GMOCK_MOCKER_(9, constness, Method).RegisterOwner(this); \
628 return GMOCK_MOCKER_(9, constness, Method).With(gmock_a1, gmock_a2, \
629 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \
630 gmock_a9); \
632 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(9, constness, \
633 Method)
635 // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
636 #define GMOCK_METHOD10_(tn, constness, ct, Method, ...) \
637 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
638 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
639 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
640 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
641 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
642 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
643 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
644 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
645 GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8, \
646 GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9, \
647 GMOCK_ARG_(tn, 10, __VA_ARGS__) gmock_a10) constness { \
648 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
649 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
650 == 10), \
651 this_method_does_not_take_10_arguments); \
652 GMOCK_MOCKER_(10, constness, Method).SetOwnerAndName(this, #Method); \
653 return GMOCK_MOCKER_(10, constness, Method).Invoke(gmock_a1, gmock_a2, \
654 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \
655 gmock_a10); \
657 ::testing::MockSpec<__VA_ARGS__>& \
658 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
659 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
660 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
661 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
662 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
663 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
664 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
665 GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \
666 GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9, \
667 GMOCK_MATCHER_(tn, 10, \
668 __VA_ARGS__) gmock_a10) constness { \
669 GMOCK_MOCKER_(10, constness, Method).RegisterOwner(this); \
670 return GMOCK_MOCKER_(10, constness, Method).With(gmock_a1, gmock_a2, \
671 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \
672 gmock_a10); \
674 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(10, constness, \
675 Method)
677 #define MOCK_METHOD0(m, ...) GMOCK_METHOD0_(, , , m, __VA_ARGS__)
678 #define MOCK_METHOD1(m, ...) GMOCK_METHOD1_(, , , m, __VA_ARGS__)
679 #define MOCK_METHOD2(m, ...) GMOCK_METHOD2_(, , , m, __VA_ARGS__)
680 #define MOCK_METHOD3(m, ...) GMOCK_METHOD3_(, , , m, __VA_ARGS__)
681 #define MOCK_METHOD4(m, ...) GMOCK_METHOD4_(, , , m, __VA_ARGS__)
682 #define MOCK_METHOD5(m, ...) GMOCK_METHOD5_(, , , m, __VA_ARGS__)
683 #define MOCK_METHOD6(m, ...) GMOCK_METHOD6_(, , , m, __VA_ARGS__)
684 #define MOCK_METHOD7(m, ...) GMOCK_METHOD7_(, , , m, __VA_ARGS__)
685 #define MOCK_METHOD8(m, ...) GMOCK_METHOD8_(, , , m, __VA_ARGS__)
686 #define MOCK_METHOD9(m, ...) GMOCK_METHOD9_(, , , m, __VA_ARGS__)
687 #define MOCK_METHOD10(m, ...) GMOCK_METHOD10_(, , , m, __VA_ARGS__)
689 #define MOCK_CONST_METHOD0(m, ...) GMOCK_METHOD0_(, const, , m, __VA_ARGS__)
690 #define MOCK_CONST_METHOD1(m, ...) GMOCK_METHOD1_(, const, , m, __VA_ARGS__)
691 #define MOCK_CONST_METHOD2(m, ...) GMOCK_METHOD2_(, const, , m, __VA_ARGS__)
692 #define MOCK_CONST_METHOD3(m, ...) GMOCK_METHOD3_(, const, , m, __VA_ARGS__)
693 #define MOCK_CONST_METHOD4(m, ...) GMOCK_METHOD4_(, const, , m, __VA_ARGS__)
694 #define MOCK_CONST_METHOD5(m, ...) GMOCK_METHOD5_(, const, , m, __VA_ARGS__)
695 #define MOCK_CONST_METHOD6(m, ...) GMOCK_METHOD6_(, const, , m, __VA_ARGS__)
696 #define MOCK_CONST_METHOD7(m, ...) GMOCK_METHOD7_(, const, , m, __VA_ARGS__)
697 #define MOCK_CONST_METHOD8(m, ...) GMOCK_METHOD8_(, const, , m, __VA_ARGS__)
698 #define MOCK_CONST_METHOD9(m, ...) GMOCK_METHOD9_(, const, , m, __VA_ARGS__)
699 #define MOCK_CONST_METHOD10(m, ...) GMOCK_METHOD10_(, const, , m, __VA_ARGS__)
701 #define MOCK_METHOD0_T(m, ...) GMOCK_METHOD0_(typename, , , m, __VA_ARGS__)
702 #define MOCK_METHOD1_T(m, ...) GMOCK_METHOD1_(typename, , , m, __VA_ARGS__)
703 #define MOCK_METHOD2_T(m, ...) GMOCK_METHOD2_(typename, , , m, __VA_ARGS__)
704 #define MOCK_METHOD3_T(m, ...) GMOCK_METHOD3_(typename, , , m, __VA_ARGS__)
705 #define MOCK_METHOD4_T(m, ...) GMOCK_METHOD4_(typename, , , m, __VA_ARGS__)
706 #define MOCK_METHOD5_T(m, ...) GMOCK_METHOD5_(typename, , , m, __VA_ARGS__)
707 #define MOCK_METHOD6_T(m, ...) GMOCK_METHOD6_(typename, , , m, __VA_ARGS__)
708 #define MOCK_METHOD7_T(m, ...) GMOCK_METHOD7_(typename, , , m, __VA_ARGS__)
709 #define MOCK_METHOD8_T(m, ...) GMOCK_METHOD8_(typename, , , m, __VA_ARGS__)
710 #define MOCK_METHOD9_T(m, ...) GMOCK_METHOD9_(typename, , , m, __VA_ARGS__)
711 #define MOCK_METHOD10_T(m, ...) GMOCK_METHOD10_(typename, , , m, __VA_ARGS__)
713 #define MOCK_CONST_METHOD0_T(m, ...) \
714 GMOCK_METHOD0_(typename, const, , m, __VA_ARGS__)
715 #define MOCK_CONST_METHOD1_T(m, ...) \
716 GMOCK_METHOD1_(typename, const, , m, __VA_ARGS__)
717 #define MOCK_CONST_METHOD2_T(m, ...) \
718 GMOCK_METHOD2_(typename, const, , m, __VA_ARGS__)
719 #define MOCK_CONST_METHOD3_T(m, ...) \
720 GMOCK_METHOD3_(typename, const, , m, __VA_ARGS__)
721 #define MOCK_CONST_METHOD4_T(m, ...) \
722 GMOCK_METHOD4_(typename, const, , m, __VA_ARGS__)
723 #define MOCK_CONST_METHOD5_T(m, ...) \
724 GMOCK_METHOD5_(typename, const, , m, __VA_ARGS__)
725 #define MOCK_CONST_METHOD6_T(m, ...) \
726 GMOCK_METHOD6_(typename, const, , m, __VA_ARGS__)
727 #define MOCK_CONST_METHOD7_T(m, ...) \
728 GMOCK_METHOD7_(typename, const, , m, __VA_ARGS__)
729 #define MOCK_CONST_METHOD8_T(m, ...) \
730 GMOCK_METHOD8_(typename, const, , m, __VA_ARGS__)
731 #define MOCK_CONST_METHOD9_T(m, ...) \
732 GMOCK_METHOD9_(typename, const, , m, __VA_ARGS__)
733 #define MOCK_CONST_METHOD10_T(m, ...) \
734 GMOCK_METHOD10_(typename, const, , m, __VA_ARGS__)
736 #define MOCK_METHOD0_WITH_CALLTYPE(ct, m, ...) \
737 GMOCK_METHOD0_(, , ct, m, __VA_ARGS__)
738 #define MOCK_METHOD1_WITH_CALLTYPE(ct, m, ...) \
739 GMOCK_METHOD1_(, , ct, m, __VA_ARGS__)
740 #define MOCK_METHOD2_WITH_CALLTYPE(ct, m, ...) \
741 GMOCK_METHOD2_(, , ct, m, __VA_ARGS__)
742 #define MOCK_METHOD3_WITH_CALLTYPE(ct, m, ...) \
743 GMOCK_METHOD3_(, , ct, m, __VA_ARGS__)
744 #define MOCK_METHOD4_WITH_CALLTYPE(ct, m, ...) \
745 GMOCK_METHOD4_(, , ct, m, __VA_ARGS__)
746 #define MOCK_METHOD5_WITH_CALLTYPE(ct, m, ...) \
747 GMOCK_METHOD5_(, , ct, m, __VA_ARGS__)
748 #define MOCK_METHOD6_WITH_CALLTYPE(ct, m, ...) \
749 GMOCK_METHOD6_(, , ct, m, __VA_ARGS__)
750 #define MOCK_METHOD7_WITH_CALLTYPE(ct, m, ...) \
751 GMOCK_METHOD7_(, , ct, m, __VA_ARGS__)
752 #define MOCK_METHOD8_WITH_CALLTYPE(ct, m, ...) \
753 GMOCK_METHOD8_(, , ct, m, __VA_ARGS__)
754 #define MOCK_METHOD9_WITH_CALLTYPE(ct, m, ...) \
755 GMOCK_METHOD9_(, , ct, m, __VA_ARGS__)
756 #define MOCK_METHOD10_WITH_CALLTYPE(ct, m, ...) \
757 GMOCK_METHOD10_(, , ct, m, __VA_ARGS__)
759 #define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, ...) \
760 GMOCK_METHOD0_(, const, ct, m, __VA_ARGS__)
761 #define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, ...) \
762 GMOCK_METHOD1_(, const, ct, m, __VA_ARGS__)
763 #define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, ...) \
764 GMOCK_METHOD2_(, const, ct, m, __VA_ARGS__)
765 #define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, ...) \
766 GMOCK_METHOD3_(, const, ct, m, __VA_ARGS__)
767 #define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, ...) \
768 GMOCK_METHOD4_(, const, ct, m, __VA_ARGS__)
769 #define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, ...) \
770 GMOCK_METHOD5_(, const, ct, m, __VA_ARGS__)
771 #define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, ...) \
772 GMOCK_METHOD6_(, const, ct, m, __VA_ARGS__)
773 #define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, ...) \
774 GMOCK_METHOD7_(, const, ct, m, __VA_ARGS__)
775 #define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, ...) \
776 GMOCK_METHOD8_(, const, ct, m, __VA_ARGS__)
777 #define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, ...) \
778 GMOCK_METHOD9_(, const, ct, m, __VA_ARGS__)
779 #define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, ...) \
780 GMOCK_METHOD10_(, const, ct, m, __VA_ARGS__)
782 #define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
783 GMOCK_METHOD0_(typename, , ct, m, __VA_ARGS__)
784 #define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
785 GMOCK_METHOD1_(typename, , ct, m, __VA_ARGS__)
786 #define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
787 GMOCK_METHOD2_(typename, , ct, m, __VA_ARGS__)
788 #define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
789 GMOCK_METHOD3_(typename, , ct, m, __VA_ARGS__)
790 #define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
791 GMOCK_METHOD4_(typename, , ct, m, __VA_ARGS__)
792 #define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
793 GMOCK_METHOD5_(typename, , ct, m, __VA_ARGS__)
794 #define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
795 GMOCK_METHOD6_(typename, , ct, m, __VA_ARGS__)
796 #define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
797 GMOCK_METHOD7_(typename, , ct, m, __VA_ARGS__)
798 #define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
799 GMOCK_METHOD8_(typename, , ct, m, __VA_ARGS__)
800 #define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
801 GMOCK_METHOD9_(typename, , ct, m, __VA_ARGS__)
802 #define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
803 GMOCK_METHOD10_(typename, , ct, m, __VA_ARGS__)
805 #define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
806 GMOCK_METHOD0_(typename, const, ct, m, __VA_ARGS__)
807 #define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
808 GMOCK_METHOD1_(typename, const, ct, m, __VA_ARGS__)
809 #define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
810 GMOCK_METHOD2_(typename, const, ct, m, __VA_ARGS__)
811 #define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
812 GMOCK_METHOD3_(typename, const, ct, m, __VA_ARGS__)
813 #define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
814 GMOCK_METHOD4_(typename, const, ct, m, __VA_ARGS__)
815 #define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
816 GMOCK_METHOD5_(typename, const, ct, m, __VA_ARGS__)
817 #define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
818 GMOCK_METHOD6_(typename, const, ct, m, __VA_ARGS__)
819 #define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
820 GMOCK_METHOD7_(typename, const, ct, m, __VA_ARGS__)
821 #define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
822 GMOCK_METHOD8_(typename, const, ct, m, __VA_ARGS__)
823 #define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
824 GMOCK_METHOD9_(typename, const, ct, m, __VA_ARGS__)
825 #define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
826 GMOCK_METHOD10_(typename, const, ct, m, __VA_ARGS__)
828 // A MockFunction<F> class has one mock method whose type is F. It is
829 // useful when you just want your test code to emit some messages and
830 // have Google Mock verify the right messages are sent (and perhaps at
831 // the right times). For example, if you are exercising code:
833 // Foo(1);
834 // Foo(2);
835 // Foo(3);
837 // and want to verify that Foo(1) and Foo(3) both invoke
838 // mock.Bar("a"), but Foo(2) doesn't invoke anything, you can write:
840 // TEST(FooTest, InvokesBarCorrectly) {
841 // MyMock mock;
842 // MockFunction<void(string check_point_name)> check;
843 // {
844 // InSequence s;
846 // EXPECT_CALL(mock, Bar("a"));
847 // EXPECT_CALL(check, Call("1"));
848 // EXPECT_CALL(check, Call("2"));
849 // EXPECT_CALL(mock, Bar("a"));
850 // }
851 // Foo(1);
852 // check.Call("1");
853 // Foo(2);
854 // check.Call("2");
855 // Foo(3);
856 // }
858 // The expectation spec says that the first Bar("a") must happen
859 // before check point "1", the second Bar("a") must happen after check
860 // point "2", and nothing should happen between the two check
861 // points. The explicit check points make it easy to tell which
862 // Bar("a") is called by which call to Foo().
864 // MockFunction<F> can also be used to exercise code that accepts
865 // std::function<F> callbacks. To do so, use AsStdFunction() method
866 // to create std::function proxy forwarding to original object's Call.
867 // Example:
869 // TEST(FooTest, RunsCallbackWithBarArgument) {
870 // MockFunction<int(string)> callback;
871 // EXPECT_CALL(callback, Call("bar")).WillOnce(Return(1));
872 // Foo(callback.AsStdFunction());
873 // }
874 template <typename F>
875 class MockFunction;
877 template <typename R>
878 class MockFunction<R()> {
879 public:
880 MockFunction() {}
882 MOCK_METHOD0_T(Call, R());
884 #if GTEST_HAS_STD_FUNCTION_
885 std::function<R()> AsStdFunction() {
886 return [this]() -> R {
887 return this->Call();
890 #endif // GTEST_HAS_STD_FUNCTION_
892 private:
893 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
896 template <typename R, typename A0>
897 class MockFunction<R(A0)> {
898 public:
899 MockFunction() {}
901 MOCK_METHOD1_T(Call, R(A0));
903 #if GTEST_HAS_STD_FUNCTION_
904 std::function<R(A0)> AsStdFunction() {
905 return [this](A0 a0) -> R {
906 return this->Call(a0);
909 #endif // GTEST_HAS_STD_FUNCTION_
911 private:
912 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
915 template <typename R, typename A0, typename A1>
916 class MockFunction<R(A0, A1)> {
917 public:
918 MockFunction() {}
920 MOCK_METHOD2_T(Call, R(A0, A1));
922 #if GTEST_HAS_STD_FUNCTION_
923 std::function<R(A0, A1)> AsStdFunction() {
924 return [this](A0 a0, A1 a1) -> R {
925 return this->Call(a0, a1);
928 #endif // GTEST_HAS_STD_FUNCTION_
930 private:
931 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
934 template <typename R, typename A0, typename A1, typename A2>
935 class MockFunction<R(A0, A1, A2)> {
936 public:
937 MockFunction() {}
939 MOCK_METHOD3_T(Call, R(A0, A1, A2));
941 #if GTEST_HAS_STD_FUNCTION_
942 std::function<R(A0, A1, A2)> AsStdFunction() {
943 return [this](A0 a0, A1 a1, A2 a2) -> R {
944 return this->Call(a0, a1, a2);
947 #endif // GTEST_HAS_STD_FUNCTION_
949 private:
950 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
953 template <typename R, typename A0, typename A1, typename A2, typename A3>
954 class MockFunction<R(A0, A1, A2, A3)> {
955 public:
956 MockFunction() {}
958 MOCK_METHOD4_T(Call, R(A0, A1, A2, A3));
960 #if GTEST_HAS_STD_FUNCTION_
961 std::function<R(A0, A1, A2, A3)> AsStdFunction() {
962 return [this](A0 a0, A1 a1, A2 a2, A3 a3) -> R {
963 return this->Call(a0, a1, a2, a3);
966 #endif // GTEST_HAS_STD_FUNCTION_
968 private:
969 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
972 template <typename R, typename A0, typename A1, typename A2, typename A3,
973 typename A4>
974 class MockFunction<R(A0, A1, A2, A3, A4)> {
975 public:
976 MockFunction() {}
978 MOCK_METHOD5_T(Call, R(A0, A1, A2, A3, A4));
980 #if GTEST_HAS_STD_FUNCTION_
981 std::function<R(A0, A1, A2, A3, A4)> AsStdFunction() {
982 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) -> R {
983 return this->Call(a0, a1, a2, a3, a4);
986 #endif // GTEST_HAS_STD_FUNCTION_
988 private:
989 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
992 template <typename R, typename A0, typename A1, typename A2, typename A3,
993 typename A4, typename A5>
994 class MockFunction<R(A0, A1, A2, A3, A4, A5)> {
995 public:
996 MockFunction() {}
998 MOCK_METHOD6_T(Call, R(A0, A1, A2, A3, A4, A5));
1000 #if GTEST_HAS_STD_FUNCTION_
1001 std::function<R(A0, A1, A2, A3, A4, A5)> AsStdFunction() {
1002 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -> R {
1003 return this->Call(a0, a1, a2, a3, a4, a5);
1006 #endif // GTEST_HAS_STD_FUNCTION_
1008 private:
1009 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1012 template <typename R, typename A0, typename A1, typename A2, typename A3,
1013 typename A4, typename A5, typename A6>
1014 class MockFunction<R(A0, A1, A2, A3, A4, A5, A6)> {
1015 public:
1016 MockFunction() {}
1018 MOCK_METHOD7_T(Call, R(A0, A1, A2, A3, A4, A5, A6));
1020 #if GTEST_HAS_STD_FUNCTION_
1021 std::function<R(A0, A1, A2, A3, A4, A5, A6)> AsStdFunction() {
1022 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -> R {
1023 return this->Call(a0, a1, a2, a3, a4, a5, a6);
1026 #endif // GTEST_HAS_STD_FUNCTION_
1028 private:
1029 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1032 template <typename R, typename A0, typename A1, typename A2, typename A3,
1033 typename A4, typename A5, typename A6, typename A7>
1034 class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7)> {
1035 public:
1036 MockFunction() {}
1038 MOCK_METHOD8_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7));
1040 #if GTEST_HAS_STD_FUNCTION_
1041 std::function<R(A0, A1, A2, A3, A4, A5, A6, A7)> AsStdFunction() {
1042 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -> R {
1043 return this->Call(a0, a1, a2, a3, a4, a5, a6, a7);
1046 #endif // GTEST_HAS_STD_FUNCTION_
1048 private:
1049 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1052 template <typename R, typename A0, typename A1, typename A2, typename A3,
1053 typename A4, typename A5, typename A6, typename A7, typename A8>
1054 class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> {
1055 public:
1056 MockFunction() {}
1058 MOCK_METHOD9_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8));
1060 #if GTEST_HAS_STD_FUNCTION_
1061 std::function<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> AsStdFunction() {
1062 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7,
1063 A8 a8) -> R {
1064 return this->Call(a0, a1, a2, a3, a4, a5, a6, a7, a8);
1067 #endif // GTEST_HAS_STD_FUNCTION_
1069 private:
1070 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1073 template <typename R, typename A0, typename A1, typename A2, typename A3,
1074 typename A4, typename A5, typename A6, typename A7, typename A8,
1075 typename A9>
1076 class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
1077 public:
1078 MockFunction() {}
1080 MOCK_METHOD10_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9));
1082 #if GTEST_HAS_STD_FUNCTION_
1083 std::function<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> AsStdFunction() {
1084 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7,
1085 A8 a8, A9 a9) -> R {
1086 return this->Call(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
1089 #endif // GTEST_HAS_STD_FUNCTION_
1091 private:
1092 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
1095 } // namespace testing
1097 #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_