blob: 4fa5ca94849f33732cc9b310a9c075e76cd9f106 [file] [log] [blame]
zhanyong.waned6c9272011-02-23 19:39:27 +00001// This file was GENERATED by command:
2// pump.py gmock-generated-function-mockers.h.pump
3// DO NOT EDIT BY HAND!!!
shiqiane35fdd92008-12-10 05:08:54 +00004
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
zhanyong.wan53e08c42010-09-14 05:38:21 +000043#include "gmock/gmock-spec-builders.h"
44#include "gmock/internal/gmock-internal-utils.h"
shiqiane35fdd92008-12-10 05:08:54 +000045
kosak389bad62014-11-17 01:08:51 +000046#if GTEST_HAS_STD_FUNCTION_
47# include <functional>
48#endif
49
shiqiane35fdd92008-12-10 05:08:54 +000050namespace testing {
shiqiane35fdd92008-12-10 05:08:54 +000051namespace internal {
52
53template <typename F>
54class 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.
61template <typename F>
62class FunctionMocker;
63
64template <typename R>
65class 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 this->current_spec();
73 }
74
75 R Invoke() {
zhanyong.wan21a58462009-11-12 19:18:08 +000076 // 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());
shiqiane35fdd92008-12-10 05:08:54 +000081 }
82};
83
84template <typename R, typename A1>
85class 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) {
kosakbd018832014-04-02 20:30:00 +000092 this->current_spec().SetMatchers(::testing::make_tuple(m1));
shiqiane35fdd92008-12-10 05:08:54 +000093 return this->current_spec();
94 }
95
96 R Invoke(A1 a1) {
zhanyong.wan21a58462009-11-12 19:18:08 +000097 // Even though gcc and MSVC don't enforce it, 'this->' is required
98 // by the C++ standard [14.6.4] here, as the base class type is
99 // dependent on the template argument (and thus shouldn't be
100 // looked into when resolving InvokeWith).
101 return this->InvokeWith(ArgumentTuple(a1));
shiqiane35fdd92008-12-10 05:08:54 +0000102 }
103};
104
105template <typename R, typename A1, typename A2>
106class FunctionMocker<R(A1, A2)> : public
107 internal::FunctionMockerBase<R(A1, A2)> {
108 public:
109 typedef R F(A1, A2);
110 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
111
112 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2) {
kosakbd018832014-04-02 20:30:00 +0000113 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2));
shiqiane35fdd92008-12-10 05:08:54 +0000114 return this->current_spec();
115 }
116
117 R Invoke(A1 a1, A2 a2) {
zhanyong.wan21a58462009-11-12 19:18:08 +0000118 // Even though gcc and MSVC don't enforce it, 'this->' is required
119 // by the C++ standard [14.6.4] here, as the base class type is
120 // dependent on the template argument (and thus shouldn't be
121 // looked into when resolving InvokeWith).
122 return this->InvokeWith(ArgumentTuple(a1, a2));
shiqiane35fdd92008-12-10 05:08:54 +0000123 }
124};
125
126template <typename R, typename A1, typename A2, typename A3>
127class FunctionMocker<R(A1, A2, A3)> : public
128 internal::FunctionMockerBase<R(A1, A2, A3)> {
129 public:
130 typedef R F(A1, A2, A3);
131 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
132
133 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
134 const Matcher<A3>& m3) {
kosakbd018832014-04-02 20:30:00 +0000135 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3));
shiqiane35fdd92008-12-10 05:08:54 +0000136 return this->current_spec();
137 }
138
139 R Invoke(A1 a1, A2 a2, A3 a3) {
zhanyong.wan21a58462009-11-12 19:18:08 +0000140 // Even though gcc and MSVC don't enforce it, 'this->' is required
141 // by the C++ standard [14.6.4] here, as the base class type is
142 // dependent on the template argument (and thus shouldn't be
143 // looked into when resolving InvokeWith).
144 return this->InvokeWith(ArgumentTuple(a1, a2, a3));
shiqiane35fdd92008-12-10 05:08:54 +0000145 }
146};
147
148template <typename R, typename A1, typename A2, typename A3, typename A4>
149class FunctionMocker<R(A1, A2, A3, A4)> : public
150 internal::FunctionMockerBase<R(A1, A2, A3, A4)> {
151 public:
152 typedef R F(A1, A2, A3, A4);
153 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
154
155 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
156 const Matcher<A3>& m3, const Matcher<A4>& m4) {
kosakbd018832014-04-02 20:30:00 +0000157 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4));
shiqiane35fdd92008-12-10 05:08:54 +0000158 return this->current_spec();
159 }
160
161 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4) {
zhanyong.wan21a58462009-11-12 19:18:08 +0000162 // Even though gcc and MSVC don't enforce it, 'this->' is required
163 // by the C++ standard [14.6.4] here, as the base class type is
164 // dependent on the template argument (and thus shouldn't be
165 // looked into when resolving InvokeWith).
166 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4));
shiqiane35fdd92008-12-10 05:08:54 +0000167 }
168};
169
170template <typename R, typename A1, typename A2, typename A3, typename A4,
171 typename A5>
172class 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) {
kosakbd018832014-04-02 20:30:00 +0000180 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5));
shiqiane35fdd92008-12-10 05:08:54 +0000181 return this->current_spec();
182 }
183
184 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
zhanyong.wan21a58462009-11-12 19:18:08 +0000185 // Even though gcc and MSVC don't enforce it, 'this->' is required
186 // by the C++ standard [14.6.4] here, as the base class type is
187 // dependent on the template argument (and thus shouldn't be
188 // looked into when resolving InvokeWith).
189 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5));
shiqiane35fdd92008-12-10 05:08:54 +0000190 }
191};
192
193template <typename R, typename A1, typename A2, typename A3, typename A4,
194 typename A5, typename A6>
195class FunctionMocker<R(A1, A2, A3, A4, A5, A6)> : public
196 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6)> {
197 public:
198 typedef R F(A1, A2, A3, A4, A5, A6);
199 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
200
201 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
202 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
203 const Matcher<A6>& m6) {
kosakbd018832014-04-02 20:30:00 +0000204 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5,
shiqiane35fdd92008-12-10 05:08:54 +0000205 m6));
206 return this->current_spec();
207 }
208
209 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) {
zhanyong.wan21a58462009-11-12 19:18:08 +0000210 // Even though gcc and MSVC don't enforce it, 'this->' is required
211 // by the C++ standard [14.6.4] here, as the base class type is
212 // dependent on the template argument (and thus shouldn't be
213 // looked into when resolving InvokeWith).
214 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6));
shiqiane35fdd92008-12-10 05:08:54 +0000215 }
216};
217
218template <typename R, typename A1, typename A2, typename A3, typename A4,
219 typename A5, typename A6, typename A7>
220class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7)> : public
221 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7)> {
222 public:
223 typedef R F(A1, A2, A3, A4, A5, A6, A7);
224 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
225
226 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
227 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
228 const Matcher<A6>& m6, const Matcher<A7>& m7) {
kosakbd018832014-04-02 20:30:00 +0000229 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5,
shiqiane35fdd92008-12-10 05:08:54 +0000230 m6, m7));
231 return this->current_spec();
232 }
233
234 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) {
zhanyong.wan21a58462009-11-12 19:18:08 +0000235 // 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(a1, a2, a3, a4, a5, a6, a7));
shiqiane35fdd92008-12-10 05:08:54 +0000240 }
241};
242
243template <typename R, typename A1, typename A2, typename A3, typename A4,
244 typename A5, typename A6, typename A7, typename A8>
245class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8)> : public
246 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8)> {
247 public:
248 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8);
249 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
250
251 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
252 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
253 const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8) {
kosakbd018832014-04-02 20:30:00 +0000254 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5,
shiqiane35fdd92008-12-10 05:08:54 +0000255 m6, m7, m8));
256 return this->current_spec();
257 }
258
259 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) {
zhanyong.wan21a58462009-11-12 19:18:08 +0000260 // Even though gcc and MSVC don't enforce it, 'this->' is required
261 // by the C++ standard [14.6.4] here, as the base class type is
262 // dependent on the template argument (and thus shouldn't be
263 // looked into when resolving InvokeWith).
264 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8));
shiqiane35fdd92008-12-10 05:08:54 +0000265 }
266};
267
268template <typename R, typename A1, typename A2, typename A3, typename A4,
269 typename A5, typename A6, typename A7, typename A8, typename A9>
270class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> : public
271 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
272 public:
273 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9);
274 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
275
276 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
277 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
278 const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8,
279 const Matcher<A9>& m9) {
kosakbd018832014-04-02 20:30:00 +0000280 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5,
shiqiane35fdd92008-12-10 05:08:54 +0000281 m6, m7, m8, m9));
282 return this->current_spec();
283 }
284
285 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) {
zhanyong.wan21a58462009-11-12 19:18:08 +0000286 // Even though gcc and MSVC don't enforce it, 'this->' is required
287 // by the C++ standard [14.6.4] here, as the base class type is
288 // dependent on the template argument (and thus shouldn't be
289 // looked into when resolving InvokeWith).
290 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8, a9));
shiqiane35fdd92008-12-10 05:08:54 +0000291 }
292};
293
294template <typename R, typename A1, typename A2, typename A3, typename A4,
295 typename A5, typename A6, typename A7, typename A8, typename A9,
296 typename A10>
297class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> : public
298 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> {
299 public:
300 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
301 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
302
303 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
304 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
305 const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8,
306 const Matcher<A9>& m9, const Matcher<A10>& m10) {
kosakbd018832014-04-02 20:30:00 +0000307 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5,
shiqiane35fdd92008-12-10 05:08:54 +0000308 m6, m7, m8, m9, m10));
309 return this->current_spec();
310 }
311
312 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9,
313 A10 a10) {
zhanyong.wan21a58462009-11-12 19:18:08 +0000314 // Even though gcc and MSVC don't enforce it, 'this->' is required
315 // by the C++ standard [14.6.4] here, as the base class type is
316 // dependent on the template argument (and thus shouldn't be
317 // looked into when resolving InvokeWith).
318 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8, a9,
319 a10));
shiqiane35fdd92008-12-10 05:08:54 +0000320 }
321};
322
323} // namespace internal
324
325// The style guide prohibits "using" statements in a namespace scope
326// inside a header file. However, the FunctionMocker class template
327// is meant to be defined in the ::testing namespace. The following
328// line is just a trick for working around a bug in MSVC 8.0, which
329// cannot handle it if we define FunctionMocker in ::testing.
330using internal::FunctionMocker;
331
zhanyong.wan20d1a232013-03-01 06:58:38 +0000332// GMOCK_RESULT_(tn, F) expands to the result type of function type F.
333// We define this as a variadic macro in case F contains unprotected
334// commas (the same reason that we use variadic macros in other places
335// in this file).
shiqiane35fdd92008-12-10 05:08:54 +0000336// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000337#define GMOCK_RESULT_(tn, ...) \
338 tn ::testing::internal::Function<__VA_ARGS__>::Result
shiqiane35fdd92008-12-10 05:08:54 +0000339
zhanyong.wan20d1a232013-03-01 06:58:38 +0000340// The type of argument N of the given function type.
shiqiane35fdd92008-12-10 05:08:54 +0000341// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000342#define GMOCK_ARG_(tn, N, ...) \
343 tn ::testing::internal::Function<__VA_ARGS__>::Argument##N
shiqiane35fdd92008-12-10 05:08:54 +0000344
zhanyong.wan20d1a232013-03-01 06:58:38 +0000345// The matcher type for argument N of the given function type.
shiqiane35fdd92008-12-10 05:08:54 +0000346// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000347#define GMOCK_MATCHER_(tn, N, ...) \
348 const ::testing::Matcher<GMOCK_ARG_(tn, N, __VA_ARGS__)>&
shiqiane35fdd92008-12-10 05:08:54 +0000349
350// The variable for mocking the given method.
351// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan68be1112009-03-25 03:56:48 +0000352#define GMOCK_MOCKER_(arity, constness, Method) \
zhanyong.wanccedc1c2010-08-09 22:46:12 +0000353 GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__)
shiqiane35fdd92008-12-10 05:08:54 +0000354
355// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000356#define GMOCK_METHOD0_(tn, constness, ct, Method, ...) \
357 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
358 ) constness { \
kosakbd018832014-04-02 20:30:00 +0000359 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000360 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
361 == 0), \
shiqiane35fdd92008-12-10 05:08:54 +0000362 this_method_does_not_take_0_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000363 GMOCK_MOCKER_(0, constness, Method).SetOwnerAndName(this, #Method); \
364 return GMOCK_MOCKER_(0, constness, Method).Invoke(); \
shiqiane35fdd92008-12-10 05:08:54 +0000365 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000366 ::testing::MockSpec<__VA_ARGS__>& \
shiqiane35fdd92008-12-10 05:08:54 +0000367 gmock_##Method() constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000368 GMOCK_MOCKER_(0, constness, Method).RegisterOwner(this); \
369 return GMOCK_MOCKER_(0, constness, Method).With(); \
shiqiane35fdd92008-12-10 05:08:54 +0000370 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000371 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(0, constness, \
372 Method)
shiqiane35fdd92008-12-10 05:08:54 +0000373
374// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000375#define GMOCK_METHOD1_(tn, constness, ct, Method, ...) \
376 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
377 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1) constness { \
kosakbd018832014-04-02 20:30:00 +0000378 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000379 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
380 == 1), \
shiqiane35fdd92008-12-10 05:08:54 +0000381 this_method_does_not_take_1_argument); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000382 GMOCK_MOCKER_(1, constness, Method).SetOwnerAndName(this, #Method); \
383 return GMOCK_MOCKER_(1, constness, Method).Invoke(gmock_a1); \
shiqiane35fdd92008-12-10 05:08:54 +0000384 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000385 ::testing::MockSpec<__VA_ARGS__>& \
386 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000387 GMOCK_MOCKER_(1, constness, Method).RegisterOwner(this); \
388 return GMOCK_MOCKER_(1, constness, Method).With(gmock_a1); \
shiqiane35fdd92008-12-10 05:08:54 +0000389 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000390 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(1, constness, \
391 Method)
shiqiane35fdd92008-12-10 05:08:54 +0000392
393// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000394#define GMOCK_METHOD2_(tn, constness, ct, Method, ...) \
395 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
396 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
397 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2) constness { \
kosakbd018832014-04-02 20:30:00 +0000398 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000399 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
400 == 2), \
shiqiane35fdd92008-12-10 05:08:54 +0000401 this_method_does_not_take_2_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000402 GMOCK_MOCKER_(2, constness, Method).SetOwnerAndName(this, #Method); \
403 return GMOCK_MOCKER_(2, constness, Method).Invoke(gmock_a1, gmock_a2); \
shiqiane35fdd92008-12-10 05:08:54 +0000404 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000405 ::testing::MockSpec<__VA_ARGS__>& \
406 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
407 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000408 GMOCK_MOCKER_(2, constness, Method).RegisterOwner(this); \
409 return GMOCK_MOCKER_(2, constness, Method).With(gmock_a1, gmock_a2); \
shiqiane35fdd92008-12-10 05:08:54 +0000410 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000411 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(2, constness, \
412 Method)
shiqiane35fdd92008-12-10 05:08:54 +0000413
414// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000415#define GMOCK_METHOD3_(tn, constness, ct, Method, ...) \
416 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
417 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
418 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
419 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3) constness { \
kosakbd018832014-04-02 20:30:00 +0000420 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000421 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
422 == 3), \
shiqiane35fdd92008-12-10 05:08:54 +0000423 this_method_does_not_take_3_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000424 GMOCK_MOCKER_(3, constness, Method).SetOwnerAndName(this, #Method); \
425 return GMOCK_MOCKER_(3, constness, Method).Invoke(gmock_a1, gmock_a2, \
426 gmock_a3); \
shiqiane35fdd92008-12-10 05:08:54 +0000427 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000428 ::testing::MockSpec<__VA_ARGS__>& \
429 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
430 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
431 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000432 GMOCK_MOCKER_(3, constness, Method).RegisterOwner(this); \
433 return GMOCK_MOCKER_(3, constness, Method).With(gmock_a1, gmock_a2, \
434 gmock_a3); \
shiqiane35fdd92008-12-10 05:08:54 +0000435 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000436 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(3, constness, \
437 Method)
shiqiane35fdd92008-12-10 05:08:54 +0000438
439// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000440#define GMOCK_METHOD4_(tn, constness, ct, Method, ...) \
441 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
442 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
443 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
444 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
445 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4) constness { \
kosakbd018832014-04-02 20:30:00 +0000446 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000447 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
448 == 4), \
shiqiane35fdd92008-12-10 05:08:54 +0000449 this_method_does_not_take_4_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000450 GMOCK_MOCKER_(4, constness, Method).SetOwnerAndName(this, #Method); \
451 return GMOCK_MOCKER_(4, constness, Method).Invoke(gmock_a1, gmock_a2, \
452 gmock_a3, gmock_a4); \
shiqiane35fdd92008-12-10 05:08:54 +0000453 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000454 ::testing::MockSpec<__VA_ARGS__>& \
455 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
456 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
457 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
458 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000459 GMOCK_MOCKER_(4, constness, Method).RegisterOwner(this); \
460 return GMOCK_MOCKER_(4, constness, Method).With(gmock_a1, gmock_a2, \
461 gmock_a3, gmock_a4); \
shiqiane35fdd92008-12-10 05:08:54 +0000462 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000463 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(4, constness, \
464 Method)
shiqiane35fdd92008-12-10 05:08:54 +0000465
466// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000467#define GMOCK_METHOD5_(tn, constness, ct, Method, ...) \
468 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
469 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
470 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
471 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
472 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
473 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5) constness { \
kosakbd018832014-04-02 20:30:00 +0000474 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000475 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
476 == 5), \
shiqiane35fdd92008-12-10 05:08:54 +0000477 this_method_does_not_take_5_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000478 GMOCK_MOCKER_(5, constness, Method).SetOwnerAndName(this, #Method); \
479 return GMOCK_MOCKER_(5, constness, Method).Invoke(gmock_a1, gmock_a2, \
480 gmock_a3, gmock_a4, gmock_a5); \
shiqiane35fdd92008-12-10 05:08:54 +0000481 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000482 ::testing::MockSpec<__VA_ARGS__>& \
483 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
484 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
485 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
486 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
487 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000488 GMOCK_MOCKER_(5, constness, Method).RegisterOwner(this); \
489 return GMOCK_MOCKER_(5, constness, Method).With(gmock_a1, gmock_a2, \
490 gmock_a3, gmock_a4, gmock_a5); \
shiqiane35fdd92008-12-10 05:08:54 +0000491 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000492 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(5, constness, \
493 Method)
shiqiane35fdd92008-12-10 05:08:54 +0000494
495// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000496#define GMOCK_METHOD6_(tn, constness, ct, Method, ...) \
497 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
498 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
499 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
500 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
501 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
502 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
503 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6) constness { \
kosakbd018832014-04-02 20:30:00 +0000504 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000505 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
506 == 6), \
shiqiane35fdd92008-12-10 05:08:54 +0000507 this_method_does_not_take_6_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000508 GMOCK_MOCKER_(6, constness, Method).SetOwnerAndName(this, #Method); \
509 return GMOCK_MOCKER_(6, constness, Method).Invoke(gmock_a1, gmock_a2, \
510 gmock_a3, gmock_a4, gmock_a5, gmock_a6); \
shiqiane35fdd92008-12-10 05:08:54 +0000511 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000512 ::testing::MockSpec<__VA_ARGS__>& \
513 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
514 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
515 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
516 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
517 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
518 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000519 GMOCK_MOCKER_(6, constness, Method).RegisterOwner(this); \
520 return GMOCK_MOCKER_(6, constness, Method).With(gmock_a1, gmock_a2, \
521 gmock_a3, gmock_a4, gmock_a5, gmock_a6); \
shiqiane35fdd92008-12-10 05:08:54 +0000522 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000523 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(6, constness, \
524 Method)
shiqiane35fdd92008-12-10 05:08:54 +0000525
526// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000527#define GMOCK_METHOD7_(tn, constness, ct, Method, ...) \
528 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
529 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
530 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
531 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
532 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
533 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
534 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
535 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7) constness { \
kosakbd018832014-04-02 20:30:00 +0000536 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000537 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
538 == 7), \
shiqiane35fdd92008-12-10 05:08:54 +0000539 this_method_does_not_take_7_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000540 GMOCK_MOCKER_(7, constness, Method).SetOwnerAndName(this, #Method); \
541 return GMOCK_MOCKER_(7, constness, Method).Invoke(gmock_a1, gmock_a2, \
542 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \
shiqiane35fdd92008-12-10 05:08:54 +0000543 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000544 ::testing::MockSpec<__VA_ARGS__>& \
545 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
546 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
547 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
548 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
549 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
550 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
551 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000552 GMOCK_MOCKER_(7, constness, Method).RegisterOwner(this); \
553 return GMOCK_MOCKER_(7, constness, Method).With(gmock_a1, gmock_a2, \
554 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \
shiqiane35fdd92008-12-10 05:08:54 +0000555 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000556 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(7, constness, \
557 Method)
shiqiane35fdd92008-12-10 05:08:54 +0000558
559// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000560#define GMOCK_METHOD8_(tn, constness, ct, Method, ...) \
561 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
562 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
563 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
564 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
565 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
566 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
567 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
568 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
569 GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8) constness { \
kosakbd018832014-04-02 20:30:00 +0000570 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000571 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
572 == 8), \
shiqiane35fdd92008-12-10 05:08:54 +0000573 this_method_does_not_take_8_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000574 GMOCK_MOCKER_(8, constness, Method).SetOwnerAndName(this, #Method); \
575 return GMOCK_MOCKER_(8, constness, Method).Invoke(gmock_a1, gmock_a2, \
576 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \
shiqiane35fdd92008-12-10 05:08:54 +0000577 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000578 ::testing::MockSpec<__VA_ARGS__>& \
579 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
580 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
581 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
582 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
583 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
584 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
585 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
586 GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000587 GMOCK_MOCKER_(8, constness, Method).RegisterOwner(this); \
588 return GMOCK_MOCKER_(8, constness, Method).With(gmock_a1, gmock_a2, \
589 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \
shiqiane35fdd92008-12-10 05:08:54 +0000590 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000591 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(8, constness, \
592 Method)
shiqiane35fdd92008-12-10 05:08:54 +0000593
594// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000595#define GMOCK_METHOD9_(tn, constness, ct, Method, ...) \
596 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
597 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
598 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
599 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
600 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
601 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
602 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
603 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
604 GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8, \
605 GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9) constness { \
kosakbd018832014-04-02 20:30:00 +0000606 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000607 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
608 == 9), \
shiqiane35fdd92008-12-10 05:08:54 +0000609 this_method_does_not_take_9_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000610 GMOCK_MOCKER_(9, constness, Method).SetOwnerAndName(this, #Method); \
611 return GMOCK_MOCKER_(9, constness, Method).Invoke(gmock_a1, gmock_a2, \
612 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \
613 gmock_a9); \
shiqiane35fdd92008-12-10 05:08:54 +0000614 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000615 ::testing::MockSpec<__VA_ARGS__>& \
616 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
617 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
618 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
619 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
620 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
621 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
622 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
623 GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \
624 GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000625 GMOCK_MOCKER_(9, constness, Method).RegisterOwner(this); \
626 return GMOCK_MOCKER_(9, constness, Method).With(gmock_a1, gmock_a2, \
627 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \
628 gmock_a9); \
shiqiane35fdd92008-12-10 05:08:54 +0000629 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000630 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(9, constness, \
631 Method)
shiqiane35fdd92008-12-10 05:08:54 +0000632
633// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000634#define GMOCK_METHOD10_(tn, constness, ct, Method, ...) \
635 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
636 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
637 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
638 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
639 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
640 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
641 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
642 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
643 GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8, \
644 GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9, \
645 GMOCK_ARG_(tn, 10, __VA_ARGS__) gmock_a10) constness { \
kosakbd018832014-04-02 20:30:00 +0000646 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000647 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
648 == 10), \
shiqiane35fdd92008-12-10 05:08:54 +0000649 this_method_does_not_take_10_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000650 GMOCK_MOCKER_(10, constness, Method).SetOwnerAndName(this, #Method); \
651 return GMOCK_MOCKER_(10, constness, Method).Invoke(gmock_a1, gmock_a2, \
652 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \
shiqiane35fdd92008-12-10 05:08:54 +0000653 gmock_a10); \
654 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000655 ::testing::MockSpec<__VA_ARGS__>& \
656 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
657 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
658 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
659 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
660 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
661 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
662 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
663 GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \
664 GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9, \
665 GMOCK_MATCHER_(tn, 10, \
666 __VA_ARGS__) gmock_a10) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000667 GMOCK_MOCKER_(10, constness, Method).RegisterOwner(this); \
668 return GMOCK_MOCKER_(10, constness, Method).With(gmock_a1, gmock_a2, \
669 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \
shiqiane35fdd92008-12-10 05:08:54 +0000670 gmock_a10); \
671 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000672 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(10, constness, \
673 Method)
shiqiane35fdd92008-12-10 05:08:54 +0000674
zhanyong.wan20d1a232013-03-01 06:58:38 +0000675#define MOCK_METHOD0(m, ...) GMOCK_METHOD0_(, , , m, __VA_ARGS__)
676#define MOCK_METHOD1(m, ...) GMOCK_METHOD1_(, , , m, __VA_ARGS__)
677#define MOCK_METHOD2(m, ...) GMOCK_METHOD2_(, , , m, __VA_ARGS__)
678#define MOCK_METHOD3(m, ...) GMOCK_METHOD3_(, , , m, __VA_ARGS__)
679#define MOCK_METHOD4(m, ...) GMOCK_METHOD4_(, , , m, __VA_ARGS__)
680#define MOCK_METHOD5(m, ...) GMOCK_METHOD5_(, , , m, __VA_ARGS__)
681#define MOCK_METHOD6(m, ...) GMOCK_METHOD6_(, , , m, __VA_ARGS__)
682#define MOCK_METHOD7(m, ...) GMOCK_METHOD7_(, , , m, __VA_ARGS__)
683#define MOCK_METHOD8(m, ...) GMOCK_METHOD8_(, , , m, __VA_ARGS__)
684#define MOCK_METHOD9(m, ...) GMOCK_METHOD9_(, , , m, __VA_ARGS__)
685#define MOCK_METHOD10(m, ...) GMOCK_METHOD10_(, , , m, __VA_ARGS__)
shiqiane35fdd92008-12-10 05:08:54 +0000686
zhanyong.wan20d1a232013-03-01 06:58:38 +0000687#define MOCK_CONST_METHOD0(m, ...) GMOCK_METHOD0_(, const, , m, __VA_ARGS__)
688#define MOCK_CONST_METHOD1(m, ...) GMOCK_METHOD1_(, const, , m, __VA_ARGS__)
689#define MOCK_CONST_METHOD2(m, ...) GMOCK_METHOD2_(, const, , m, __VA_ARGS__)
690#define MOCK_CONST_METHOD3(m, ...) GMOCK_METHOD3_(, const, , m, __VA_ARGS__)
691#define MOCK_CONST_METHOD4(m, ...) GMOCK_METHOD4_(, const, , m, __VA_ARGS__)
692#define MOCK_CONST_METHOD5(m, ...) GMOCK_METHOD5_(, const, , m, __VA_ARGS__)
693#define MOCK_CONST_METHOD6(m, ...) GMOCK_METHOD6_(, const, , m, __VA_ARGS__)
694#define MOCK_CONST_METHOD7(m, ...) GMOCK_METHOD7_(, const, , m, __VA_ARGS__)
695#define MOCK_CONST_METHOD8(m, ...) GMOCK_METHOD8_(, const, , m, __VA_ARGS__)
696#define MOCK_CONST_METHOD9(m, ...) GMOCK_METHOD9_(, const, , m, __VA_ARGS__)
697#define MOCK_CONST_METHOD10(m, ...) GMOCK_METHOD10_(, const, , m, __VA_ARGS__)
shiqiane35fdd92008-12-10 05:08:54 +0000698
zhanyong.wan20d1a232013-03-01 06:58:38 +0000699#define MOCK_METHOD0_T(m, ...) GMOCK_METHOD0_(typename, , , m, __VA_ARGS__)
700#define MOCK_METHOD1_T(m, ...) GMOCK_METHOD1_(typename, , , m, __VA_ARGS__)
701#define MOCK_METHOD2_T(m, ...) GMOCK_METHOD2_(typename, , , m, __VA_ARGS__)
702#define MOCK_METHOD3_T(m, ...) GMOCK_METHOD3_(typename, , , m, __VA_ARGS__)
703#define MOCK_METHOD4_T(m, ...) GMOCK_METHOD4_(typename, , , m, __VA_ARGS__)
704#define MOCK_METHOD5_T(m, ...) GMOCK_METHOD5_(typename, , , m, __VA_ARGS__)
705#define MOCK_METHOD6_T(m, ...) GMOCK_METHOD6_(typename, , , m, __VA_ARGS__)
706#define MOCK_METHOD7_T(m, ...) GMOCK_METHOD7_(typename, , , m, __VA_ARGS__)
707#define MOCK_METHOD8_T(m, ...) GMOCK_METHOD8_(typename, , , m, __VA_ARGS__)
708#define MOCK_METHOD9_T(m, ...) GMOCK_METHOD9_(typename, , , m, __VA_ARGS__)
709#define MOCK_METHOD10_T(m, ...) GMOCK_METHOD10_(typename, , , m, __VA_ARGS__)
shiqiane35fdd92008-12-10 05:08:54 +0000710
zhanyong.wan20d1a232013-03-01 06:58:38 +0000711#define MOCK_CONST_METHOD0_T(m, ...) \
712 GMOCK_METHOD0_(typename, const, , m, __VA_ARGS__)
713#define MOCK_CONST_METHOD1_T(m, ...) \
714 GMOCK_METHOD1_(typename, const, , m, __VA_ARGS__)
715#define MOCK_CONST_METHOD2_T(m, ...) \
716 GMOCK_METHOD2_(typename, const, , m, __VA_ARGS__)
717#define MOCK_CONST_METHOD3_T(m, ...) \
718 GMOCK_METHOD3_(typename, const, , m, __VA_ARGS__)
719#define MOCK_CONST_METHOD4_T(m, ...) \
720 GMOCK_METHOD4_(typename, const, , m, __VA_ARGS__)
721#define MOCK_CONST_METHOD5_T(m, ...) \
722 GMOCK_METHOD5_(typename, const, , m, __VA_ARGS__)
723#define MOCK_CONST_METHOD6_T(m, ...) \
724 GMOCK_METHOD6_(typename, const, , m, __VA_ARGS__)
725#define MOCK_CONST_METHOD7_T(m, ...) \
726 GMOCK_METHOD7_(typename, const, , m, __VA_ARGS__)
727#define MOCK_CONST_METHOD8_T(m, ...) \
728 GMOCK_METHOD8_(typename, const, , m, __VA_ARGS__)
729#define MOCK_CONST_METHOD9_T(m, ...) \
730 GMOCK_METHOD9_(typename, const, , m, __VA_ARGS__)
731#define MOCK_CONST_METHOD10_T(m, ...) \
732 GMOCK_METHOD10_(typename, const, , m, __VA_ARGS__)
shiqiane35fdd92008-12-10 05:08:54 +0000733
zhanyong.wan20d1a232013-03-01 06:58:38 +0000734#define MOCK_METHOD0_WITH_CALLTYPE(ct, m, ...) \
735 GMOCK_METHOD0_(, , ct, m, __VA_ARGS__)
736#define MOCK_METHOD1_WITH_CALLTYPE(ct, m, ...) \
737 GMOCK_METHOD1_(, , ct, m, __VA_ARGS__)
738#define MOCK_METHOD2_WITH_CALLTYPE(ct, m, ...) \
739 GMOCK_METHOD2_(, , ct, m, __VA_ARGS__)
740#define MOCK_METHOD3_WITH_CALLTYPE(ct, m, ...) \
741 GMOCK_METHOD3_(, , ct, m, __VA_ARGS__)
742#define MOCK_METHOD4_WITH_CALLTYPE(ct, m, ...) \
743 GMOCK_METHOD4_(, , ct, m, __VA_ARGS__)
744#define MOCK_METHOD5_WITH_CALLTYPE(ct, m, ...) \
745 GMOCK_METHOD5_(, , ct, m, __VA_ARGS__)
746#define MOCK_METHOD6_WITH_CALLTYPE(ct, m, ...) \
747 GMOCK_METHOD6_(, , ct, m, __VA_ARGS__)
748#define MOCK_METHOD7_WITH_CALLTYPE(ct, m, ...) \
749 GMOCK_METHOD7_(, , ct, m, __VA_ARGS__)
750#define MOCK_METHOD8_WITH_CALLTYPE(ct, m, ...) \
751 GMOCK_METHOD8_(, , ct, m, __VA_ARGS__)
752#define MOCK_METHOD9_WITH_CALLTYPE(ct, m, ...) \
753 GMOCK_METHOD9_(, , ct, m, __VA_ARGS__)
754#define MOCK_METHOD10_WITH_CALLTYPE(ct, m, ...) \
755 GMOCK_METHOD10_(, , ct, m, __VA_ARGS__)
shiqiane35fdd92008-12-10 05:08:54 +0000756
zhanyong.wan20d1a232013-03-01 06:58:38 +0000757#define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, ...) \
758 GMOCK_METHOD0_(, const, ct, m, __VA_ARGS__)
759#define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, ...) \
760 GMOCK_METHOD1_(, const, ct, m, __VA_ARGS__)
761#define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, ...) \
762 GMOCK_METHOD2_(, const, ct, m, __VA_ARGS__)
763#define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, ...) \
764 GMOCK_METHOD3_(, const, ct, m, __VA_ARGS__)
765#define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, ...) \
766 GMOCK_METHOD4_(, const, ct, m, __VA_ARGS__)
767#define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, ...) \
768 GMOCK_METHOD5_(, const, ct, m, __VA_ARGS__)
769#define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, ...) \
770 GMOCK_METHOD6_(, const, ct, m, __VA_ARGS__)
771#define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, ...) \
772 GMOCK_METHOD7_(, const, ct, m, __VA_ARGS__)
773#define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, ...) \
774 GMOCK_METHOD8_(, const, ct, m, __VA_ARGS__)
775#define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, ...) \
776 GMOCK_METHOD9_(, const, ct, m, __VA_ARGS__)
777#define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, ...) \
778 GMOCK_METHOD10_(, const, ct, m, __VA_ARGS__)
shiqiane35fdd92008-12-10 05:08:54 +0000779
zhanyong.wan20d1a232013-03-01 06:58:38 +0000780#define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
781 GMOCK_METHOD0_(typename, , ct, m, __VA_ARGS__)
782#define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
783 GMOCK_METHOD1_(typename, , ct, m, __VA_ARGS__)
784#define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
785 GMOCK_METHOD2_(typename, , ct, m, __VA_ARGS__)
786#define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
787 GMOCK_METHOD3_(typename, , ct, m, __VA_ARGS__)
788#define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
789 GMOCK_METHOD4_(typename, , ct, m, __VA_ARGS__)
790#define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
791 GMOCK_METHOD5_(typename, , ct, m, __VA_ARGS__)
792#define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
793 GMOCK_METHOD6_(typename, , ct, m, __VA_ARGS__)
794#define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
795 GMOCK_METHOD7_(typename, , ct, m, __VA_ARGS__)
796#define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
797 GMOCK_METHOD8_(typename, , ct, m, __VA_ARGS__)
798#define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
799 GMOCK_METHOD9_(typename, , ct, m, __VA_ARGS__)
800#define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
801 GMOCK_METHOD10_(typename, , ct, m, __VA_ARGS__)
shiqiane35fdd92008-12-10 05:08:54 +0000802
zhanyong.wan20d1a232013-03-01 06:58:38 +0000803#define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
804 GMOCK_METHOD0_(typename, const, ct, m, __VA_ARGS__)
805#define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
806 GMOCK_METHOD1_(typename, const, ct, m, __VA_ARGS__)
807#define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
808 GMOCK_METHOD2_(typename, const, ct, m, __VA_ARGS__)
809#define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
810 GMOCK_METHOD3_(typename, const, ct, m, __VA_ARGS__)
811#define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
812 GMOCK_METHOD4_(typename, const, ct, m, __VA_ARGS__)
813#define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
814 GMOCK_METHOD5_(typename, const, ct, m, __VA_ARGS__)
815#define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
816 GMOCK_METHOD6_(typename, const, ct, m, __VA_ARGS__)
817#define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
818 GMOCK_METHOD7_(typename, const, ct, m, __VA_ARGS__)
819#define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
820 GMOCK_METHOD8_(typename, const, ct, m, __VA_ARGS__)
821#define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
822 GMOCK_METHOD9_(typename, const, ct, m, __VA_ARGS__)
823#define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
824 GMOCK_METHOD10_(typename, const, ct, m, __VA_ARGS__)
shiqiane35fdd92008-12-10 05:08:54 +0000825
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000826// A MockFunction<F> class has one mock method whose type is F. It is
827// useful when you just want your test code to emit some messages and
828// have Google Mock verify the right messages are sent (and perhaps at
829// the right times). For example, if you are exercising code:
830//
831// Foo(1);
832// Foo(2);
833// Foo(3);
834//
835// and want to verify that Foo(1) and Foo(3) both invoke
836// mock.Bar("a"), but Foo(2) doesn't invoke anything, you can write:
837//
838// TEST(FooTest, InvokesBarCorrectly) {
839// MyMock mock;
840// MockFunction<void(string check_point_name)> check;
841// {
842// InSequence s;
843//
844// EXPECT_CALL(mock, Bar("a"));
845// EXPECT_CALL(check, Call("1"));
846// EXPECT_CALL(check, Call("2"));
847// EXPECT_CALL(mock, Bar("a"));
848// }
849// Foo(1);
850// check.Call("1");
851// Foo(2);
852// check.Call("2");
853// Foo(3);
854// }
855//
856// The expectation spec says that the first Bar("a") must happen
857// before check point "1", the second Bar("a") must happen after check
858// point "2", and nothing should happen between the two check
859// points. The explicit check points make it easy to tell which
860// Bar("a") is called by which call to Foo().
kosaka9e02a92014-06-17 23:19:54 +0000861//
862// MockFunction<F> can also be used to exercise code that accepts
863// std::function<F> callbacks. To do so, use AsStdFunction() method
864// to create std::function proxy forwarding to original object's Call.
865// Example:
866//
867// TEST(FooTest, RunsCallbackWithBarArgument) {
868// MockFunction<int(string)> callback;
869// EXPECT_CALL(callback, Call("bar")).WillOnce(Return(1));
870// Foo(callback.AsStdFunction());
871// }
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000872template <typename F>
873class MockFunction;
874
875template <typename R>
876class MockFunction<R()> {
877 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000878 MockFunction() {}
879
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000880 MOCK_METHOD0_T(Call, R());
zhanyong.wan32de5f52009-12-23 00:13:23 +0000881
kosak5b9cbbb2014-11-17 00:28:55 +0000882#if GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000883 std::function<R()> AsStdFunction() {
kosaka6e32f02015-07-24 20:05:26 +0000884 return [this]() -> R {
kosaka9e02a92014-06-17 23:19:54 +0000885 return this->Call();
886 };
887 }
kosak5b9cbbb2014-11-17 00:28:55 +0000888#endif // GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000889
zhanyong.wan32de5f52009-12-23 00:13:23 +0000890 private:
891 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000892};
893
894template <typename R, typename A0>
895class MockFunction<R(A0)> {
896 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000897 MockFunction() {}
898
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000899 MOCK_METHOD1_T(Call, R(A0));
zhanyong.wan32de5f52009-12-23 00:13:23 +0000900
kosak5b9cbbb2014-11-17 00:28:55 +0000901#if GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000902 std::function<R(A0)> AsStdFunction() {
kosaka6e32f02015-07-24 20:05:26 +0000903 return [this](A0 a0) -> R {
kosaka9e02a92014-06-17 23:19:54 +0000904 return this->Call(a0);
905 };
906 }
kosak5b9cbbb2014-11-17 00:28:55 +0000907#endif // GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000908
zhanyong.wan32de5f52009-12-23 00:13:23 +0000909 private:
910 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000911};
912
913template <typename R, typename A0, typename A1>
914class MockFunction<R(A0, A1)> {
915 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000916 MockFunction() {}
917
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000918 MOCK_METHOD2_T(Call, R(A0, A1));
zhanyong.wan32de5f52009-12-23 00:13:23 +0000919
kosak5b9cbbb2014-11-17 00:28:55 +0000920#if GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000921 std::function<R(A0, A1)> AsStdFunction() {
kosaka6e32f02015-07-24 20:05:26 +0000922 return [this](A0 a0, A1 a1) -> R {
kosaka9e02a92014-06-17 23:19:54 +0000923 return this->Call(a0, a1);
924 };
925 }
kosak5b9cbbb2014-11-17 00:28:55 +0000926#endif // GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000927
zhanyong.wan32de5f52009-12-23 00:13:23 +0000928 private:
929 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000930};
931
932template <typename R, typename A0, typename A1, typename A2>
933class MockFunction<R(A0, A1, A2)> {
934 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000935 MockFunction() {}
936
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000937 MOCK_METHOD3_T(Call, R(A0, A1, A2));
zhanyong.wan32de5f52009-12-23 00:13:23 +0000938
kosak5b9cbbb2014-11-17 00:28:55 +0000939#if GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000940 std::function<R(A0, A1, A2)> AsStdFunction() {
kosaka6e32f02015-07-24 20:05:26 +0000941 return [this](A0 a0, A1 a1, A2 a2) -> R {
kosaka9e02a92014-06-17 23:19:54 +0000942 return this->Call(a0, a1, a2);
943 };
944 }
kosak5b9cbbb2014-11-17 00:28:55 +0000945#endif // GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000946
zhanyong.wan32de5f52009-12-23 00:13:23 +0000947 private:
948 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000949};
950
951template <typename R, typename A0, typename A1, typename A2, typename A3>
952class MockFunction<R(A0, A1, A2, A3)> {
953 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000954 MockFunction() {}
955
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000956 MOCK_METHOD4_T(Call, R(A0, A1, A2, A3));
zhanyong.wan32de5f52009-12-23 00:13:23 +0000957
kosak5b9cbbb2014-11-17 00:28:55 +0000958#if GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000959 std::function<R(A0, A1, A2, A3)> AsStdFunction() {
kosaka6e32f02015-07-24 20:05:26 +0000960 return [this](A0 a0, A1 a1, A2 a2, A3 a3) -> R {
kosaka9e02a92014-06-17 23:19:54 +0000961 return this->Call(a0, a1, a2, a3);
962 };
963 }
kosak5b9cbbb2014-11-17 00:28:55 +0000964#endif // GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000965
zhanyong.wan32de5f52009-12-23 00:13:23 +0000966 private:
967 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000968};
969
970template <typename R, typename A0, typename A1, typename A2, typename A3,
971 typename A4>
972class MockFunction<R(A0, A1, A2, A3, A4)> {
973 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000974 MockFunction() {}
975
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000976 MOCK_METHOD5_T(Call, R(A0, A1, A2, A3, A4));
zhanyong.wan32de5f52009-12-23 00:13:23 +0000977
kosak5b9cbbb2014-11-17 00:28:55 +0000978#if GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000979 std::function<R(A0, A1, A2, A3, A4)> AsStdFunction() {
kosaka6e32f02015-07-24 20:05:26 +0000980 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) -> R {
kosaka9e02a92014-06-17 23:19:54 +0000981 return this->Call(a0, a1, a2, a3, a4);
982 };
983 }
kosak5b9cbbb2014-11-17 00:28:55 +0000984#endif // GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000985
zhanyong.wan32de5f52009-12-23 00:13:23 +0000986 private:
987 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000988};
989
990template <typename R, typename A0, typename A1, typename A2, typename A3,
991 typename A4, typename A5>
992class MockFunction<R(A0, A1, A2, A3, A4, A5)> {
993 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000994 MockFunction() {}
995
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000996 MOCK_METHOD6_T(Call, R(A0, A1, A2, A3, A4, A5));
zhanyong.wan32de5f52009-12-23 00:13:23 +0000997
kosak5b9cbbb2014-11-17 00:28:55 +0000998#if GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000999 std::function<R(A0, A1, A2, A3, A4, A5)> AsStdFunction() {
kosaka6e32f02015-07-24 20:05:26 +00001000 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) -> R {
kosaka9e02a92014-06-17 23:19:54 +00001001 return this->Call(a0, a1, a2, a3, a4, a5);
1002 };
1003 }
kosak5b9cbbb2014-11-17 00:28:55 +00001004#endif // GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +00001005
zhanyong.wan32de5f52009-12-23 00:13:23 +00001006 private:
1007 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +00001008};
1009
1010template <typename R, typename A0, typename A1, typename A2, typename A3,
1011 typename A4, typename A5, typename A6>
1012class MockFunction<R(A0, A1, A2, A3, A4, A5, A6)> {
1013 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +00001014 MockFunction() {}
1015
zhanyong.wanf3aa4d22009-09-25 22:34:47 +00001016 MOCK_METHOD7_T(Call, R(A0, A1, A2, A3, A4, A5, A6));
zhanyong.wan32de5f52009-12-23 00:13:23 +00001017
kosak5b9cbbb2014-11-17 00:28:55 +00001018#if GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +00001019 std::function<R(A0, A1, A2, A3, A4, A5, A6)> AsStdFunction() {
kosaka6e32f02015-07-24 20:05:26 +00001020 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) -> R {
kosaka9e02a92014-06-17 23:19:54 +00001021 return this->Call(a0, a1, a2, a3, a4, a5, a6);
1022 };
1023 }
kosak5b9cbbb2014-11-17 00:28:55 +00001024#endif // GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +00001025
zhanyong.wan32de5f52009-12-23 00:13:23 +00001026 private:
1027 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +00001028};
1029
1030template <typename R, typename A0, typename A1, typename A2, typename A3,
1031 typename A4, typename A5, typename A6, typename A7>
1032class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7)> {
1033 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +00001034 MockFunction() {}
1035
zhanyong.wanf3aa4d22009-09-25 22:34:47 +00001036 MOCK_METHOD8_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7));
zhanyong.wan32de5f52009-12-23 00:13:23 +00001037
kosak5b9cbbb2014-11-17 00:28:55 +00001038#if GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +00001039 std::function<R(A0, A1, A2, A3, A4, A5, A6, A7)> AsStdFunction() {
kosaka6e32f02015-07-24 20:05:26 +00001040 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) -> R {
kosaka9e02a92014-06-17 23:19:54 +00001041 return this->Call(a0, a1, a2, a3, a4, a5, a6, a7);
1042 };
1043 }
kosak5b9cbbb2014-11-17 00:28:55 +00001044#endif // GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +00001045
zhanyong.wan32de5f52009-12-23 00:13:23 +00001046 private:
1047 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +00001048};
1049
1050template <typename R, typename A0, typename A1, typename A2, typename A3,
1051 typename A4, typename A5, typename A6, typename A7, typename A8>
1052class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> {
1053 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +00001054 MockFunction() {}
1055
zhanyong.wanf3aa4d22009-09-25 22:34:47 +00001056 MOCK_METHOD9_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8));
zhanyong.wan32de5f52009-12-23 00:13:23 +00001057
kosak5b9cbbb2014-11-17 00:28:55 +00001058#if GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +00001059 std::function<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> AsStdFunction() {
1060 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7,
kosaka6e32f02015-07-24 20:05:26 +00001061 A8 a8) -> R {
kosaka9e02a92014-06-17 23:19:54 +00001062 return this->Call(a0, a1, a2, a3, a4, a5, a6, a7, a8);
1063 };
1064 }
kosak5b9cbbb2014-11-17 00:28:55 +00001065#endif // GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +00001066
zhanyong.wan32de5f52009-12-23 00:13:23 +00001067 private:
1068 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +00001069};
1070
1071template <typename R, typename A0, typename A1, typename A2, typename A3,
1072 typename A4, typename A5, typename A6, typename A7, typename A8,
1073 typename A9>
1074class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
1075 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +00001076 MockFunction() {}
1077
zhanyong.wanf3aa4d22009-09-25 22:34:47 +00001078 MOCK_METHOD10_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9));
zhanyong.wan32de5f52009-12-23 00:13:23 +00001079
kosak5b9cbbb2014-11-17 00:28:55 +00001080#if GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +00001081 std::function<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> AsStdFunction() {
1082 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7,
kosaka6e32f02015-07-24 20:05:26 +00001083 A8 a8, A9 a9) -> R {
kosaka9e02a92014-06-17 23:19:54 +00001084 return this->Call(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
1085 };
1086 }
kosak5b9cbbb2014-11-17 00:28:55 +00001087#endif // GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +00001088
zhanyong.wan32de5f52009-12-23 00:13:23 +00001089 private:
1090 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +00001091};
1092
shiqiane35fdd92008-12-10 05:08:54 +00001093} // namespace testing
1094
1095#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_