blob: ce7341d42e60ebd6555b8d2f4d98fac76c922f51 [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
46namespace testing {
shiqiane35fdd92008-12-10 05:08:54 +000047namespace internal {
48
49template <typename F>
50class FunctionMockerBase;
51
52// Note: class FunctionMocker really belongs to the ::testing
53// namespace. However if we define it in ::testing, MSVC will
54// complain when classes in ::testing::internal declare it as a
55// friend class template. To workaround this compiler bug, we define
56// FunctionMocker in ::testing::internal and import it into ::testing.
57template <typename F>
58class FunctionMocker;
59
60template <typename R>
61class FunctionMocker<R()> : public
62 internal::FunctionMockerBase<R()> {
63 public:
64 typedef R F();
65 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
66
67 MockSpec<F>& With() {
68 return this->current_spec();
69 }
70
71 R Invoke() {
zhanyong.wan21a58462009-11-12 19:18:08 +000072 // Even though gcc and MSVC don't enforce it, 'this->' is required
73 // by the C++ standard [14.6.4] here, as the base class type is
74 // dependent on the template argument (and thus shouldn't be
75 // looked into when resolving InvokeWith).
76 return this->InvokeWith(ArgumentTuple());
shiqiane35fdd92008-12-10 05:08:54 +000077 }
78};
79
80template <typename R, typename A1>
81class FunctionMocker<R(A1)> : public
82 internal::FunctionMockerBase<R(A1)> {
83 public:
84 typedef R F(A1);
85 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
86
87 MockSpec<F>& With(const Matcher<A1>& m1) {
kosakbd018832014-04-02 20:30:00 +000088 this->current_spec().SetMatchers(::testing::make_tuple(m1));
shiqiane35fdd92008-12-10 05:08:54 +000089 return this->current_spec();
90 }
91
92 R Invoke(A1 a1) {
zhanyong.wan21a58462009-11-12 19:18:08 +000093 // Even though gcc and MSVC don't enforce it, 'this->' is required
94 // by the C++ standard [14.6.4] here, as the base class type is
95 // dependent on the template argument (and thus shouldn't be
96 // looked into when resolving InvokeWith).
97 return this->InvokeWith(ArgumentTuple(a1));
shiqiane35fdd92008-12-10 05:08:54 +000098 }
99};
100
101template <typename R, typename A1, typename A2>
102class FunctionMocker<R(A1, A2)> : public
103 internal::FunctionMockerBase<R(A1, A2)> {
104 public:
105 typedef R F(A1, A2);
106 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
107
108 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2) {
kosakbd018832014-04-02 20:30:00 +0000109 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2));
shiqiane35fdd92008-12-10 05:08:54 +0000110 return this->current_spec();
111 }
112
113 R Invoke(A1 a1, A2 a2) {
zhanyong.wan21a58462009-11-12 19:18:08 +0000114 // Even though gcc and MSVC don't enforce it, 'this->' is required
115 // by the C++ standard [14.6.4] here, as the base class type is
116 // dependent on the template argument (and thus shouldn't be
117 // looked into when resolving InvokeWith).
118 return this->InvokeWith(ArgumentTuple(a1, a2));
shiqiane35fdd92008-12-10 05:08:54 +0000119 }
120};
121
122template <typename R, typename A1, typename A2, typename A3>
123class FunctionMocker<R(A1, A2, A3)> : public
124 internal::FunctionMockerBase<R(A1, A2, A3)> {
125 public:
126 typedef R F(A1, A2, A3);
127 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
128
129 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
130 const Matcher<A3>& m3) {
kosakbd018832014-04-02 20:30:00 +0000131 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3));
shiqiane35fdd92008-12-10 05:08:54 +0000132 return this->current_spec();
133 }
134
135 R Invoke(A1 a1, A2 a2, A3 a3) {
zhanyong.wan21a58462009-11-12 19:18:08 +0000136 // Even though gcc and MSVC don't enforce it, 'this->' is required
137 // by the C++ standard [14.6.4] here, as the base class type is
138 // dependent on the template argument (and thus shouldn't be
139 // looked into when resolving InvokeWith).
140 return this->InvokeWith(ArgumentTuple(a1, a2, a3));
shiqiane35fdd92008-12-10 05:08:54 +0000141 }
142};
143
144template <typename R, typename A1, typename A2, typename A3, typename A4>
145class FunctionMocker<R(A1, A2, A3, A4)> : public
146 internal::FunctionMockerBase<R(A1, A2, A3, A4)> {
147 public:
148 typedef R F(A1, A2, A3, A4);
149 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
150
151 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
152 const Matcher<A3>& m3, const Matcher<A4>& m4) {
kosakbd018832014-04-02 20:30:00 +0000153 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4));
shiqiane35fdd92008-12-10 05:08:54 +0000154 return this->current_spec();
155 }
156
157 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4) {
zhanyong.wan21a58462009-11-12 19:18:08 +0000158 // Even though gcc and MSVC don't enforce it, 'this->' is required
159 // by the C++ standard [14.6.4] here, as the base class type is
160 // dependent on the template argument (and thus shouldn't be
161 // looked into when resolving InvokeWith).
162 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4));
shiqiane35fdd92008-12-10 05:08:54 +0000163 }
164};
165
166template <typename R, typename A1, typename A2, typename A3, typename A4,
167 typename A5>
168class FunctionMocker<R(A1, A2, A3, A4, A5)> : public
169 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5)> {
170 public:
171 typedef R F(A1, A2, A3, A4, A5);
172 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
173
174 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
175 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5) {
kosakbd018832014-04-02 20:30:00 +0000176 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5));
shiqiane35fdd92008-12-10 05:08:54 +0000177 return this->current_spec();
178 }
179
180 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
zhanyong.wan21a58462009-11-12 19:18:08 +0000181 // Even though gcc and MSVC don't enforce it, 'this->' is required
182 // by the C++ standard [14.6.4] here, as the base class type is
183 // dependent on the template argument (and thus shouldn't be
184 // looked into when resolving InvokeWith).
185 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5));
shiqiane35fdd92008-12-10 05:08:54 +0000186 }
187};
188
189template <typename R, typename A1, typename A2, typename A3, typename A4,
190 typename A5, typename A6>
191class FunctionMocker<R(A1, A2, A3, A4, A5, A6)> : public
192 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6)> {
193 public:
194 typedef R F(A1, A2, A3, A4, A5, A6);
195 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
196
197 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
198 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
199 const Matcher<A6>& m6) {
kosakbd018832014-04-02 20:30:00 +0000200 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5,
shiqiane35fdd92008-12-10 05:08:54 +0000201 m6));
202 return this->current_spec();
203 }
204
205 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) {
zhanyong.wan21a58462009-11-12 19:18:08 +0000206 // Even though gcc and MSVC don't enforce it, 'this->' is required
207 // by the C++ standard [14.6.4] here, as the base class type is
208 // dependent on the template argument (and thus shouldn't be
209 // looked into when resolving InvokeWith).
210 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6));
shiqiane35fdd92008-12-10 05:08:54 +0000211 }
212};
213
214template <typename R, typename A1, typename A2, typename A3, typename A4,
215 typename A5, typename A6, typename A7>
216class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7)> : public
217 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7)> {
218 public:
219 typedef R F(A1, A2, A3, A4, A5, A6, A7);
220 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
221
222 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
223 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
224 const Matcher<A6>& m6, const Matcher<A7>& m7) {
kosakbd018832014-04-02 20:30:00 +0000225 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5,
shiqiane35fdd92008-12-10 05:08:54 +0000226 m6, m7));
227 return this->current_spec();
228 }
229
230 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) {
zhanyong.wan21a58462009-11-12 19:18:08 +0000231 // Even though gcc and MSVC don't enforce it, 'this->' is required
232 // by the C++ standard [14.6.4] here, as the base class type is
233 // dependent on the template argument (and thus shouldn't be
234 // looked into when resolving InvokeWith).
235 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7));
shiqiane35fdd92008-12-10 05:08:54 +0000236 }
237};
238
239template <typename R, typename A1, typename A2, typename A3, typename A4,
240 typename A5, typename A6, typename A7, typename A8>
241class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8)> : public
242 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8)> {
243 public:
244 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8);
245 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
246
247 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
248 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
249 const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8) {
kosakbd018832014-04-02 20:30:00 +0000250 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5,
shiqiane35fdd92008-12-10 05:08:54 +0000251 m6, m7, m8));
252 return this->current_spec();
253 }
254
255 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 +0000256 // Even though gcc and MSVC don't enforce it, 'this->' is required
257 // by the C++ standard [14.6.4] here, as the base class type is
258 // dependent on the template argument (and thus shouldn't be
259 // looked into when resolving InvokeWith).
260 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8));
shiqiane35fdd92008-12-10 05:08:54 +0000261 }
262};
263
264template <typename R, typename A1, typename A2, typename A3, typename A4,
265 typename A5, typename A6, typename A7, typename A8, typename A9>
266class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> : public
267 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
268 public:
269 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9);
270 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
271
272 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
273 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
274 const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8,
275 const Matcher<A9>& m9) {
kosakbd018832014-04-02 20:30:00 +0000276 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5,
shiqiane35fdd92008-12-10 05:08:54 +0000277 m6, m7, m8, m9));
278 return this->current_spec();
279 }
280
281 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 +0000282 // Even though gcc and MSVC don't enforce it, 'this->' is required
283 // by the C++ standard [14.6.4] here, as the base class type is
284 // dependent on the template argument (and thus shouldn't be
285 // looked into when resolving InvokeWith).
286 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8, a9));
shiqiane35fdd92008-12-10 05:08:54 +0000287 }
288};
289
290template <typename R, typename A1, typename A2, typename A3, typename A4,
291 typename A5, typename A6, typename A7, typename A8, typename A9,
292 typename A10>
293class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> : public
294 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> {
295 public:
296 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
297 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
298
299 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
300 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
301 const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8,
302 const Matcher<A9>& m9, const Matcher<A10>& m10) {
kosakbd018832014-04-02 20:30:00 +0000303 this->current_spec().SetMatchers(::testing::make_tuple(m1, m2, m3, m4, m5,
shiqiane35fdd92008-12-10 05:08:54 +0000304 m6, m7, m8, m9, m10));
305 return this->current_spec();
306 }
307
308 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9,
309 A10 a10) {
zhanyong.wan21a58462009-11-12 19:18:08 +0000310 // Even though gcc and MSVC don't enforce it, 'this->' is required
311 // by the C++ standard [14.6.4] here, as the base class type is
312 // dependent on the template argument (and thus shouldn't be
313 // looked into when resolving InvokeWith).
314 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8, a9,
315 a10));
shiqiane35fdd92008-12-10 05:08:54 +0000316 }
317};
318
319} // namespace internal
320
321// The style guide prohibits "using" statements in a namespace scope
322// inside a header file. However, the FunctionMocker class template
323// is meant to be defined in the ::testing namespace. The following
324// line is just a trick for working around a bug in MSVC 8.0, which
325// cannot handle it if we define FunctionMocker in ::testing.
326using internal::FunctionMocker;
327
zhanyong.wan20d1a232013-03-01 06:58:38 +0000328// GMOCK_RESULT_(tn, F) expands to the result type of function type F.
329// We define this as a variadic macro in case F contains unprotected
330// commas (the same reason that we use variadic macros in other places
331// in this file).
shiqiane35fdd92008-12-10 05:08:54 +0000332// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000333#define GMOCK_RESULT_(tn, ...) \
334 tn ::testing::internal::Function<__VA_ARGS__>::Result
shiqiane35fdd92008-12-10 05:08:54 +0000335
zhanyong.wan20d1a232013-03-01 06:58:38 +0000336// The type of argument N of the given function type.
shiqiane35fdd92008-12-10 05:08:54 +0000337// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000338#define GMOCK_ARG_(tn, N, ...) \
339 tn ::testing::internal::Function<__VA_ARGS__>::Argument##N
shiqiane35fdd92008-12-10 05:08:54 +0000340
zhanyong.wan20d1a232013-03-01 06:58:38 +0000341// The matcher type for argument N of the given function type.
shiqiane35fdd92008-12-10 05:08:54 +0000342// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000343#define GMOCK_MATCHER_(tn, N, ...) \
344 const ::testing::Matcher<GMOCK_ARG_(tn, N, __VA_ARGS__)>&
shiqiane35fdd92008-12-10 05:08:54 +0000345
346// The variable for mocking the given method.
347// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan68be1112009-03-25 03:56:48 +0000348#define GMOCK_MOCKER_(arity, constness, Method) \
zhanyong.wanccedc1c2010-08-09 22:46:12 +0000349 GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__)
shiqiane35fdd92008-12-10 05:08:54 +0000350
351// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000352#define GMOCK_METHOD0_(tn, constness, ct, Method, ...) \
353 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
354 ) constness { \
kosakbd018832014-04-02 20:30:00 +0000355 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000356 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
357 == 0), \
shiqiane35fdd92008-12-10 05:08:54 +0000358 this_method_does_not_take_0_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000359 GMOCK_MOCKER_(0, constness, Method).SetOwnerAndName(this, #Method); \
360 return GMOCK_MOCKER_(0, constness, Method).Invoke(); \
shiqiane35fdd92008-12-10 05:08:54 +0000361 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000362 ::testing::MockSpec<__VA_ARGS__>& \
shiqiane35fdd92008-12-10 05:08:54 +0000363 gmock_##Method() constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000364 GMOCK_MOCKER_(0, constness, Method).RegisterOwner(this); \
365 return GMOCK_MOCKER_(0, constness, Method).With(); \
shiqiane35fdd92008-12-10 05:08:54 +0000366 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000367 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(0, constness, \
368 Method)
shiqiane35fdd92008-12-10 05:08:54 +0000369
370// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000371#define GMOCK_METHOD1_(tn, constness, ct, Method, ...) \
372 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
373 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1) constness { \
kosakbd018832014-04-02 20:30:00 +0000374 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000375 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
376 == 1), \
shiqiane35fdd92008-12-10 05:08:54 +0000377 this_method_does_not_take_1_argument); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000378 GMOCK_MOCKER_(1, constness, Method).SetOwnerAndName(this, #Method); \
379 return GMOCK_MOCKER_(1, constness, Method).Invoke(gmock_a1); \
shiqiane35fdd92008-12-10 05:08:54 +0000380 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000381 ::testing::MockSpec<__VA_ARGS__>& \
382 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000383 GMOCK_MOCKER_(1, constness, Method).RegisterOwner(this); \
384 return GMOCK_MOCKER_(1, constness, Method).With(gmock_a1); \
shiqiane35fdd92008-12-10 05:08:54 +0000385 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000386 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(1, constness, \
387 Method)
shiqiane35fdd92008-12-10 05:08:54 +0000388
389// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000390#define GMOCK_METHOD2_(tn, constness, ct, Method, ...) \
391 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
392 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
393 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2) constness { \
kosakbd018832014-04-02 20:30:00 +0000394 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000395 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
396 == 2), \
shiqiane35fdd92008-12-10 05:08:54 +0000397 this_method_does_not_take_2_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000398 GMOCK_MOCKER_(2, constness, Method).SetOwnerAndName(this, #Method); \
399 return GMOCK_MOCKER_(2, constness, Method).Invoke(gmock_a1, gmock_a2); \
shiqiane35fdd92008-12-10 05:08:54 +0000400 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000401 ::testing::MockSpec<__VA_ARGS__>& \
402 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
403 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000404 GMOCK_MOCKER_(2, constness, Method).RegisterOwner(this); \
405 return GMOCK_MOCKER_(2, constness, Method).With(gmock_a1, gmock_a2); \
shiqiane35fdd92008-12-10 05:08:54 +0000406 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000407 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(2, constness, \
408 Method)
shiqiane35fdd92008-12-10 05:08:54 +0000409
410// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000411#define GMOCK_METHOD3_(tn, constness, ct, Method, ...) \
412 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
413 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
414 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
415 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3) constness { \
kosakbd018832014-04-02 20:30:00 +0000416 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000417 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
418 == 3), \
shiqiane35fdd92008-12-10 05:08:54 +0000419 this_method_does_not_take_3_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000420 GMOCK_MOCKER_(3, constness, Method).SetOwnerAndName(this, #Method); \
421 return GMOCK_MOCKER_(3, constness, Method).Invoke(gmock_a1, gmock_a2, \
422 gmock_a3); \
shiqiane35fdd92008-12-10 05:08:54 +0000423 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000424 ::testing::MockSpec<__VA_ARGS__>& \
425 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
426 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
427 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000428 GMOCK_MOCKER_(3, constness, Method).RegisterOwner(this); \
429 return GMOCK_MOCKER_(3, constness, Method).With(gmock_a1, gmock_a2, \
430 gmock_a3); \
shiqiane35fdd92008-12-10 05:08:54 +0000431 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000432 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(3, constness, \
433 Method)
shiqiane35fdd92008-12-10 05:08:54 +0000434
435// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000436#define GMOCK_METHOD4_(tn, constness, ct, Method, ...) \
437 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
438 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
439 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
440 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
441 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4) constness { \
kosakbd018832014-04-02 20:30:00 +0000442 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000443 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
444 == 4), \
shiqiane35fdd92008-12-10 05:08:54 +0000445 this_method_does_not_take_4_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000446 GMOCK_MOCKER_(4, constness, Method).SetOwnerAndName(this, #Method); \
447 return GMOCK_MOCKER_(4, constness, Method).Invoke(gmock_a1, gmock_a2, \
448 gmock_a3, gmock_a4); \
shiqiane35fdd92008-12-10 05:08:54 +0000449 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000450 ::testing::MockSpec<__VA_ARGS__>& \
451 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
452 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
453 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
454 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000455 GMOCK_MOCKER_(4, constness, Method).RegisterOwner(this); \
456 return GMOCK_MOCKER_(4, constness, Method).With(gmock_a1, gmock_a2, \
457 gmock_a3, gmock_a4); \
shiqiane35fdd92008-12-10 05:08:54 +0000458 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000459 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(4, constness, \
460 Method)
shiqiane35fdd92008-12-10 05:08:54 +0000461
462// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000463#define GMOCK_METHOD5_(tn, constness, ct, Method, ...) \
464 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
465 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
466 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
467 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
468 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
469 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5) constness { \
kosakbd018832014-04-02 20:30:00 +0000470 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000471 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
472 == 5), \
shiqiane35fdd92008-12-10 05:08:54 +0000473 this_method_does_not_take_5_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000474 GMOCK_MOCKER_(5, constness, Method).SetOwnerAndName(this, #Method); \
475 return GMOCK_MOCKER_(5, constness, Method).Invoke(gmock_a1, gmock_a2, \
476 gmock_a3, gmock_a4, gmock_a5); \
shiqiane35fdd92008-12-10 05:08:54 +0000477 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000478 ::testing::MockSpec<__VA_ARGS__>& \
479 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
480 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
481 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
482 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
483 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000484 GMOCK_MOCKER_(5, constness, Method).RegisterOwner(this); \
485 return GMOCK_MOCKER_(5, constness, Method).With(gmock_a1, gmock_a2, \
486 gmock_a3, gmock_a4, gmock_a5); \
shiqiane35fdd92008-12-10 05:08:54 +0000487 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000488 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(5, constness, \
489 Method)
shiqiane35fdd92008-12-10 05:08:54 +0000490
491// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000492#define GMOCK_METHOD6_(tn, constness, ct, Method, ...) \
493 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
494 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
495 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
496 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
497 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
498 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
499 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6) constness { \
kosakbd018832014-04-02 20:30:00 +0000500 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000501 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
502 == 6), \
shiqiane35fdd92008-12-10 05:08:54 +0000503 this_method_does_not_take_6_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000504 GMOCK_MOCKER_(6, constness, Method).SetOwnerAndName(this, #Method); \
505 return GMOCK_MOCKER_(6, constness, Method).Invoke(gmock_a1, gmock_a2, \
506 gmock_a3, gmock_a4, gmock_a5, gmock_a6); \
shiqiane35fdd92008-12-10 05:08:54 +0000507 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000508 ::testing::MockSpec<__VA_ARGS__>& \
509 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
510 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
511 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
512 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
513 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
514 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000515 GMOCK_MOCKER_(6, constness, Method).RegisterOwner(this); \
516 return GMOCK_MOCKER_(6, constness, Method).With(gmock_a1, gmock_a2, \
517 gmock_a3, gmock_a4, gmock_a5, gmock_a6); \
shiqiane35fdd92008-12-10 05:08:54 +0000518 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000519 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(6, constness, \
520 Method)
shiqiane35fdd92008-12-10 05:08:54 +0000521
522// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000523#define GMOCK_METHOD7_(tn, constness, ct, Method, ...) \
524 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
525 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
526 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
527 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
528 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
529 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
530 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
531 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7) constness { \
kosakbd018832014-04-02 20:30:00 +0000532 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000533 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
534 == 7), \
shiqiane35fdd92008-12-10 05:08:54 +0000535 this_method_does_not_take_7_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000536 GMOCK_MOCKER_(7, constness, Method).SetOwnerAndName(this, #Method); \
537 return GMOCK_MOCKER_(7, constness, Method).Invoke(gmock_a1, gmock_a2, \
538 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \
shiqiane35fdd92008-12-10 05:08:54 +0000539 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000540 ::testing::MockSpec<__VA_ARGS__>& \
541 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
542 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
543 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
544 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
545 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
546 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
547 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000548 GMOCK_MOCKER_(7, constness, Method).RegisterOwner(this); \
549 return GMOCK_MOCKER_(7, constness, Method).With(gmock_a1, gmock_a2, \
550 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \
shiqiane35fdd92008-12-10 05:08:54 +0000551 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000552 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(7, constness, \
553 Method)
shiqiane35fdd92008-12-10 05:08:54 +0000554
555// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000556#define GMOCK_METHOD8_(tn, constness, ct, Method, ...) \
557 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
558 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
559 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
560 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
561 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
562 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
563 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
564 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
565 GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8) constness { \
kosakbd018832014-04-02 20:30:00 +0000566 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000567 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
568 == 8), \
shiqiane35fdd92008-12-10 05:08:54 +0000569 this_method_does_not_take_8_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000570 GMOCK_MOCKER_(8, constness, Method).SetOwnerAndName(this, #Method); \
571 return GMOCK_MOCKER_(8, constness, Method).Invoke(gmock_a1, gmock_a2, \
572 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \
shiqiane35fdd92008-12-10 05:08:54 +0000573 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000574 ::testing::MockSpec<__VA_ARGS__>& \
575 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
576 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
577 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
578 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
579 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
580 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
581 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
582 GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000583 GMOCK_MOCKER_(8, constness, Method).RegisterOwner(this); \
584 return GMOCK_MOCKER_(8, constness, Method).With(gmock_a1, gmock_a2, \
585 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \
shiqiane35fdd92008-12-10 05:08:54 +0000586 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000587 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(8, constness, \
588 Method)
shiqiane35fdd92008-12-10 05:08:54 +0000589
590// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000591#define GMOCK_METHOD9_(tn, constness, ct, Method, ...) \
592 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
593 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
594 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
595 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
596 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
597 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
598 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
599 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
600 GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8, \
601 GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9) constness { \
kosakbd018832014-04-02 20:30:00 +0000602 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000603 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
604 == 9), \
shiqiane35fdd92008-12-10 05:08:54 +0000605 this_method_does_not_take_9_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000606 GMOCK_MOCKER_(9, constness, Method).SetOwnerAndName(this, #Method); \
607 return GMOCK_MOCKER_(9, constness, Method).Invoke(gmock_a1, gmock_a2, \
608 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \
609 gmock_a9); \
shiqiane35fdd92008-12-10 05:08:54 +0000610 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000611 ::testing::MockSpec<__VA_ARGS__>& \
612 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
613 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
614 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
615 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
616 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
617 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
618 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
619 GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \
620 GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000621 GMOCK_MOCKER_(9, constness, Method).RegisterOwner(this); \
622 return GMOCK_MOCKER_(9, constness, Method).With(gmock_a1, gmock_a2, \
623 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \
624 gmock_a9); \
shiqiane35fdd92008-12-10 05:08:54 +0000625 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000626 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(9, constness, \
627 Method)
shiqiane35fdd92008-12-10 05:08:54 +0000628
629// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan20d1a232013-03-01 06:58:38 +0000630#define GMOCK_METHOD10_(tn, constness, ct, Method, ...) \
631 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
632 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
633 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
634 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
635 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
636 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
637 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
638 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
639 GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8, \
640 GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9, \
641 GMOCK_ARG_(tn, 10, __VA_ARGS__) gmock_a10) constness { \
kosakbd018832014-04-02 20:30:00 +0000642 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000643 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
644 == 10), \
shiqiane35fdd92008-12-10 05:08:54 +0000645 this_method_does_not_take_10_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000646 GMOCK_MOCKER_(10, constness, Method).SetOwnerAndName(this, #Method); \
647 return GMOCK_MOCKER_(10, constness, Method).Invoke(gmock_a1, gmock_a2, \
648 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \
shiqiane35fdd92008-12-10 05:08:54 +0000649 gmock_a10); \
650 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000651 ::testing::MockSpec<__VA_ARGS__>& \
652 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
653 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
654 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
655 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
656 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
657 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
658 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
659 GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \
660 GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9, \
661 GMOCK_MATCHER_(tn, 10, \
662 __VA_ARGS__) gmock_a10) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000663 GMOCK_MOCKER_(10, constness, Method).RegisterOwner(this); \
664 return GMOCK_MOCKER_(10, constness, Method).With(gmock_a1, gmock_a2, \
665 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \
shiqiane35fdd92008-12-10 05:08:54 +0000666 gmock_a10); \
667 } \
zhanyong.wan20d1a232013-03-01 06:58:38 +0000668 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(10, constness, \
669 Method)
shiqiane35fdd92008-12-10 05:08:54 +0000670
zhanyong.wan20d1a232013-03-01 06:58:38 +0000671#define MOCK_METHOD0(m, ...) GMOCK_METHOD0_(, , , m, __VA_ARGS__)
672#define MOCK_METHOD1(m, ...) GMOCK_METHOD1_(, , , m, __VA_ARGS__)
673#define MOCK_METHOD2(m, ...) GMOCK_METHOD2_(, , , m, __VA_ARGS__)
674#define MOCK_METHOD3(m, ...) GMOCK_METHOD3_(, , , m, __VA_ARGS__)
675#define MOCK_METHOD4(m, ...) GMOCK_METHOD4_(, , , m, __VA_ARGS__)
676#define MOCK_METHOD5(m, ...) GMOCK_METHOD5_(, , , m, __VA_ARGS__)
677#define MOCK_METHOD6(m, ...) GMOCK_METHOD6_(, , , m, __VA_ARGS__)
678#define MOCK_METHOD7(m, ...) GMOCK_METHOD7_(, , , m, __VA_ARGS__)
679#define MOCK_METHOD8(m, ...) GMOCK_METHOD8_(, , , m, __VA_ARGS__)
680#define MOCK_METHOD9(m, ...) GMOCK_METHOD9_(, , , m, __VA_ARGS__)
681#define MOCK_METHOD10(m, ...) GMOCK_METHOD10_(, , , m, __VA_ARGS__)
shiqiane35fdd92008-12-10 05:08:54 +0000682
zhanyong.wan20d1a232013-03-01 06:58:38 +0000683#define MOCK_CONST_METHOD0(m, ...) GMOCK_METHOD0_(, const, , m, __VA_ARGS__)
684#define MOCK_CONST_METHOD1(m, ...) GMOCK_METHOD1_(, const, , m, __VA_ARGS__)
685#define MOCK_CONST_METHOD2(m, ...) GMOCK_METHOD2_(, const, , m, __VA_ARGS__)
686#define MOCK_CONST_METHOD3(m, ...) GMOCK_METHOD3_(, const, , m, __VA_ARGS__)
687#define MOCK_CONST_METHOD4(m, ...) GMOCK_METHOD4_(, const, , m, __VA_ARGS__)
688#define MOCK_CONST_METHOD5(m, ...) GMOCK_METHOD5_(, const, , m, __VA_ARGS__)
689#define MOCK_CONST_METHOD6(m, ...) GMOCK_METHOD6_(, const, , m, __VA_ARGS__)
690#define MOCK_CONST_METHOD7(m, ...) GMOCK_METHOD7_(, const, , m, __VA_ARGS__)
691#define MOCK_CONST_METHOD8(m, ...) GMOCK_METHOD8_(, const, , m, __VA_ARGS__)
692#define MOCK_CONST_METHOD9(m, ...) GMOCK_METHOD9_(, const, , m, __VA_ARGS__)
693#define MOCK_CONST_METHOD10(m, ...) GMOCK_METHOD10_(, const, , m, __VA_ARGS__)
shiqiane35fdd92008-12-10 05:08:54 +0000694
zhanyong.wan20d1a232013-03-01 06:58:38 +0000695#define MOCK_METHOD0_T(m, ...) GMOCK_METHOD0_(typename, , , m, __VA_ARGS__)
696#define MOCK_METHOD1_T(m, ...) GMOCK_METHOD1_(typename, , , m, __VA_ARGS__)
697#define MOCK_METHOD2_T(m, ...) GMOCK_METHOD2_(typename, , , m, __VA_ARGS__)
698#define MOCK_METHOD3_T(m, ...) GMOCK_METHOD3_(typename, , , m, __VA_ARGS__)
699#define MOCK_METHOD4_T(m, ...) GMOCK_METHOD4_(typename, , , m, __VA_ARGS__)
700#define MOCK_METHOD5_T(m, ...) GMOCK_METHOD5_(typename, , , m, __VA_ARGS__)
701#define MOCK_METHOD6_T(m, ...) GMOCK_METHOD6_(typename, , , m, __VA_ARGS__)
702#define MOCK_METHOD7_T(m, ...) GMOCK_METHOD7_(typename, , , m, __VA_ARGS__)
703#define MOCK_METHOD8_T(m, ...) GMOCK_METHOD8_(typename, , , m, __VA_ARGS__)
704#define MOCK_METHOD9_T(m, ...) GMOCK_METHOD9_(typename, , , m, __VA_ARGS__)
705#define MOCK_METHOD10_T(m, ...) GMOCK_METHOD10_(typename, , , m, __VA_ARGS__)
shiqiane35fdd92008-12-10 05:08:54 +0000706
zhanyong.wan20d1a232013-03-01 06:58:38 +0000707#define MOCK_CONST_METHOD0_T(m, ...) \
708 GMOCK_METHOD0_(typename, const, , m, __VA_ARGS__)
709#define MOCK_CONST_METHOD1_T(m, ...) \
710 GMOCK_METHOD1_(typename, const, , m, __VA_ARGS__)
711#define MOCK_CONST_METHOD2_T(m, ...) \
712 GMOCK_METHOD2_(typename, const, , m, __VA_ARGS__)
713#define MOCK_CONST_METHOD3_T(m, ...) \
714 GMOCK_METHOD3_(typename, const, , m, __VA_ARGS__)
715#define MOCK_CONST_METHOD4_T(m, ...) \
716 GMOCK_METHOD4_(typename, const, , m, __VA_ARGS__)
717#define MOCK_CONST_METHOD5_T(m, ...) \
718 GMOCK_METHOD5_(typename, const, , m, __VA_ARGS__)
719#define MOCK_CONST_METHOD6_T(m, ...) \
720 GMOCK_METHOD6_(typename, const, , m, __VA_ARGS__)
721#define MOCK_CONST_METHOD7_T(m, ...) \
722 GMOCK_METHOD7_(typename, const, , m, __VA_ARGS__)
723#define MOCK_CONST_METHOD8_T(m, ...) \
724 GMOCK_METHOD8_(typename, const, , m, __VA_ARGS__)
725#define MOCK_CONST_METHOD9_T(m, ...) \
726 GMOCK_METHOD9_(typename, const, , m, __VA_ARGS__)
727#define MOCK_CONST_METHOD10_T(m, ...) \
728 GMOCK_METHOD10_(typename, const, , m, __VA_ARGS__)
shiqiane35fdd92008-12-10 05:08:54 +0000729
zhanyong.wan20d1a232013-03-01 06:58:38 +0000730#define MOCK_METHOD0_WITH_CALLTYPE(ct, m, ...) \
731 GMOCK_METHOD0_(, , ct, m, __VA_ARGS__)
732#define MOCK_METHOD1_WITH_CALLTYPE(ct, m, ...) \
733 GMOCK_METHOD1_(, , ct, m, __VA_ARGS__)
734#define MOCK_METHOD2_WITH_CALLTYPE(ct, m, ...) \
735 GMOCK_METHOD2_(, , ct, m, __VA_ARGS__)
736#define MOCK_METHOD3_WITH_CALLTYPE(ct, m, ...) \
737 GMOCK_METHOD3_(, , ct, m, __VA_ARGS__)
738#define MOCK_METHOD4_WITH_CALLTYPE(ct, m, ...) \
739 GMOCK_METHOD4_(, , ct, m, __VA_ARGS__)
740#define MOCK_METHOD5_WITH_CALLTYPE(ct, m, ...) \
741 GMOCK_METHOD5_(, , ct, m, __VA_ARGS__)
742#define MOCK_METHOD6_WITH_CALLTYPE(ct, m, ...) \
743 GMOCK_METHOD6_(, , ct, m, __VA_ARGS__)
744#define MOCK_METHOD7_WITH_CALLTYPE(ct, m, ...) \
745 GMOCK_METHOD7_(, , ct, m, __VA_ARGS__)
746#define MOCK_METHOD8_WITH_CALLTYPE(ct, m, ...) \
747 GMOCK_METHOD8_(, , ct, m, __VA_ARGS__)
748#define MOCK_METHOD9_WITH_CALLTYPE(ct, m, ...) \
749 GMOCK_METHOD9_(, , ct, m, __VA_ARGS__)
750#define MOCK_METHOD10_WITH_CALLTYPE(ct, m, ...) \
751 GMOCK_METHOD10_(, , ct, m, __VA_ARGS__)
shiqiane35fdd92008-12-10 05:08:54 +0000752
zhanyong.wan20d1a232013-03-01 06:58:38 +0000753#define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, ...) \
754 GMOCK_METHOD0_(, const, ct, m, __VA_ARGS__)
755#define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, ...) \
756 GMOCK_METHOD1_(, const, ct, m, __VA_ARGS__)
757#define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, ...) \
758 GMOCK_METHOD2_(, const, ct, m, __VA_ARGS__)
759#define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, ...) \
760 GMOCK_METHOD3_(, const, ct, m, __VA_ARGS__)
761#define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, ...) \
762 GMOCK_METHOD4_(, const, ct, m, __VA_ARGS__)
763#define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, ...) \
764 GMOCK_METHOD5_(, const, ct, m, __VA_ARGS__)
765#define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, ...) \
766 GMOCK_METHOD6_(, const, ct, m, __VA_ARGS__)
767#define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, ...) \
768 GMOCK_METHOD7_(, const, ct, m, __VA_ARGS__)
769#define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, ...) \
770 GMOCK_METHOD8_(, const, ct, m, __VA_ARGS__)
771#define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, ...) \
772 GMOCK_METHOD9_(, const, ct, m, __VA_ARGS__)
773#define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, ...) \
774 GMOCK_METHOD10_(, const, ct, m, __VA_ARGS__)
shiqiane35fdd92008-12-10 05:08:54 +0000775
zhanyong.wan20d1a232013-03-01 06:58:38 +0000776#define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
777 GMOCK_METHOD0_(typename, , ct, m, __VA_ARGS__)
778#define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
779 GMOCK_METHOD1_(typename, , ct, m, __VA_ARGS__)
780#define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
781 GMOCK_METHOD2_(typename, , ct, m, __VA_ARGS__)
782#define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
783 GMOCK_METHOD3_(typename, , ct, m, __VA_ARGS__)
784#define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
785 GMOCK_METHOD4_(typename, , ct, m, __VA_ARGS__)
786#define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
787 GMOCK_METHOD5_(typename, , ct, m, __VA_ARGS__)
788#define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
789 GMOCK_METHOD6_(typename, , ct, m, __VA_ARGS__)
790#define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
791 GMOCK_METHOD7_(typename, , ct, m, __VA_ARGS__)
792#define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
793 GMOCK_METHOD8_(typename, , ct, m, __VA_ARGS__)
794#define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
795 GMOCK_METHOD9_(typename, , ct, m, __VA_ARGS__)
796#define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
797 GMOCK_METHOD10_(typename, , ct, m, __VA_ARGS__)
shiqiane35fdd92008-12-10 05:08:54 +0000798
zhanyong.wan20d1a232013-03-01 06:58:38 +0000799#define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
800 GMOCK_METHOD0_(typename, const, ct, m, __VA_ARGS__)
801#define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
802 GMOCK_METHOD1_(typename, const, ct, m, __VA_ARGS__)
803#define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
804 GMOCK_METHOD2_(typename, const, ct, m, __VA_ARGS__)
805#define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
806 GMOCK_METHOD3_(typename, const, ct, m, __VA_ARGS__)
807#define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
808 GMOCK_METHOD4_(typename, const, ct, m, __VA_ARGS__)
809#define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
810 GMOCK_METHOD5_(typename, const, ct, m, __VA_ARGS__)
811#define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
812 GMOCK_METHOD6_(typename, const, ct, m, __VA_ARGS__)
813#define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
814 GMOCK_METHOD7_(typename, const, ct, m, __VA_ARGS__)
815#define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
816 GMOCK_METHOD8_(typename, const, ct, m, __VA_ARGS__)
817#define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
818 GMOCK_METHOD9_(typename, const, ct, m, __VA_ARGS__)
819#define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
820 GMOCK_METHOD10_(typename, const, ct, m, __VA_ARGS__)
shiqiane35fdd92008-12-10 05:08:54 +0000821
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000822// A MockFunction<F> class has one mock method whose type is F. It is
823// useful when you just want your test code to emit some messages and
824// have Google Mock verify the right messages are sent (and perhaps at
825// the right times). For example, if you are exercising code:
826//
827// Foo(1);
828// Foo(2);
829// Foo(3);
830//
831// and want to verify that Foo(1) and Foo(3) both invoke
832// mock.Bar("a"), but Foo(2) doesn't invoke anything, you can write:
833//
834// TEST(FooTest, InvokesBarCorrectly) {
835// MyMock mock;
836// MockFunction<void(string check_point_name)> check;
837// {
838// InSequence s;
839//
840// EXPECT_CALL(mock, Bar("a"));
841// EXPECT_CALL(check, Call("1"));
842// EXPECT_CALL(check, Call("2"));
843// EXPECT_CALL(mock, Bar("a"));
844// }
845// Foo(1);
846// check.Call("1");
847// Foo(2);
848// check.Call("2");
849// Foo(3);
850// }
851//
852// The expectation spec says that the first Bar("a") must happen
853// before check point "1", the second Bar("a") must happen after check
854// point "2", and nothing should happen between the two check
855// points. The explicit check points make it easy to tell which
856// Bar("a") is called by which call to Foo().
kosaka9e02a92014-06-17 23:19:54 +0000857//
858// MockFunction<F> can also be used to exercise code that accepts
859// std::function<F> callbacks. To do so, use AsStdFunction() method
860// to create std::function proxy forwarding to original object's Call.
861// Example:
862//
863// TEST(FooTest, RunsCallbackWithBarArgument) {
864// MockFunction<int(string)> callback;
865// EXPECT_CALL(callback, Call("bar")).WillOnce(Return(1));
866// Foo(callback.AsStdFunction());
867// }
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000868template <typename F>
869class MockFunction;
870
871template <typename R>
872class MockFunction<R()> {
873 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000874 MockFunction() {}
875
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000876 MOCK_METHOD0_T(Call, R());
zhanyong.wan32de5f52009-12-23 00:13:23 +0000877
kosak5b9cbbb2014-11-17 00:28:55 +0000878#if GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000879 std::function<R()> AsStdFunction() {
880 return [this]() {
881 return this->Call();
882 };
883 }
kosak5b9cbbb2014-11-17 00:28:55 +0000884#endif // GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000885
zhanyong.wan32de5f52009-12-23 00:13:23 +0000886 private:
887 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000888};
889
890template <typename R, typename A0>
891class MockFunction<R(A0)> {
892 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000893 MockFunction() {}
894
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000895 MOCK_METHOD1_T(Call, R(A0));
zhanyong.wan32de5f52009-12-23 00:13:23 +0000896
kosak5b9cbbb2014-11-17 00:28:55 +0000897#if GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000898 std::function<R(A0)> AsStdFunction() {
899 return [this](A0 a0) {
900 return this->Call(a0);
901 };
902 }
kosak5b9cbbb2014-11-17 00:28:55 +0000903#endif // GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000904
zhanyong.wan32de5f52009-12-23 00:13:23 +0000905 private:
906 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000907};
908
909template <typename R, typename A0, typename A1>
910class MockFunction<R(A0, A1)> {
911 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000912 MockFunction() {}
913
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000914 MOCK_METHOD2_T(Call, R(A0, A1));
zhanyong.wan32de5f52009-12-23 00:13:23 +0000915
kosak5b9cbbb2014-11-17 00:28:55 +0000916#if GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000917 std::function<R(A0, A1)> AsStdFunction() {
918 return [this](A0 a0, A1 a1) {
919 return this->Call(a0, a1);
920 };
921 }
kosak5b9cbbb2014-11-17 00:28:55 +0000922#endif // GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000923
zhanyong.wan32de5f52009-12-23 00:13:23 +0000924 private:
925 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000926};
927
928template <typename R, typename A0, typename A1, typename A2>
929class MockFunction<R(A0, A1, A2)> {
930 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000931 MockFunction() {}
932
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000933 MOCK_METHOD3_T(Call, R(A0, A1, A2));
zhanyong.wan32de5f52009-12-23 00:13:23 +0000934
kosak5b9cbbb2014-11-17 00:28:55 +0000935#if GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000936 std::function<R(A0, A1, A2)> AsStdFunction() {
937 return [this](A0 a0, A1 a1, A2 a2) {
938 return this->Call(a0, a1, a2);
939 };
940 }
kosak5b9cbbb2014-11-17 00:28:55 +0000941#endif // GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000942
zhanyong.wan32de5f52009-12-23 00:13:23 +0000943 private:
944 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000945};
946
947template <typename R, typename A0, typename A1, typename A2, typename A3>
948class MockFunction<R(A0, A1, A2, A3)> {
949 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000950 MockFunction() {}
951
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000952 MOCK_METHOD4_T(Call, R(A0, A1, A2, A3));
zhanyong.wan32de5f52009-12-23 00:13:23 +0000953
kosak5b9cbbb2014-11-17 00:28:55 +0000954#if GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000955 std::function<R(A0, A1, A2, A3)> AsStdFunction() {
956 return [this](A0 a0, A1 a1, A2 a2, A3 a3) {
957 return this->Call(a0, a1, a2, a3);
958 };
959 }
kosak5b9cbbb2014-11-17 00:28:55 +0000960#endif // GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000961
zhanyong.wan32de5f52009-12-23 00:13:23 +0000962 private:
963 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000964};
965
966template <typename R, typename A0, typename A1, typename A2, typename A3,
967 typename A4>
968class MockFunction<R(A0, A1, A2, A3, A4)> {
969 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000970 MockFunction() {}
971
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000972 MOCK_METHOD5_T(Call, R(A0, A1, A2, A3, A4));
zhanyong.wan32de5f52009-12-23 00:13:23 +0000973
kosak5b9cbbb2014-11-17 00:28:55 +0000974#if GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000975 std::function<R(A0, A1, A2, A3, A4)> AsStdFunction() {
976 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4) {
977 return this->Call(a0, a1, a2, a3, a4);
978 };
979 }
kosak5b9cbbb2014-11-17 00:28:55 +0000980#endif // GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000981
zhanyong.wan32de5f52009-12-23 00:13:23 +0000982 private:
983 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000984};
985
986template <typename R, typename A0, typename A1, typename A2, typename A3,
987 typename A4, typename A5>
988class MockFunction<R(A0, A1, A2, A3, A4, A5)> {
989 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000990 MockFunction() {}
991
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000992 MOCK_METHOD6_T(Call, R(A0, A1, A2, A3, A4, A5));
zhanyong.wan32de5f52009-12-23 00:13:23 +0000993
kosak5b9cbbb2014-11-17 00:28:55 +0000994#if GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +0000995 std::function<R(A0, A1, A2, A3, A4, A5)> AsStdFunction() {
996 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
997 return this->Call(a0, a1, a2, a3, a4, a5);
998 };
999 }
kosak5b9cbbb2014-11-17 00:28:55 +00001000#endif // GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +00001001
zhanyong.wan32de5f52009-12-23 00:13:23 +00001002 private:
1003 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +00001004};
1005
1006template <typename R, typename A0, typename A1, typename A2, typename A3,
1007 typename A4, typename A5, typename A6>
1008class MockFunction<R(A0, A1, A2, A3, A4, A5, A6)> {
1009 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +00001010 MockFunction() {}
1011
zhanyong.wanf3aa4d22009-09-25 22:34:47 +00001012 MOCK_METHOD7_T(Call, R(A0, A1, A2, A3, A4, A5, A6));
zhanyong.wan32de5f52009-12-23 00:13:23 +00001013
kosak5b9cbbb2014-11-17 00:28:55 +00001014#if GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +00001015 std::function<R(A0, A1, A2, A3, A4, A5, A6)> AsStdFunction() {
1016 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) {
1017 return this->Call(a0, a1, a2, a3, a4, a5, a6);
1018 };
1019 }
kosak5b9cbbb2014-11-17 00:28:55 +00001020#endif // GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +00001021
zhanyong.wan32de5f52009-12-23 00:13:23 +00001022 private:
1023 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +00001024};
1025
1026template <typename R, typename A0, typename A1, typename A2, typename A3,
1027 typename A4, typename A5, typename A6, typename A7>
1028class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7)> {
1029 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +00001030 MockFunction() {}
1031
zhanyong.wanf3aa4d22009-09-25 22:34:47 +00001032 MOCK_METHOD8_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7));
zhanyong.wan32de5f52009-12-23 00:13:23 +00001033
kosak5b9cbbb2014-11-17 00:28:55 +00001034#if GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +00001035 std::function<R(A0, A1, A2, A3, A4, A5, A6, A7)> AsStdFunction() {
1036 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) {
1037 return this->Call(a0, a1, a2, a3, a4, a5, a6, a7);
1038 };
1039 }
kosak5b9cbbb2014-11-17 00:28:55 +00001040#endif // GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +00001041
zhanyong.wan32de5f52009-12-23 00:13:23 +00001042 private:
1043 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +00001044};
1045
1046template <typename R, typename A0, typename A1, typename A2, typename A3,
1047 typename A4, typename A5, typename A6, typename A7, typename A8>
1048class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> {
1049 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +00001050 MockFunction() {}
1051
zhanyong.wanf3aa4d22009-09-25 22:34:47 +00001052 MOCK_METHOD9_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8));
zhanyong.wan32de5f52009-12-23 00:13:23 +00001053
kosak5b9cbbb2014-11-17 00:28:55 +00001054#if GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +00001055 std::function<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> AsStdFunction() {
1056 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7,
1057 A8 a8) {
1058 return this->Call(a0, a1, a2, a3, a4, a5, a6, a7, a8);
1059 };
1060 }
kosak5b9cbbb2014-11-17 00:28:55 +00001061#endif // GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +00001062
zhanyong.wan32de5f52009-12-23 00:13:23 +00001063 private:
1064 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +00001065};
1066
1067template <typename R, typename A0, typename A1, typename A2, typename A3,
1068 typename A4, typename A5, typename A6, typename A7, typename A8,
1069 typename A9>
1070class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
1071 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +00001072 MockFunction() {}
1073
zhanyong.wanf3aa4d22009-09-25 22:34:47 +00001074 MOCK_METHOD10_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9));
zhanyong.wan32de5f52009-12-23 00:13:23 +00001075
kosak5b9cbbb2014-11-17 00:28:55 +00001076#if GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +00001077 std::function<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> AsStdFunction() {
1078 return [this](A0 a0, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7,
1079 A8 a8, A9 a9) {
1080 return this->Call(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
1081 };
1082 }
kosak5b9cbbb2014-11-17 00:28:55 +00001083#endif // GTEST_HAS_STD_FUNCTION_
kosaka9e02a92014-06-17 23:19:54 +00001084
zhanyong.wan32de5f52009-12-23 00:13:23 +00001085 private:
1086 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +00001087};
1088
shiqiane35fdd92008-12-10 05:08:54 +00001089} // namespace testing
1090
1091#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_