blob: 509d46cbbae32b076169b530130179a006d4af50 [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) {
88 this->current_spec().SetMatchers(::std::tr1::make_tuple(m1));
89 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) {
109 this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2));
110 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) {
131 this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3));
132 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) {
153 this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4));
154 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) {
176 this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4,
177 m5));
178 return this->current_spec();
179 }
180
181 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) {
zhanyong.wan21a58462009-11-12 19:18:08 +0000182 // Even though gcc and MSVC don't enforce it, 'this->' is required
183 // by the C++ standard [14.6.4] here, as the base class type is
184 // dependent on the template argument (and thus shouldn't be
185 // looked into when resolving InvokeWith).
186 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5));
shiqiane35fdd92008-12-10 05:08:54 +0000187 }
188};
189
190template <typename R, typename A1, typename A2, typename A3, typename A4,
191 typename A5, typename A6>
192class FunctionMocker<R(A1, A2, A3, A4, A5, A6)> : public
193 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6)> {
194 public:
195 typedef R F(A1, A2, A3, A4, A5, A6);
196 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
197
198 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
199 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
200 const Matcher<A6>& m6) {
201 this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5,
202 m6));
203 return this->current_spec();
204 }
205
206 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) {
zhanyong.wan21a58462009-11-12 19:18:08 +0000207 // Even though gcc and MSVC don't enforce it, 'this->' is required
208 // by the C++ standard [14.6.4] here, as the base class type is
209 // dependent on the template argument (and thus shouldn't be
210 // looked into when resolving InvokeWith).
211 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6));
shiqiane35fdd92008-12-10 05:08:54 +0000212 }
213};
214
215template <typename R, typename A1, typename A2, typename A3, typename A4,
216 typename A5, typename A6, typename A7>
217class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7)> : public
218 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7)> {
219 public:
220 typedef R F(A1, A2, A3, A4, A5, A6, A7);
221 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
222
223 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
224 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
225 const Matcher<A6>& m6, const Matcher<A7>& m7) {
226 this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5,
227 m6, m7));
228 return this->current_spec();
229 }
230
231 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) {
zhanyong.wan21a58462009-11-12 19:18:08 +0000232 // Even though gcc and MSVC don't enforce it, 'this->' is required
233 // by the C++ standard [14.6.4] here, as the base class type is
234 // dependent on the template argument (and thus shouldn't be
235 // looked into when resolving InvokeWith).
236 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7));
shiqiane35fdd92008-12-10 05:08:54 +0000237 }
238};
239
240template <typename R, typename A1, typename A2, typename A3, typename A4,
241 typename A5, typename A6, typename A7, typename A8>
242class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8)> : public
243 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8)> {
244 public:
245 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8);
246 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
247
248 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
249 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
250 const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8) {
251 this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5,
252 m6, m7, m8));
253 return this->current_spec();
254 }
255
256 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 +0000257 // Even though gcc and MSVC don't enforce it, 'this->' is required
258 // by the C++ standard [14.6.4] here, as the base class type is
259 // dependent on the template argument (and thus shouldn't be
260 // looked into when resolving InvokeWith).
261 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8));
shiqiane35fdd92008-12-10 05:08:54 +0000262 }
263};
264
265template <typename R, typename A1, typename A2, typename A3, typename A4,
266 typename A5, typename A6, typename A7, typename A8, typename A9>
267class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> : public
268 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
269 public:
270 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9);
271 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
272
273 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
274 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
275 const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8,
276 const Matcher<A9>& m9) {
277 this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5,
278 m6, m7, m8, m9));
279 return this->current_spec();
280 }
281
282 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 +0000283 // Even though gcc and MSVC don't enforce it, 'this->' is required
284 // by the C++ standard [14.6.4] here, as the base class type is
285 // dependent on the template argument (and thus shouldn't be
286 // looked into when resolving InvokeWith).
287 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8, a9));
shiqiane35fdd92008-12-10 05:08:54 +0000288 }
289};
290
291template <typename R, typename A1, typename A2, typename A3, typename A4,
292 typename A5, typename A6, typename A7, typename A8, typename A9,
293 typename A10>
294class FunctionMocker<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> : public
295 internal::FunctionMockerBase<R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> {
296 public:
297 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
298 typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
299
300 MockSpec<F>& With(const Matcher<A1>& m1, const Matcher<A2>& m2,
301 const Matcher<A3>& m3, const Matcher<A4>& m4, const Matcher<A5>& m5,
302 const Matcher<A6>& m6, const Matcher<A7>& m7, const Matcher<A8>& m8,
303 const Matcher<A9>& m9, const Matcher<A10>& m10) {
304 this->current_spec().SetMatchers(::std::tr1::make_tuple(m1, m2, m3, m4, m5,
305 m6, m7, m8, m9, m10));
306 return this->current_spec();
307 }
308
309 R Invoke(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9,
310 A10 a10) {
zhanyong.wan21a58462009-11-12 19:18:08 +0000311 // Even though gcc and MSVC don't enforce it, 'this->' is required
312 // by the C++ standard [14.6.4] here, as the base class type is
313 // dependent on the template argument (and thus shouldn't be
314 // looked into when resolving InvokeWith).
315 return this->InvokeWith(ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8, a9,
316 a10));
shiqiane35fdd92008-12-10 05:08:54 +0000317 }
318};
319
320} // namespace internal
321
322// The style guide prohibits "using" statements in a namespace scope
323// inside a header file. However, the FunctionMocker class template
324// is meant to be defined in the ::testing namespace. The following
325// line is just a trick for working around a bug in MSVC 8.0, which
326// cannot handle it if we define FunctionMocker in ::testing.
327using internal::FunctionMocker;
328
329// The result type of function type F.
330// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wane0d051e2009-02-19 00:33:37 +0000331#define GMOCK_RESULT_(tn, F) tn ::testing::internal::Function<F>::Result
shiqiane35fdd92008-12-10 05:08:54 +0000332
333// The type of argument N of function type F.
334// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wane0d051e2009-02-19 00:33:37 +0000335#define GMOCK_ARG_(tn, F, N) tn ::testing::internal::Function<F>::Argument##N
shiqiane35fdd92008-12-10 05:08:54 +0000336
337// The matcher type for argument N of function type F.
338// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wane0d051e2009-02-19 00:33:37 +0000339#define GMOCK_MATCHER_(tn, F, N) const ::testing::Matcher<GMOCK_ARG_(tn, F, N)>&
shiqiane35fdd92008-12-10 05:08:54 +0000340
341// The variable for mocking the given method.
342// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wan68be1112009-03-25 03:56:48 +0000343#define GMOCK_MOCKER_(arity, constness, Method) \
zhanyong.wanccedc1c2010-08-09 22:46:12 +0000344 GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__)
shiqiane35fdd92008-12-10 05:08:54 +0000345
346// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wane0d051e2009-02-19 00:33:37 +0000347#define GMOCK_METHOD0_(tn, constness, ct, Method, F) \
348 GMOCK_RESULT_(tn, F) ct Method() constness { \
zhanyong.wan02f71062010-05-10 17:14:29 +0000349 GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \
shiqiane35fdd92008-12-10 05:08:54 +0000350 tn ::testing::internal::Function<F>::ArgumentTuple>::value == 0, \
351 this_method_does_not_take_0_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000352 GMOCK_MOCKER_(0, constness, Method).SetOwnerAndName(this, #Method); \
353 return GMOCK_MOCKER_(0, constness, Method).Invoke(); \
shiqiane35fdd92008-12-10 05:08:54 +0000354 } \
355 ::testing::MockSpec<F>& \
356 gmock_##Method() constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000357 GMOCK_MOCKER_(0, constness, Method).RegisterOwner(this); \
358 return GMOCK_MOCKER_(0, constness, Method).With(); \
shiqiane35fdd92008-12-10 05:08:54 +0000359 } \
zhanyong.wan68be1112009-03-25 03:56:48 +0000360 mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(0, constness, Method)
shiqiane35fdd92008-12-10 05:08:54 +0000361
362// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wane0d051e2009-02-19 00:33:37 +0000363#define GMOCK_METHOD1_(tn, constness, ct, Method, F) \
364 GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1) constness { \
zhanyong.wan02f71062010-05-10 17:14:29 +0000365 GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \
shiqiane35fdd92008-12-10 05:08:54 +0000366 tn ::testing::internal::Function<F>::ArgumentTuple>::value == 1, \
367 this_method_does_not_take_1_argument); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000368 GMOCK_MOCKER_(1, constness, Method).SetOwnerAndName(this, #Method); \
369 return GMOCK_MOCKER_(1, constness, Method).Invoke(gmock_a1); \
shiqiane35fdd92008-12-10 05:08:54 +0000370 } \
371 ::testing::MockSpec<F>& \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000372 gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000373 GMOCK_MOCKER_(1, constness, Method).RegisterOwner(this); \
374 return GMOCK_MOCKER_(1, constness, Method).With(gmock_a1); \
shiqiane35fdd92008-12-10 05:08:54 +0000375 } \
zhanyong.wan68be1112009-03-25 03:56:48 +0000376 mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(1, constness, Method)
shiqiane35fdd92008-12-10 05:08:54 +0000377
378// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wane0d051e2009-02-19 00:33:37 +0000379#define GMOCK_METHOD2_(tn, constness, ct, Method, F) \
380 GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
381 GMOCK_ARG_(tn, F, 2) gmock_a2) constness { \
zhanyong.wan02f71062010-05-10 17:14:29 +0000382 GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \
shiqiane35fdd92008-12-10 05:08:54 +0000383 tn ::testing::internal::Function<F>::ArgumentTuple>::value == 2, \
384 this_method_does_not_take_2_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000385 GMOCK_MOCKER_(2, constness, Method).SetOwnerAndName(this, #Method); \
386 return GMOCK_MOCKER_(2, constness, Method).Invoke(gmock_a1, gmock_a2); \
shiqiane35fdd92008-12-10 05:08:54 +0000387 } \
388 ::testing::MockSpec<F>& \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000389 gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
390 GMOCK_MATCHER_(tn, F, 2) gmock_a2) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000391 GMOCK_MOCKER_(2, constness, Method).RegisterOwner(this); \
392 return GMOCK_MOCKER_(2, constness, Method).With(gmock_a1, gmock_a2); \
shiqiane35fdd92008-12-10 05:08:54 +0000393 } \
zhanyong.wan68be1112009-03-25 03:56:48 +0000394 mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(2, constness, Method)
shiqiane35fdd92008-12-10 05:08:54 +0000395
396// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wane0d051e2009-02-19 00:33:37 +0000397#define GMOCK_METHOD3_(tn, constness, ct, Method, F) \
398 GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
399 GMOCK_ARG_(tn, F, 2) gmock_a2, \
400 GMOCK_ARG_(tn, F, 3) gmock_a3) constness { \
zhanyong.wan02f71062010-05-10 17:14:29 +0000401 GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \
shiqiane35fdd92008-12-10 05:08:54 +0000402 tn ::testing::internal::Function<F>::ArgumentTuple>::value == 3, \
403 this_method_does_not_take_3_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000404 GMOCK_MOCKER_(3, constness, Method).SetOwnerAndName(this, #Method); \
405 return GMOCK_MOCKER_(3, constness, Method).Invoke(gmock_a1, gmock_a2, \
406 gmock_a3); \
shiqiane35fdd92008-12-10 05:08:54 +0000407 } \
408 ::testing::MockSpec<F>& \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000409 gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
410 GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
411 GMOCK_MATCHER_(tn, F, 3) gmock_a3) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000412 GMOCK_MOCKER_(3, constness, Method).RegisterOwner(this); \
413 return GMOCK_MOCKER_(3, constness, Method).With(gmock_a1, gmock_a2, \
414 gmock_a3); \
shiqiane35fdd92008-12-10 05:08:54 +0000415 } \
zhanyong.wan68be1112009-03-25 03:56:48 +0000416 mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(3, constness, Method)
shiqiane35fdd92008-12-10 05:08:54 +0000417
418// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wane0d051e2009-02-19 00:33:37 +0000419#define GMOCK_METHOD4_(tn, constness, ct, Method, F) \
420 GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
421 GMOCK_ARG_(tn, F, 2) gmock_a2, \
422 GMOCK_ARG_(tn, F, 3) gmock_a3, \
423 GMOCK_ARG_(tn, F, 4) gmock_a4) constness { \
zhanyong.wan02f71062010-05-10 17:14:29 +0000424 GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \
shiqiane35fdd92008-12-10 05:08:54 +0000425 tn ::testing::internal::Function<F>::ArgumentTuple>::value == 4, \
426 this_method_does_not_take_4_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000427 GMOCK_MOCKER_(4, constness, Method).SetOwnerAndName(this, #Method); \
428 return GMOCK_MOCKER_(4, constness, Method).Invoke(gmock_a1, gmock_a2, \
429 gmock_a3, gmock_a4); \
shiqiane35fdd92008-12-10 05:08:54 +0000430 } \
431 ::testing::MockSpec<F>& \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000432 gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
433 GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
434 GMOCK_MATCHER_(tn, F, 3) gmock_a3, \
435 GMOCK_MATCHER_(tn, F, 4) gmock_a4) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000436 GMOCK_MOCKER_(4, constness, Method).RegisterOwner(this); \
437 return GMOCK_MOCKER_(4, constness, Method).With(gmock_a1, gmock_a2, \
438 gmock_a3, gmock_a4); \
shiqiane35fdd92008-12-10 05:08:54 +0000439 } \
zhanyong.wan68be1112009-03-25 03:56:48 +0000440 mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(4, constness, Method)
shiqiane35fdd92008-12-10 05:08:54 +0000441
442// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wane0d051e2009-02-19 00:33:37 +0000443#define GMOCK_METHOD5_(tn, constness, ct, Method, F) \
444 GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
445 GMOCK_ARG_(tn, F, 2) gmock_a2, \
446 GMOCK_ARG_(tn, F, 3) gmock_a3, \
447 GMOCK_ARG_(tn, F, 4) gmock_a4, \
448 GMOCK_ARG_(tn, F, 5) gmock_a5) constness { \
zhanyong.wan02f71062010-05-10 17:14:29 +0000449 GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \
shiqiane35fdd92008-12-10 05:08:54 +0000450 tn ::testing::internal::Function<F>::ArgumentTuple>::value == 5, \
451 this_method_does_not_take_5_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000452 GMOCK_MOCKER_(5, constness, Method).SetOwnerAndName(this, #Method); \
453 return GMOCK_MOCKER_(5, constness, Method).Invoke(gmock_a1, gmock_a2, \
454 gmock_a3, gmock_a4, gmock_a5); \
shiqiane35fdd92008-12-10 05:08:54 +0000455 } \
456 ::testing::MockSpec<F>& \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000457 gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
458 GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
459 GMOCK_MATCHER_(tn, F, 3) gmock_a3, \
460 GMOCK_MATCHER_(tn, F, 4) gmock_a4, \
461 GMOCK_MATCHER_(tn, F, 5) gmock_a5) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000462 GMOCK_MOCKER_(5, constness, Method).RegisterOwner(this); \
463 return GMOCK_MOCKER_(5, constness, Method).With(gmock_a1, gmock_a2, \
464 gmock_a3, gmock_a4, gmock_a5); \
shiqiane35fdd92008-12-10 05:08:54 +0000465 } \
zhanyong.wan68be1112009-03-25 03:56:48 +0000466 mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(5, constness, Method)
shiqiane35fdd92008-12-10 05:08:54 +0000467
468// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wane0d051e2009-02-19 00:33:37 +0000469#define GMOCK_METHOD6_(tn, constness, ct, Method, F) \
470 GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
471 GMOCK_ARG_(tn, F, 2) gmock_a2, \
472 GMOCK_ARG_(tn, F, 3) gmock_a3, \
473 GMOCK_ARG_(tn, F, 4) gmock_a4, \
474 GMOCK_ARG_(tn, F, 5) gmock_a5, \
475 GMOCK_ARG_(tn, F, 6) gmock_a6) constness { \
zhanyong.wan02f71062010-05-10 17:14:29 +0000476 GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \
shiqiane35fdd92008-12-10 05:08:54 +0000477 tn ::testing::internal::Function<F>::ArgumentTuple>::value == 6, \
478 this_method_does_not_take_6_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000479 GMOCK_MOCKER_(6, constness, Method).SetOwnerAndName(this, #Method); \
480 return GMOCK_MOCKER_(6, constness, Method).Invoke(gmock_a1, gmock_a2, \
481 gmock_a3, gmock_a4, gmock_a5, gmock_a6); \
shiqiane35fdd92008-12-10 05:08:54 +0000482 } \
483 ::testing::MockSpec<F>& \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000484 gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
485 GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
486 GMOCK_MATCHER_(tn, F, 3) gmock_a3, \
487 GMOCK_MATCHER_(tn, F, 4) gmock_a4, \
488 GMOCK_MATCHER_(tn, F, 5) gmock_a5, \
489 GMOCK_MATCHER_(tn, F, 6) gmock_a6) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000490 GMOCK_MOCKER_(6, constness, Method).RegisterOwner(this); \
491 return GMOCK_MOCKER_(6, constness, Method).With(gmock_a1, gmock_a2, \
492 gmock_a3, gmock_a4, gmock_a5, gmock_a6); \
shiqiane35fdd92008-12-10 05:08:54 +0000493 } \
zhanyong.wan68be1112009-03-25 03:56:48 +0000494 mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(6, constness, Method)
shiqiane35fdd92008-12-10 05:08:54 +0000495
496// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wane0d051e2009-02-19 00:33:37 +0000497#define GMOCK_METHOD7_(tn, constness, ct, Method, F) \
498 GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
499 GMOCK_ARG_(tn, F, 2) gmock_a2, \
500 GMOCK_ARG_(tn, F, 3) gmock_a3, \
501 GMOCK_ARG_(tn, F, 4) gmock_a4, \
502 GMOCK_ARG_(tn, F, 5) gmock_a5, \
503 GMOCK_ARG_(tn, F, 6) gmock_a6, \
504 GMOCK_ARG_(tn, F, 7) gmock_a7) constness { \
zhanyong.wan02f71062010-05-10 17:14:29 +0000505 GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \
shiqiane35fdd92008-12-10 05:08:54 +0000506 tn ::testing::internal::Function<F>::ArgumentTuple>::value == 7, \
507 this_method_does_not_take_7_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000508 GMOCK_MOCKER_(7, constness, Method).SetOwnerAndName(this, #Method); \
509 return GMOCK_MOCKER_(7, constness, Method).Invoke(gmock_a1, gmock_a2, \
510 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \
shiqiane35fdd92008-12-10 05:08:54 +0000511 } \
512 ::testing::MockSpec<F>& \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000513 gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
514 GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
515 GMOCK_MATCHER_(tn, F, 3) gmock_a3, \
516 GMOCK_MATCHER_(tn, F, 4) gmock_a4, \
517 GMOCK_MATCHER_(tn, F, 5) gmock_a5, \
518 GMOCK_MATCHER_(tn, F, 6) gmock_a6, \
519 GMOCK_MATCHER_(tn, F, 7) gmock_a7) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000520 GMOCK_MOCKER_(7, constness, Method).RegisterOwner(this); \
521 return GMOCK_MOCKER_(7, constness, Method).With(gmock_a1, gmock_a2, \
522 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \
shiqiane35fdd92008-12-10 05:08:54 +0000523 } \
zhanyong.wan68be1112009-03-25 03:56:48 +0000524 mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(7, constness, Method)
shiqiane35fdd92008-12-10 05:08:54 +0000525
526// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wane0d051e2009-02-19 00:33:37 +0000527#define GMOCK_METHOD8_(tn, constness, ct, Method, F) \
528 GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
529 GMOCK_ARG_(tn, F, 2) gmock_a2, \
530 GMOCK_ARG_(tn, F, 3) gmock_a3, \
531 GMOCK_ARG_(tn, F, 4) gmock_a4, \
532 GMOCK_ARG_(tn, F, 5) gmock_a5, \
533 GMOCK_ARG_(tn, F, 6) gmock_a6, \
534 GMOCK_ARG_(tn, F, 7) gmock_a7, \
535 GMOCK_ARG_(tn, F, 8) gmock_a8) constness { \
zhanyong.wan02f71062010-05-10 17:14:29 +0000536 GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \
shiqiane35fdd92008-12-10 05:08:54 +0000537 tn ::testing::internal::Function<F>::ArgumentTuple>::value == 8, \
538 this_method_does_not_take_8_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000539 GMOCK_MOCKER_(8, constness, Method).SetOwnerAndName(this, #Method); \
540 return GMOCK_MOCKER_(8, constness, Method).Invoke(gmock_a1, gmock_a2, \
541 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \
shiqiane35fdd92008-12-10 05:08:54 +0000542 } \
543 ::testing::MockSpec<F>& \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000544 gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
545 GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
546 GMOCK_MATCHER_(tn, F, 3) gmock_a3, \
547 GMOCK_MATCHER_(tn, F, 4) gmock_a4, \
548 GMOCK_MATCHER_(tn, F, 5) gmock_a5, \
549 GMOCK_MATCHER_(tn, F, 6) gmock_a6, \
550 GMOCK_MATCHER_(tn, F, 7) gmock_a7, \
551 GMOCK_MATCHER_(tn, F, 8) gmock_a8) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000552 GMOCK_MOCKER_(8, constness, Method).RegisterOwner(this); \
553 return GMOCK_MOCKER_(8, constness, Method).With(gmock_a1, gmock_a2, \
554 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \
shiqiane35fdd92008-12-10 05:08:54 +0000555 } \
zhanyong.wan68be1112009-03-25 03:56:48 +0000556 mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(8, constness, Method)
shiqiane35fdd92008-12-10 05:08:54 +0000557
558// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wane0d051e2009-02-19 00:33:37 +0000559#define GMOCK_METHOD9_(tn, constness, ct, Method, F) \
560 GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
561 GMOCK_ARG_(tn, F, 2) gmock_a2, \
562 GMOCK_ARG_(tn, F, 3) gmock_a3, \
563 GMOCK_ARG_(tn, F, 4) gmock_a4, \
564 GMOCK_ARG_(tn, F, 5) gmock_a5, \
565 GMOCK_ARG_(tn, F, 6) gmock_a6, \
566 GMOCK_ARG_(tn, F, 7) gmock_a7, \
567 GMOCK_ARG_(tn, F, 8) gmock_a8, \
568 GMOCK_ARG_(tn, F, 9) gmock_a9) constness { \
zhanyong.wan02f71062010-05-10 17:14:29 +0000569 GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \
shiqiane35fdd92008-12-10 05:08:54 +0000570 tn ::testing::internal::Function<F>::ArgumentTuple>::value == 9, \
571 this_method_does_not_take_9_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000572 GMOCK_MOCKER_(9, constness, Method).SetOwnerAndName(this, #Method); \
573 return GMOCK_MOCKER_(9, constness, Method).Invoke(gmock_a1, gmock_a2, \
574 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \
575 gmock_a9); \
shiqiane35fdd92008-12-10 05:08:54 +0000576 } \
577 ::testing::MockSpec<F>& \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000578 gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
579 GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
580 GMOCK_MATCHER_(tn, F, 3) gmock_a3, \
581 GMOCK_MATCHER_(tn, F, 4) gmock_a4, \
582 GMOCK_MATCHER_(tn, F, 5) gmock_a5, \
583 GMOCK_MATCHER_(tn, F, 6) gmock_a6, \
584 GMOCK_MATCHER_(tn, F, 7) gmock_a7, \
585 GMOCK_MATCHER_(tn, F, 8) gmock_a8, \
586 GMOCK_MATCHER_(tn, F, 9) gmock_a9) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000587 GMOCK_MOCKER_(9, constness, Method).RegisterOwner(this); \
588 return GMOCK_MOCKER_(9, constness, Method).With(gmock_a1, gmock_a2, \
589 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \
590 gmock_a9); \
shiqiane35fdd92008-12-10 05:08:54 +0000591 } \
zhanyong.wan68be1112009-03-25 03:56:48 +0000592 mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(9, constness, Method)
shiqiane35fdd92008-12-10 05:08:54 +0000593
594// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
zhanyong.wane0d051e2009-02-19 00:33:37 +0000595#define GMOCK_METHOD10_(tn, constness, ct, Method, F) \
596 GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
597 GMOCK_ARG_(tn, F, 2) gmock_a2, \
598 GMOCK_ARG_(tn, F, 3) gmock_a3, \
599 GMOCK_ARG_(tn, F, 4) gmock_a4, \
600 GMOCK_ARG_(tn, F, 5) gmock_a5, \
601 GMOCK_ARG_(tn, F, 6) gmock_a6, \
602 GMOCK_ARG_(tn, F, 7) gmock_a7, \
603 GMOCK_ARG_(tn, F, 8) gmock_a8, \
604 GMOCK_ARG_(tn, F, 9) gmock_a9, \
605 GMOCK_ARG_(tn, F, 10) gmock_a10) constness { \
zhanyong.wan02f71062010-05-10 17:14:29 +0000606 GTEST_COMPILE_ASSERT_(::std::tr1::tuple_size< \
shiqiane35fdd92008-12-10 05:08:54 +0000607 tn ::testing::internal::Function<F>::ArgumentTuple>::value == 10, \
608 this_method_does_not_take_10_arguments); \
zhanyong.wan68be1112009-03-25 03:56:48 +0000609 GMOCK_MOCKER_(10, constness, Method).SetOwnerAndName(this, #Method); \
610 return GMOCK_MOCKER_(10, constness, Method).Invoke(gmock_a1, gmock_a2, \
611 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \
shiqiane35fdd92008-12-10 05:08:54 +0000612 gmock_a10); \
613 } \
614 ::testing::MockSpec<F>& \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000615 gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
616 GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
617 GMOCK_MATCHER_(tn, F, 3) gmock_a3, \
618 GMOCK_MATCHER_(tn, F, 4) gmock_a4, \
619 GMOCK_MATCHER_(tn, F, 5) gmock_a5, \
620 GMOCK_MATCHER_(tn, F, 6) gmock_a6, \
621 GMOCK_MATCHER_(tn, F, 7) gmock_a7, \
622 GMOCK_MATCHER_(tn, F, 8) gmock_a8, \
623 GMOCK_MATCHER_(tn, F, 9) gmock_a9, \
624 GMOCK_MATCHER_(tn, F, 10) gmock_a10) constness { \
zhanyong.waned6c9272011-02-23 19:39:27 +0000625 GMOCK_MOCKER_(10, constness, Method).RegisterOwner(this); \
626 return GMOCK_MOCKER_(10, constness, Method).With(gmock_a1, gmock_a2, \
627 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \
shiqiane35fdd92008-12-10 05:08:54 +0000628 gmock_a10); \
629 } \
zhanyong.wan68be1112009-03-25 03:56:48 +0000630 mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(10, constness, Method)
shiqiane35fdd92008-12-10 05:08:54 +0000631
zhanyong.wane0d051e2009-02-19 00:33:37 +0000632#define MOCK_METHOD0(m, F) GMOCK_METHOD0_(, , , m, F)
633#define MOCK_METHOD1(m, F) GMOCK_METHOD1_(, , , m, F)
634#define MOCK_METHOD2(m, F) GMOCK_METHOD2_(, , , m, F)
635#define MOCK_METHOD3(m, F) GMOCK_METHOD3_(, , , m, F)
636#define MOCK_METHOD4(m, F) GMOCK_METHOD4_(, , , m, F)
637#define MOCK_METHOD5(m, F) GMOCK_METHOD5_(, , , m, F)
638#define MOCK_METHOD6(m, F) GMOCK_METHOD6_(, , , m, F)
639#define MOCK_METHOD7(m, F) GMOCK_METHOD7_(, , , m, F)
640#define MOCK_METHOD8(m, F) GMOCK_METHOD8_(, , , m, F)
641#define MOCK_METHOD9(m, F) GMOCK_METHOD9_(, , , m, F)
642#define MOCK_METHOD10(m, F) GMOCK_METHOD10_(, , , m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000643
zhanyong.wane0d051e2009-02-19 00:33:37 +0000644#define MOCK_CONST_METHOD0(m, F) GMOCK_METHOD0_(, const, , m, F)
645#define MOCK_CONST_METHOD1(m, F) GMOCK_METHOD1_(, const, , m, F)
646#define MOCK_CONST_METHOD2(m, F) GMOCK_METHOD2_(, const, , m, F)
647#define MOCK_CONST_METHOD3(m, F) GMOCK_METHOD3_(, const, , m, F)
648#define MOCK_CONST_METHOD4(m, F) GMOCK_METHOD4_(, const, , m, F)
649#define MOCK_CONST_METHOD5(m, F) GMOCK_METHOD5_(, const, , m, F)
650#define MOCK_CONST_METHOD6(m, F) GMOCK_METHOD6_(, const, , m, F)
651#define MOCK_CONST_METHOD7(m, F) GMOCK_METHOD7_(, const, , m, F)
652#define MOCK_CONST_METHOD8(m, F) GMOCK_METHOD8_(, const, , m, F)
653#define MOCK_CONST_METHOD9(m, F) GMOCK_METHOD9_(, const, , m, F)
654#define MOCK_CONST_METHOD10(m, F) GMOCK_METHOD10_(, const, , m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000655
zhanyong.wane0d051e2009-02-19 00:33:37 +0000656#define MOCK_METHOD0_T(m, F) GMOCK_METHOD0_(typename, , , m, F)
657#define MOCK_METHOD1_T(m, F) GMOCK_METHOD1_(typename, , , m, F)
658#define MOCK_METHOD2_T(m, F) GMOCK_METHOD2_(typename, , , m, F)
659#define MOCK_METHOD3_T(m, F) GMOCK_METHOD3_(typename, , , m, F)
660#define MOCK_METHOD4_T(m, F) GMOCK_METHOD4_(typename, , , m, F)
661#define MOCK_METHOD5_T(m, F) GMOCK_METHOD5_(typename, , , m, F)
662#define MOCK_METHOD6_T(m, F) GMOCK_METHOD6_(typename, , , m, F)
663#define MOCK_METHOD7_T(m, F) GMOCK_METHOD7_(typename, , , m, F)
664#define MOCK_METHOD8_T(m, F) GMOCK_METHOD8_(typename, , , m, F)
665#define MOCK_METHOD9_T(m, F) GMOCK_METHOD9_(typename, , , m, F)
666#define MOCK_METHOD10_T(m, F) GMOCK_METHOD10_(typename, , , m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000667
zhanyong.wane0d051e2009-02-19 00:33:37 +0000668#define MOCK_CONST_METHOD0_T(m, F) GMOCK_METHOD0_(typename, const, , m, F)
669#define MOCK_CONST_METHOD1_T(m, F) GMOCK_METHOD1_(typename, const, , m, F)
670#define MOCK_CONST_METHOD2_T(m, F) GMOCK_METHOD2_(typename, const, , m, F)
671#define MOCK_CONST_METHOD3_T(m, F) GMOCK_METHOD3_(typename, const, , m, F)
672#define MOCK_CONST_METHOD4_T(m, F) GMOCK_METHOD4_(typename, const, , m, F)
673#define MOCK_CONST_METHOD5_T(m, F) GMOCK_METHOD5_(typename, const, , m, F)
674#define MOCK_CONST_METHOD6_T(m, F) GMOCK_METHOD6_(typename, const, , m, F)
675#define MOCK_CONST_METHOD7_T(m, F) GMOCK_METHOD7_(typename, const, , m, F)
676#define MOCK_CONST_METHOD8_T(m, F) GMOCK_METHOD8_(typename, const, , m, F)
677#define MOCK_CONST_METHOD9_T(m, F) GMOCK_METHOD9_(typename, const, , m, F)
678#define MOCK_CONST_METHOD10_T(m, F) GMOCK_METHOD10_(typename, const, , m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000679
zhanyong.wane0d051e2009-02-19 00:33:37 +0000680#define MOCK_METHOD0_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD0_(, , ct, m, F)
681#define MOCK_METHOD1_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD1_(, , ct, m, F)
682#define MOCK_METHOD2_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD2_(, , ct, m, F)
683#define MOCK_METHOD3_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD3_(, , ct, m, F)
684#define MOCK_METHOD4_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD4_(, , ct, m, F)
685#define MOCK_METHOD5_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD5_(, , ct, m, F)
686#define MOCK_METHOD6_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD6_(, , ct, m, F)
687#define MOCK_METHOD7_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD7_(, , ct, m, F)
688#define MOCK_METHOD8_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD8_(, , ct, m, F)
689#define MOCK_METHOD9_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD9_(, , ct, m, F)
690#define MOCK_METHOD10_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD10_(, , ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000691
692#define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000693 GMOCK_METHOD0_(, const, ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000694#define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000695 GMOCK_METHOD1_(, const, ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000696#define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000697 GMOCK_METHOD2_(, const, ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000698#define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000699 GMOCK_METHOD3_(, const, ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000700#define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000701 GMOCK_METHOD4_(, const, ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000702#define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000703 GMOCK_METHOD5_(, const, ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000704#define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000705 GMOCK_METHOD6_(, const, ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000706#define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000707 GMOCK_METHOD7_(, const, ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000708#define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000709 GMOCK_METHOD8_(, const, ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000710#define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000711 GMOCK_METHOD9_(, const, ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000712#define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000713 GMOCK_METHOD10_(, const, ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000714
715#define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000716 GMOCK_METHOD0_(typename, , ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000717#define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000718 GMOCK_METHOD1_(typename, , ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000719#define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000720 GMOCK_METHOD2_(typename, , ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000721#define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000722 GMOCK_METHOD3_(typename, , ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000723#define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000724 GMOCK_METHOD4_(typename, , ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000725#define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000726 GMOCK_METHOD5_(typename, , ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000727#define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000728 GMOCK_METHOD6_(typename, , ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000729#define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000730 GMOCK_METHOD7_(typename, , ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000731#define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000732 GMOCK_METHOD8_(typename, , ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000733#define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000734 GMOCK_METHOD9_(typename, , ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000735#define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000736 GMOCK_METHOD10_(typename, , ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000737
738#define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000739 GMOCK_METHOD0_(typename, const, ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000740#define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000741 GMOCK_METHOD1_(typename, const, ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000742#define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000743 GMOCK_METHOD2_(typename, const, ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000744#define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000745 GMOCK_METHOD3_(typename, const, ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000746#define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000747 GMOCK_METHOD4_(typename, const, ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000748#define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000749 GMOCK_METHOD5_(typename, const, ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000750#define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000751 GMOCK_METHOD6_(typename, const, ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000752#define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000753 GMOCK_METHOD7_(typename, const, ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000754#define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000755 GMOCK_METHOD8_(typename, const, ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000756#define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000757 GMOCK_METHOD9_(typename, const, ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000758#define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, F) \
zhanyong.wane0d051e2009-02-19 00:33:37 +0000759 GMOCK_METHOD10_(typename, const, ct, m, F)
shiqiane35fdd92008-12-10 05:08:54 +0000760
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000761// A MockFunction<F> class has one mock method whose type is F. It is
762// useful when you just want your test code to emit some messages and
763// have Google Mock verify the right messages are sent (and perhaps at
764// the right times). For example, if you are exercising code:
765//
766// Foo(1);
767// Foo(2);
768// Foo(3);
769//
770// and want to verify that Foo(1) and Foo(3) both invoke
771// mock.Bar("a"), but Foo(2) doesn't invoke anything, you can write:
772//
773// TEST(FooTest, InvokesBarCorrectly) {
774// MyMock mock;
775// MockFunction<void(string check_point_name)> check;
776// {
777// InSequence s;
778//
779// EXPECT_CALL(mock, Bar("a"));
780// EXPECT_CALL(check, Call("1"));
781// EXPECT_CALL(check, Call("2"));
782// EXPECT_CALL(mock, Bar("a"));
783// }
784// Foo(1);
785// check.Call("1");
786// Foo(2);
787// check.Call("2");
788// Foo(3);
789// }
790//
791// The expectation spec says that the first Bar("a") must happen
792// before check point "1", the second Bar("a") must happen after check
793// point "2", and nothing should happen between the two check
794// points. The explicit check points make it easy to tell which
795// Bar("a") is called by which call to Foo().
796template <typename F>
797class MockFunction;
798
799template <typename R>
800class MockFunction<R()> {
801 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000802 MockFunction() {}
803
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000804 MOCK_METHOD0_T(Call, R());
zhanyong.wan32de5f52009-12-23 00:13:23 +0000805
806 private:
807 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000808};
809
810template <typename R, typename A0>
811class MockFunction<R(A0)> {
812 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000813 MockFunction() {}
814
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000815 MOCK_METHOD1_T(Call, R(A0));
zhanyong.wan32de5f52009-12-23 00:13:23 +0000816
817 private:
818 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000819};
820
821template <typename R, typename A0, typename A1>
822class MockFunction<R(A0, A1)> {
823 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000824 MockFunction() {}
825
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000826 MOCK_METHOD2_T(Call, R(A0, A1));
zhanyong.wan32de5f52009-12-23 00:13:23 +0000827
828 private:
829 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000830};
831
832template <typename R, typename A0, typename A1, typename A2>
833class MockFunction<R(A0, A1, A2)> {
834 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000835 MockFunction() {}
836
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000837 MOCK_METHOD3_T(Call, R(A0, A1, A2));
zhanyong.wan32de5f52009-12-23 00:13:23 +0000838
839 private:
840 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000841};
842
843template <typename R, typename A0, typename A1, typename A2, typename A3>
844class MockFunction<R(A0, A1, A2, A3)> {
845 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000846 MockFunction() {}
847
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000848 MOCK_METHOD4_T(Call, R(A0, A1, A2, A3));
zhanyong.wan32de5f52009-12-23 00:13:23 +0000849
850 private:
851 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000852};
853
854template <typename R, typename A0, typename A1, typename A2, typename A3,
855 typename A4>
856class MockFunction<R(A0, A1, A2, A3, A4)> {
857 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000858 MockFunction() {}
859
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000860 MOCK_METHOD5_T(Call, R(A0, A1, A2, A3, A4));
zhanyong.wan32de5f52009-12-23 00:13:23 +0000861
862 private:
863 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000864};
865
866template <typename R, typename A0, typename A1, typename A2, typename A3,
867 typename A4, typename A5>
868class MockFunction<R(A0, A1, A2, A3, A4, A5)> {
869 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000870 MockFunction() {}
871
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000872 MOCK_METHOD6_T(Call, R(A0, A1, A2, A3, A4, A5));
zhanyong.wan32de5f52009-12-23 00:13:23 +0000873
874 private:
875 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000876};
877
878template <typename R, typename A0, typename A1, typename A2, typename A3,
879 typename A4, typename A5, typename A6>
880class MockFunction<R(A0, A1, A2, A3, A4, A5, A6)> {
881 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000882 MockFunction() {}
883
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000884 MOCK_METHOD7_T(Call, R(A0, A1, A2, A3, A4, A5, A6));
zhanyong.wan32de5f52009-12-23 00:13:23 +0000885
886 private:
887 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000888};
889
890template <typename R, typename A0, typename A1, typename A2, typename A3,
891 typename A4, typename A5, typename A6, typename A7>
892class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7)> {
893 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000894 MockFunction() {}
895
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000896 MOCK_METHOD8_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7));
zhanyong.wan32de5f52009-12-23 00:13:23 +0000897
898 private:
899 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000900};
901
902template <typename R, typename A0, typename A1, typename A2, typename A3,
903 typename A4, typename A5, typename A6, typename A7, typename A8>
904class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> {
905 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000906 MockFunction() {}
907
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000908 MOCK_METHOD9_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8));
zhanyong.wan32de5f52009-12-23 00:13:23 +0000909
910 private:
911 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000912};
913
914template <typename R, typename A0, typename A1, typename A2, typename A3,
915 typename A4, typename A5, typename A6, typename A7, typename A8,
916 typename A9>
917class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
918 public:
zhanyong.wan32de5f52009-12-23 00:13:23 +0000919 MockFunction() {}
920
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000921 MOCK_METHOD10_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9));
zhanyong.wan32de5f52009-12-23 00:13:23 +0000922
923 private:
924 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFunction);
zhanyong.wanf3aa4d22009-09-25 22:34:47 +0000925};
926
shiqiane35fdd92008-12-10 05:08:54 +0000927} // namespace testing
928
929#endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_