Sacado Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gmock-function-mocker.h
Go to the documentation of this file.
1 // Copyright 2007, Google Inc.
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
6 // met:
7 //
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above
11 // copyright notice, this list of conditions and the following disclaimer
12 // in the documentation and/or other materials provided with the
13 // distribution.
14 // * Neither the name of Google Inc. nor the names of its
15 // contributors may be used to endorse or promote products derived from
16 // this software without specific prior written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 
30 // Google Mock - a framework for writing C++ mock classes.
31 //
32 // This file implements MOCK_METHOD.
33 
34 // GOOGLETEST_CM0002 DO NOT DELETE
35 
36 #ifndef THIRD_PARTY_GOOGLETEST_GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_ // NOLINT
37 #define THIRD_PARTY_GOOGLETEST_GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_ // NOLINT
38 
39 #include <type_traits> // IWYU pragma: keep
40 #include <utility> // IWYU pragma: keep
41 
45 
46 namespace testing {
47 namespace internal {
48 template <typename T>
49 using identity_t = T;
50 
51 template <typename MockType>
52 const MockType* AdjustConstness_const(const MockType* mock) {
53  return mock;
54 }
55 
56 template <typename MockType>
57 MockType* AdjustConstness_(const MockType* mock) {
58  return const_cast<MockType*>(mock);
59 }
60 
61 } // namespace internal
62 
63 // The style guide prohibits "using" statements in a namespace scope
64 // inside a header file. However, the FunctionMocker class template
65 // is meant to be defined in the ::testing namespace. The following
66 // line is just a trick for working around a bug in MSVC 8.0, which
67 // cannot handle it if we define FunctionMocker in ::testing.
68 using internal::FunctionMocker;
69 } // namespace testing
70 
71 #define MOCK_METHOD(...) \
72  GMOCK_PP_VARIADIC_CALL(GMOCK_INTERNAL_MOCK_METHOD_ARG_, __VA_ARGS__)
73 
74 #define GMOCK_INTERNAL_MOCK_METHOD_ARG_1(...) \
75  GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__)
76 
77 #define GMOCK_INTERNAL_MOCK_METHOD_ARG_2(...) \
78  GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__)
79 
80 #define GMOCK_INTERNAL_MOCK_METHOD_ARG_3(_Ret, _MethodName, _Args) \
81  GMOCK_INTERNAL_MOCK_METHOD_ARG_4(_Ret, _MethodName, _Args, ())
82 
83 #define GMOCK_INTERNAL_MOCK_METHOD_ARG_4(_Ret, _MethodName, _Args, _Spec) \
84  GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Args); \
85  GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Spec); \
86  GMOCK_INTERNAL_ASSERT_VALID_SIGNATURE( \
87  GMOCK_PP_NARG0 _Args, GMOCK_INTERNAL_SIGNATURE(_Ret, _Args)); \
88  GMOCK_INTERNAL_ASSERT_VALID_SPEC(_Spec) \
89  GMOCK_INTERNAL_MOCK_METHOD_IMPL( \
90  GMOCK_PP_NARG0 _Args, _MethodName, GMOCK_INTERNAL_HAS_CONST(_Spec), \
91  GMOCK_INTERNAL_HAS_OVERRIDE(_Spec), GMOCK_INTERNAL_HAS_FINAL(_Spec), \
92  GMOCK_INTERNAL_GET_NOEXCEPT_SPEC(_Spec), \
93  GMOCK_INTERNAL_GET_CALLTYPE(_Spec), \
94  (GMOCK_INTERNAL_SIGNATURE(_Ret, _Args)))
95 
96 #define GMOCK_INTERNAL_MOCK_METHOD_ARG_5(...) \
97  GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__)
98 
99 #define GMOCK_INTERNAL_MOCK_METHOD_ARG_6(...) \
100  GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__)
101 
102 #define GMOCK_INTERNAL_MOCK_METHOD_ARG_7(...) \
103  GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__)
104 
105 #define GMOCK_INTERNAL_WRONG_ARITY(...) \
106  static_assert( \
107  false, \
108  "MOCK_METHOD must be called with 3 or 4 arguments. _Ret, " \
109  "_MethodName, _Args and optionally _Spec. _Args and _Spec must be " \
110  "enclosed in parentheses. If _Ret is a type with unprotected commas, " \
111  "it must also be enclosed in parentheses.")
112 
113 #define GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Tuple) \
114  static_assert( \
115  GMOCK_PP_IS_ENCLOSED_PARENS(_Tuple), \
116  GMOCK_PP_STRINGIZE(_Tuple) " should be enclosed in parentheses.")
117 
118 #define GMOCK_INTERNAL_ASSERT_VALID_SIGNATURE(_N, ...) \
119  static_assert( \
120  std::is_function<__VA_ARGS__>::value, \
121  "Signature must be a function type, maybe return type contains " \
122  "unprotected comma."); \
123  static_assert( \
124  ::testing::tuple_size<typename ::testing::internal::Function< \
125  __VA_ARGS__>::ArgumentTuple>::value == _N, \
126  "This method does not take " GMOCK_PP_STRINGIZE( \
127  _N) " arguments. Parenthesize all types with unproctected commas.")
128 
129 #define GMOCK_INTERNAL_ASSERT_VALID_SPEC(_Spec) \
130  GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_ASSERT_VALID_SPEC_ELEMENT, ~, _Spec)
131 
132 #define GMOCK_INTERNAL_MOCK_METHOD_IMPL(_N, _MethodName, _Constness, \
133  _Override, _Final, _NoexceptSpec, \
134  _CallType, _Signature) \
135  typename ::testing::internal::Function<GMOCK_PP_REMOVE_PARENS( \
136  _Signature)>::Result \
137  GMOCK_INTERNAL_EXPAND(_CallType) \
138  _MethodName(GMOCK_PP_REPEAT(GMOCK_INTERNAL_PARAMETER, _Signature, _N)) \
139  GMOCK_PP_IF(_Constness, const, ) _NoexceptSpec \
140  GMOCK_PP_IF(_Override, override, ) GMOCK_PP_IF(_Final, final, ) { \
141  GMOCK_MOCKER_(_N, _Constness, _MethodName) \
142  .SetOwnerAndName(this, #_MethodName); \
143  return GMOCK_MOCKER_(_N, _Constness, _MethodName) \
144  .Invoke(GMOCK_PP_REPEAT(GMOCK_INTERNAL_FORWARD_ARG, _Signature, _N)); \
145  } \
146  ::testing::MockSpec<GMOCK_PP_REMOVE_PARENS(_Signature)> gmock_##_MethodName( \
147  GMOCK_PP_REPEAT(GMOCK_INTERNAL_MATCHER_PARAMETER, _Signature, _N)) \
148  GMOCK_PP_IF(_Constness, const, ) { \
149  GMOCK_MOCKER_(_N, _Constness, _MethodName).RegisterOwner(this); \
150  return GMOCK_MOCKER_(_N, _Constness, _MethodName) \
151  .With(GMOCK_PP_REPEAT(GMOCK_INTERNAL_MATCHER_ARGUMENT, , _N)); \
152  } \
153  ::testing::MockSpec<GMOCK_PP_REMOVE_PARENS(_Signature)> gmock_##_MethodName( \
154  const ::testing::internal::WithoutMatchers&, \
155  GMOCK_PP_IF(_Constness, const, )::testing::internal::Function< \
156  GMOCK_PP_REMOVE_PARENS(_Signature)>*) const _NoexceptSpec { \
157  return GMOCK_PP_CAT(::testing::internal::AdjustConstness_, \
158  GMOCK_PP_IF(_Constness, const, ))(this) \
159  ->gmock_##_MethodName(GMOCK_PP_REPEAT( \
160  GMOCK_INTERNAL_A_MATCHER_ARGUMENT, _Signature, _N)); \
161  } \
162  mutable ::testing::FunctionMocker<GMOCK_PP_REMOVE_PARENS(_Signature)> \
163  GMOCK_MOCKER_(_N, _Constness, _MethodName)
164 
165 #define GMOCK_INTERNAL_EXPAND(...) __VA_ARGS__
166 
167 // Five Valid modifiers.
168 #define GMOCK_INTERNAL_HAS_CONST(_Tuple) \
169  GMOCK_PP_HAS_COMMA(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_CONST, ~, _Tuple))
170 
171 #define GMOCK_INTERNAL_HAS_OVERRIDE(_Tuple) \
172  GMOCK_PP_HAS_COMMA( \
173  GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_OVERRIDE, ~, _Tuple))
174 
175 #define GMOCK_INTERNAL_HAS_FINAL(_Tuple) \
176  GMOCK_PP_HAS_COMMA(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_FINAL, ~, _Tuple))
177 
178 #define GMOCK_INTERNAL_GET_NOEXCEPT_SPEC(_Tuple) \
179  GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_NOEXCEPT_SPEC_IF_NOEXCEPT, ~, _Tuple)
180 
181 #define GMOCK_INTERNAL_NOEXCEPT_SPEC_IF_NOEXCEPT(_i, _, _elem) \
182  GMOCK_PP_IF( \
183  GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_NOEXCEPT(_i, _, _elem)), \
184  _elem, )
185 
186 #define GMOCK_INTERNAL_GET_CALLTYPE(_Tuple) \
187  GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_GET_CALLTYPE_IMPL, ~, _Tuple)
188 
189 #define GMOCK_INTERNAL_ASSERT_VALID_SPEC_ELEMENT(_i, _, _elem) \
190  static_assert( \
191  (GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_CONST(_i, _, _elem)) + \
192  GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_OVERRIDE(_i, _, _elem)) + \
193  GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_FINAL(_i, _, _elem)) + \
194  GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_NOEXCEPT(_i, _, _elem)) + \
195  GMOCK_INTERNAL_IS_CALLTYPE(_elem)) == 1, \
196  GMOCK_PP_STRINGIZE( \
197  _elem) " cannot be recognized as a valid specification modifier.");
198 
199 // Modifiers implementation.
200 #define GMOCK_INTERNAL_DETECT_CONST(_i, _, _elem) \
201  GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_CONST_I_, _elem)
202 
203 #define GMOCK_INTERNAL_DETECT_CONST_I_const ,
204 
205 #define GMOCK_INTERNAL_DETECT_OVERRIDE(_i, _, _elem) \
206  GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_OVERRIDE_I_, _elem)
207 
208 #define GMOCK_INTERNAL_DETECT_OVERRIDE_I_override ,
209 
210 #define GMOCK_INTERNAL_DETECT_FINAL(_i, _, _elem) \
211  GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_FINAL_I_, _elem)
212 
213 #define GMOCK_INTERNAL_DETECT_FINAL_I_final ,
214 
215 #define GMOCK_INTERNAL_DETECT_NOEXCEPT(_i, _, _elem) \
216  GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_NOEXCEPT_I_, _elem)
217 
218 #define GMOCK_INTERNAL_DETECT_NOEXCEPT_I_noexcept ,
219 
220 #define GMOCK_INTERNAL_GET_CALLTYPE_IMPL(_i, _, _elem) \
221  GMOCK_PP_IF(GMOCK_INTERNAL_IS_CALLTYPE(_elem), \
222  GMOCK_INTERNAL_GET_VALUE_CALLTYPE, GMOCK_PP_EMPTY) \
223  (_elem)
224 
225 // TODO(iserna): GMOCK_INTERNAL_IS_CALLTYPE and
226 // GMOCK_INTERNAL_GET_VALUE_CALLTYPE needed more expansions to work on windows
227 // maybe they can be simplified somehow.
228 #define GMOCK_INTERNAL_IS_CALLTYPE(_arg) \
229  GMOCK_INTERNAL_IS_CALLTYPE_I( \
230  GMOCK_PP_CAT(GMOCK_INTERNAL_IS_CALLTYPE_HELPER_, _arg))
231 #define GMOCK_INTERNAL_IS_CALLTYPE_I(_arg) GMOCK_PP_IS_ENCLOSED_PARENS(_arg)
232 
233 #define GMOCK_INTERNAL_GET_VALUE_CALLTYPE(_arg) \
234  GMOCK_INTERNAL_GET_VALUE_CALLTYPE_I( \
235  GMOCK_PP_CAT(GMOCK_INTERNAL_IS_CALLTYPE_HELPER_, _arg))
236 #define GMOCK_INTERNAL_GET_VALUE_CALLTYPE_I(_arg) \
237  GMOCK_PP_IDENTITY _arg
238 
239 #define GMOCK_INTERNAL_IS_CALLTYPE_HELPER_Calltype
240 
241 // Note: The use of `identity_t` here allows _Ret to represent return types that
242 // would normally need to be specified in a different way. For example, a method
243 // returning a function pointer must be written as
244 //
245 // fn_ptr_return_t (*method(method_args_t...))(fn_ptr_args_t...)
246 //
247 // But we only support placing the return type at the beginning. To handle this,
248 // we wrap all calls in identity_t, so that a declaration will be expanded to
249 //
250 // identity_t<fn_ptr_return_t (*)(fn_ptr_args_t...)> method(method_args_t...)
251 //
252 // This allows us to work around the syntactic oddities of function/method
253 // types.
254 #define GMOCK_INTERNAL_SIGNATURE(_Ret, _Args) \
255  ::testing::internal::identity_t<GMOCK_PP_IF(GMOCK_PP_IS_BEGIN_PARENS(_Ret), \
256  GMOCK_PP_REMOVE_PARENS, \
257  GMOCK_PP_IDENTITY)(_Ret)>( \
258  GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_GET_TYPE, _, _Args))
259 
260 #define GMOCK_INTERNAL_GET_TYPE(_i, _, _elem) \
261  GMOCK_PP_COMMA_IF(_i) \
262  GMOCK_PP_IF(GMOCK_PP_IS_BEGIN_PARENS(_elem), GMOCK_PP_REMOVE_PARENS, \
263  GMOCK_PP_IDENTITY) \
264  (_elem)
265 
266 #define GMOCK_INTERNAL_PARAMETER(_i, _Signature, _) \
267  GMOCK_PP_COMMA_IF(_i) \
268  GMOCK_INTERNAL_ARG_O(_i, GMOCK_PP_REMOVE_PARENS(_Signature)) \
269  gmock_a##_i
270 
271 #define GMOCK_INTERNAL_FORWARD_ARG(_i, _Signature, _) \
272  GMOCK_PP_COMMA_IF(_i) \
273  ::std::forward<GMOCK_INTERNAL_ARG_O( \
274  _i, GMOCK_PP_REMOVE_PARENS(_Signature))>(gmock_a##_i)
275 
276 #define GMOCK_INTERNAL_MATCHER_PARAMETER(_i, _Signature, _) \
277  GMOCK_PP_COMMA_IF(_i) \
278  GMOCK_INTERNAL_MATCHER_O(_i, GMOCK_PP_REMOVE_PARENS(_Signature)) \
279  gmock_a##_i
280 
281 #define GMOCK_INTERNAL_MATCHER_ARGUMENT(_i, _1, _2) \
282  GMOCK_PP_COMMA_IF(_i) \
283  gmock_a##_i
284 
285 #define GMOCK_INTERNAL_A_MATCHER_ARGUMENT(_i, _Signature, _) \
286  GMOCK_PP_COMMA_IF(_i) \
287  ::testing::A<GMOCK_INTERNAL_ARG_O(_i, GMOCK_PP_REMOVE_PARENS(_Signature))>()
288 
289 #define GMOCK_INTERNAL_ARG_O(_i, ...) \
290  typename ::testing::internal::Function<__VA_ARGS__>::template Arg<_i>::type
291 
292 #define GMOCK_INTERNAL_MATCHER_O(_i, ...) \
293  const ::testing::Matcher<typename ::testing::internal::Function< \
294  __VA_ARGS__>::template Arg<_i>::type>&
295 
296 #define MOCK_METHOD0(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 0, __VA_ARGS__)
297 #define MOCK_METHOD1(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 1, __VA_ARGS__)
298 #define MOCK_METHOD2(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 2, __VA_ARGS__)
299 #define MOCK_METHOD3(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 3, __VA_ARGS__)
300 #define MOCK_METHOD4(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 4, __VA_ARGS__)
301 #define MOCK_METHOD5(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 5, __VA_ARGS__)
302 #define MOCK_METHOD6(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 6, __VA_ARGS__)
303 #define MOCK_METHOD7(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 7, __VA_ARGS__)
304 #define MOCK_METHOD8(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 8, __VA_ARGS__)
305 #define MOCK_METHOD9(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 9, __VA_ARGS__)
306 #define MOCK_METHOD10(m, ...) \
307  GMOCK_INTERNAL_MOCK_METHODN(, , m, 10, __VA_ARGS__)
308 
309 #define MOCK_CONST_METHOD0(m, ...) \
310  GMOCK_INTERNAL_MOCK_METHODN(const, , m, 0, __VA_ARGS__)
311 #define MOCK_CONST_METHOD1(m, ...) \
312  GMOCK_INTERNAL_MOCK_METHODN(const, , m, 1, __VA_ARGS__)
313 #define MOCK_CONST_METHOD2(m, ...) \
314  GMOCK_INTERNAL_MOCK_METHODN(const, , m, 2, __VA_ARGS__)
315 #define MOCK_CONST_METHOD3(m, ...) \
316  GMOCK_INTERNAL_MOCK_METHODN(const, , m, 3, __VA_ARGS__)
317 #define MOCK_CONST_METHOD4(m, ...) \
318  GMOCK_INTERNAL_MOCK_METHODN(const, , m, 4, __VA_ARGS__)
319 #define MOCK_CONST_METHOD5(m, ...) \
320  GMOCK_INTERNAL_MOCK_METHODN(const, , m, 5, __VA_ARGS__)
321 #define MOCK_CONST_METHOD6(m, ...) \
322  GMOCK_INTERNAL_MOCK_METHODN(const, , m, 6, __VA_ARGS__)
323 #define MOCK_CONST_METHOD7(m, ...) \
324  GMOCK_INTERNAL_MOCK_METHODN(const, , m, 7, __VA_ARGS__)
325 #define MOCK_CONST_METHOD8(m, ...) \
326  GMOCK_INTERNAL_MOCK_METHODN(const, , m, 8, __VA_ARGS__)
327 #define MOCK_CONST_METHOD9(m, ...) \
328  GMOCK_INTERNAL_MOCK_METHODN(const, , m, 9, __VA_ARGS__)
329 #define MOCK_CONST_METHOD10(m, ...) \
330  GMOCK_INTERNAL_MOCK_METHODN(const, , m, 10, __VA_ARGS__)
331 
332 #define MOCK_METHOD0_T(m, ...) MOCK_METHOD0(m, __VA_ARGS__)
333 #define MOCK_METHOD1_T(m, ...) MOCK_METHOD1(m, __VA_ARGS__)
334 #define MOCK_METHOD2_T(m, ...) MOCK_METHOD2(m, __VA_ARGS__)
335 #define MOCK_METHOD3_T(m, ...) MOCK_METHOD3(m, __VA_ARGS__)
336 #define MOCK_METHOD4_T(m, ...) MOCK_METHOD4(m, __VA_ARGS__)
337 #define MOCK_METHOD5_T(m, ...) MOCK_METHOD5(m, __VA_ARGS__)
338 #define MOCK_METHOD6_T(m, ...) MOCK_METHOD6(m, __VA_ARGS__)
339 #define MOCK_METHOD7_T(m, ...) MOCK_METHOD7(m, __VA_ARGS__)
340 #define MOCK_METHOD8_T(m, ...) MOCK_METHOD8(m, __VA_ARGS__)
341 #define MOCK_METHOD9_T(m, ...) MOCK_METHOD9(m, __VA_ARGS__)
342 #define MOCK_METHOD10_T(m, ...) MOCK_METHOD10(m, __VA_ARGS__)
343 
344 #define MOCK_CONST_METHOD0_T(m, ...) MOCK_CONST_METHOD0(m, __VA_ARGS__)
345 #define MOCK_CONST_METHOD1_T(m, ...) MOCK_CONST_METHOD1(m, __VA_ARGS__)
346 #define MOCK_CONST_METHOD2_T(m, ...) MOCK_CONST_METHOD2(m, __VA_ARGS__)
347 #define MOCK_CONST_METHOD3_T(m, ...) MOCK_CONST_METHOD3(m, __VA_ARGS__)
348 #define MOCK_CONST_METHOD4_T(m, ...) MOCK_CONST_METHOD4(m, __VA_ARGS__)
349 #define MOCK_CONST_METHOD5_T(m, ...) MOCK_CONST_METHOD5(m, __VA_ARGS__)
350 #define MOCK_CONST_METHOD6_T(m, ...) MOCK_CONST_METHOD6(m, __VA_ARGS__)
351 #define MOCK_CONST_METHOD7_T(m, ...) MOCK_CONST_METHOD7(m, __VA_ARGS__)
352 #define MOCK_CONST_METHOD8_T(m, ...) MOCK_CONST_METHOD8(m, __VA_ARGS__)
353 #define MOCK_CONST_METHOD9_T(m, ...) MOCK_CONST_METHOD9(m, __VA_ARGS__)
354 #define MOCK_CONST_METHOD10_T(m, ...) MOCK_CONST_METHOD10(m, __VA_ARGS__)
355 
356 #define MOCK_METHOD0_WITH_CALLTYPE(ct, m, ...) \
357  GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 0, __VA_ARGS__)
358 #define MOCK_METHOD1_WITH_CALLTYPE(ct, m, ...) \
359  GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 1, __VA_ARGS__)
360 #define MOCK_METHOD2_WITH_CALLTYPE(ct, m, ...) \
361  GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 2, __VA_ARGS__)
362 #define MOCK_METHOD3_WITH_CALLTYPE(ct, m, ...) \
363  GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 3, __VA_ARGS__)
364 #define MOCK_METHOD4_WITH_CALLTYPE(ct, m, ...) \
365  GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 4, __VA_ARGS__)
366 #define MOCK_METHOD5_WITH_CALLTYPE(ct, m, ...) \
367  GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 5, __VA_ARGS__)
368 #define MOCK_METHOD6_WITH_CALLTYPE(ct, m, ...) \
369  GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 6, __VA_ARGS__)
370 #define MOCK_METHOD7_WITH_CALLTYPE(ct, m, ...) \
371  GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 7, __VA_ARGS__)
372 #define MOCK_METHOD8_WITH_CALLTYPE(ct, m, ...) \
373  GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 8, __VA_ARGS__)
374 #define MOCK_METHOD9_WITH_CALLTYPE(ct, m, ...) \
375  GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 9, __VA_ARGS__)
376 #define MOCK_METHOD10_WITH_CALLTYPE(ct, m, ...) \
377  GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 10, __VA_ARGS__)
378 
379 #define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, ...) \
380  GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 0, __VA_ARGS__)
381 #define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, ...) \
382  GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 1, __VA_ARGS__)
383 #define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, ...) \
384  GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 2, __VA_ARGS__)
385 #define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, ...) \
386  GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 3, __VA_ARGS__)
387 #define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, ...) \
388  GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 4, __VA_ARGS__)
389 #define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, ...) \
390  GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 5, __VA_ARGS__)
391 #define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, ...) \
392  GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 6, __VA_ARGS__)
393 #define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, ...) \
394  GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 7, __VA_ARGS__)
395 #define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, ...) \
396  GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 8, __VA_ARGS__)
397 #define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, ...) \
398  GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 9, __VA_ARGS__)
399 #define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, ...) \
400  GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 10, __VA_ARGS__)
401 
402 #define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
403  MOCK_METHOD0_WITH_CALLTYPE(ct, m, __VA_ARGS__)
404 #define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
405  MOCK_METHOD1_WITH_CALLTYPE(ct, m, __VA_ARGS__)
406 #define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
407  MOCK_METHOD2_WITH_CALLTYPE(ct, m, __VA_ARGS__)
408 #define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
409  MOCK_METHOD3_WITH_CALLTYPE(ct, m, __VA_ARGS__)
410 #define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
411  MOCK_METHOD4_WITH_CALLTYPE(ct, m, __VA_ARGS__)
412 #define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
413  MOCK_METHOD5_WITH_CALLTYPE(ct, m, __VA_ARGS__)
414 #define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
415  MOCK_METHOD6_WITH_CALLTYPE(ct, m, __VA_ARGS__)
416 #define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
417  MOCK_METHOD7_WITH_CALLTYPE(ct, m, __VA_ARGS__)
418 #define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
419  MOCK_METHOD8_WITH_CALLTYPE(ct, m, __VA_ARGS__)
420 #define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
421  MOCK_METHOD9_WITH_CALLTYPE(ct, m, __VA_ARGS__)
422 #define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
423  MOCK_METHOD10_WITH_CALLTYPE(ct, m, __VA_ARGS__)
424 
425 #define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
426  MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, __VA_ARGS__)
427 #define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
428  MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, __VA_ARGS__)
429 #define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
430  MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, __VA_ARGS__)
431 #define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
432  MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, __VA_ARGS__)
433 #define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
434  MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, __VA_ARGS__)
435 #define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
436  MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, __VA_ARGS__)
437 #define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
438  MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, __VA_ARGS__)
439 #define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
440  MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, __VA_ARGS__)
441 #define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
442  MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, __VA_ARGS__)
443 #define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
444  MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, __VA_ARGS__)
445 #define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
446  MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, __VA_ARGS__)
447 
448 #define GMOCK_INTERNAL_MOCK_METHODN(constness, ct, Method, args_num, ...) \
449  GMOCK_INTERNAL_ASSERT_VALID_SIGNATURE( \
450  args_num, ::testing::internal::identity_t<__VA_ARGS__>); \
451  GMOCK_INTERNAL_MOCK_METHOD_IMPL( \
452  args_num, Method, GMOCK_PP_NARG0(constness), 0, 0, , ct, \
453  (::testing::internal::identity_t<__VA_ARGS__>))
454 
455 #define GMOCK_MOCKER_(arity, constness, Method) \
456  GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__)
457 
458 #endif // THIRD_PARTY_GOOGLETEST_GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_
const MockType * AdjustConstness_const(const MockType *mock)
#define T
Definition: Sacado_rad.hpp:553
MockType * AdjustConstness_(const MockType *mock)