36 #ifndef GOOGLETEST_GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_
37 #define GOOGLETEST_GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_FUNCTION_MOCKER_H_
39 #include <type_traits>
42 #include "gmock/gmock-spec-builders.h"
43 #include "gmock/internal/gmock-internal-utils.h"
44 #include "gmock/internal/gmock-pp.h"
51 template <
typename Pattern>
52 struct ThisRefAdjuster {
54 using AdjustT =
typename std::conditional<
55 std::is_const<typename std::remove_reference<Pattern>::type>::value,
56 typename std::conditional<std::is_lvalue_reference<Pattern>::value,
57 const T&,
const T&&>::type,
58 typename std::conditional<std::is_lvalue_reference<Pattern>::value, T&,
61 template <
typename MockType>
74 using internal::FunctionMocker;
77 #define MOCK_METHOD(...) \
78 GMOCK_PP_VARIADIC_CALL(GMOCK_INTERNAL_MOCK_METHOD_ARG_, __VA_ARGS__)
80 #define GMOCK_INTERNAL_MOCK_METHOD_ARG_1(...) \
81 GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__)
83 #define GMOCK_INTERNAL_MOCK_METHOD_ARG_2(...) \
84 GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__)
86 #define GMOCK_INTERNAL_MOCK_METHOD_ARG_3(_Ret, _MethodName, _Args) \
87 GMOCK_INTERNAL_MOCK_METHOD_ARG_4(_Ret, _MethodName, _Args, ())
89 #define GMOCK_INTERNAL_MOCK_METHOD_ARG_4(_Ret, _MethodName, _Args, _Spec) \
90 GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Args); \
91 GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Spec); \
92 GMOCK_INTERNAL_ASSERT_VALID_SIGNATURE( \
93 GMOCK_PP_NARG0 _Args, GMOCK_INTERNAL_SIGNATURE(_Ret, _Args)); \
94 GMOCK_INTERNAL_ASSERT_VALID_SPEC(_Spec) \
95 GMOCK_INTERNAL_MOCK_METHOD_IMPL( \
96 GMOCK_PP_NARG0 _Args, _MethodName, GMOCK_INTERNAL_HAS_CONST(_Spec), \
97 GMOCK_INTERNAL_HAS_OVERRIDE(_Spec), GMOCK_INTERNAL_HAS_FINAL(_Spec), \
98 GMOCK_INTERNAL_GET_NOEXCEPT_SPEC(_Spec), \
99 GMOCK_INTERNAL_GET_CALLTYPE(_Spec), GMOCK_INTERNAL_GET_REF_SPEC(_Spec), \
100 (GMOCK_INTERNAL_SIGNATURE(_Ret, _Args)))
102 #define GMOCK_INTERNAL_MOCK_METHOD_ARG_5(...) \
103 GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__)
105 #define GMOCK_INTERNAL_MOCK_METHOD_ARG_6(...) \
106 GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__)
108 #define GMOCK_INTERNAL_MOCK_METHOD_ARG_7(...) \
109 GMOCK_INTERNAL_WRONG_ARITY(__VA_ARGS__)
111 #define GMOCK_INTERNAL_WRONG_ARITY(...) \
114 "MOCK_METHOD must be called with 3 or 4 arguments. _Ret, " \
115 "_MethodName, _Args and optionally _Spec. _Args and _Spec must be " \
116 "enclosed in parentheses. If _Ret is a type with unprotected commas, " \
117 "it must also be enclosed in parentheses.")
119 #define GMOCK_INTERNAL_ASSERT_PARENTHESIS(_Tuple) \
121 GMOCK_PP_IS_ENCLOSED_PARENS(_Tuple), \
122 GMOCK_PP_STRINGIZE(_Tuple) " should be enclosed in parentheses.")
124 #define GMOCK_INTERNAL_ASSERT_VALID_SIGNATURE(_N, ...) \
126 std::is_function<__VA_ARGS__>::value, \
127 "Signature must be a function type, maybe return type contains " \
128 "unprotected comma."); \
130 ::testing::tuple_size<typename ::testing::internal::Function< \
131 __VA_ARGS__>::ArgumentTuple>::value == _N, \
132 "This method does not take " GMOCK_PP_STRINGIZE( \
133 _N) " arguments. Parenthesize all types with unprotected commas.")
135 #define GMOCK_INTERNAL_ASSERT_VALID_SPEC(_Spec) \
136 GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_ASSERT_VALID_SPEC_ELEMENT, ~, _Spec)
138 #define GMOCK_INTERNAL_MOCK_METHOD_IMPL(_N, _MethodName, _Constness, \
139 _Override, _Final, _NoexceptSpec, \
140 _CallType, _RefSpec, _Signature) \
141 typename ::testing::internal::Function<GMOCK_PP_REMOVE_PARENS( \
142 _Signature)>::Result \
143 GMOCK_INTERNAL_EXPAND(_CallType) \
144 _MethodName(GMOCK_PP_REPEAT(GMOCK_INTERNAL_PARAMETER, _Signature, _N)) \
145 GMOCK_PP_IF(_Constness, const, ) _RefSpec _NoexceptSpec \
146 GMOCK_PP_IF(_Override, override, ) GMOCK_PP_IF(_Final, final, ) { \
147 GMOCK_MOCKER_(_N, _Constness, _MethodName) \
148 .SetOwnerAndName(this, #_MethodName); \
149 return GMOCK_MOCKER_(_N, _Constness, _MethodName) \
150 .Invoke(GMOCK_PP_REPEAT(GMOCK_INTERNAL_FORWARD_ARG, _Signature, _N)); \
152 ::testing::MockSpec<GMOCK_PP_REMOVE_PARENS(_Signature)> gmock_##_MethodName( \
153 GMOCK_PP_REPEAT(GMOCK_INTERNAL_MATCHER_PARAMETER, _Signature, _N)) \
154 GMOCK_PP_IF(_Constness, const, ) _RefSpec { \
155 GMOCK_MOCKER_(_N, _Constness, _MethodName).RegisterOwner(this); \
156 return GMOCK_MOCKER_(_N, _Constness, _MethodName) \
157 .With(GMOCK_PP_REPEAT(GMOCK_INTERNAL_MATCHER_ARGUMENT, , _N)); \
159 ::testing::MockSpec<GMOCK_PP_REMOVE_PARENS(_Signature)> gmock_##_MethodName( \
160 const ::testing::internal::WithoutMatchers&, \
161 GMOCK_PP_IF(_Constness, const, )::testing::internal::Function< \
162 GMOCK_PP_REMOVE_PARENS(_Signature)>*) const _RefSpec _NoexceptSpec { \
163 return ::testing::internal::ThisRefAdjuster<GMOCK_PP_IF( \
164 _Constness, const, ) int _RefSpec>::Adjust(*this) \
165 .gmock_##_MethodName(GMOCK_PP_REPEAT( \
166 GMOCK_INTERNAL_A_MATCHER_ARGUMENT, _Signature, _N)); \
168 mutable ::testing::FunctionMocker<GMOCK_PP_REMOVE_PARENS(_Signature)> \
169 GMOCK_MOCKER_(_N, _Constness, _MethodName)
171 #define GMOCK_INTERNAL_EXPAND(...) __VA_ARGS__
174 #define GMOCK_INTERNAL_HAS_CONST(_Tuple) \
175 GMOCK_PP_HAS_COMMA(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_CONST, ~, _Tuple))
177 #define GMOCK_INTERNAL_HAS_OVERRIDE(_Tuple) \
178 GMOCK_PP_HAS_COMMA( \
179 GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_OVERRIDE, ~, _Tuple))
181 #define GMOCK_INTERNAL_HAS_FINAL(_Tuple) \
182 GMOCK_PP_HAS_COMMA(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_DETECT_FINAL, ~, _Tuple))
184 #define GMOCK_INTERNAL_GET_NOEXCEPT_SPEC(_Tuple) \
185 GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_NOEXCEPT_SPEC_IF_NOEXCEPT, ~, _Tuple)
187 #define GMOCK_INTERNAL_NOEXCEPT_SPEC_IF_NOEXCEPT(_i, _, _elem) \
189 GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_NOEXCEPT(_i, _, _elem)), \
192 #define GMOCK_INTERNAL_GET_REF_SPEC(_Tuple) \
193 GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_REF_SPEC_IF_REF, ~, _Tuple)
195 #define GMOCK_INTERNAL_REF_SPEC_IF_REF(_i, _, _elem) \
196 GMOCK_PP_IF(GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_REF(_i, _, _elem)), \
197 GMOCK_PP_CAT(GMOCK_INTERNAL_UNPACK_, _elem), )
199 #define GMOCK_INTERNAL_GET_CALLTYPE(_Tuple) \
200 GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_GET_CALLTYPE_IMPL, ~, _Tuple)
202 #define GMOCK_INTERNAL_ASSERT_VALID_SPEC_ELEMENT(_i, _, _elem) \
204 (GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_CONST(_i, _, _elem)) + \
205 GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_OVERRIDE(_i, _, _elem)) + \
206 GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_FINAL(_i, _, _elem)) + \
207 GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_NOEXCEPT(_i, _, _elem)) + \
208 GMOCK_PP_HAS_COMMA(GMOCK_INTERNAL_DETECT_REF(_i, _, _elem)) + \
209 GMOCK_INTERNAL_IS_CALLTYPE(_elem)) == 1, \
210 GMOCK_PP_STRINGIZE( \
211 _elem) " cannot be recognized as a valid specification modifier.");
214 #define GMOCK_INTERNAL_DETECT_CONST(_i, _, _elem) \
215 GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_CONST_I_, _elem)
217 #define GMOCK_INTERNAL_DETECT_CONST_I_const ,
219 #define GMOCK_INTERNAL_DETECT_OVERRIDE(_i, _, _elem) \
220 GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_OVERRIDE_I_, _elem)
222 #define GMOCK_INTERNAL_DETECT_OVERRIDE_I_override ,
224 #define GMOCK_INTERNAL_DETECT_FINAL(_i, _, _elem) \
225 GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_FINAL_I_, _elem)
227 #define GMOCK_INTERNAL_DETECT_FINAL_I_final ,
229 #define GMOCK_INTERNAL_DETECT_NOEXCEPT(_i, _, _elem) \
230 GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_NOEXCEPT_I_, _elem)
232 #define GMOCK_INTERNAL_DETECT_NOEXCEPT_I_noexcept ,
234 #define GMOCK_INTERNAL_DETECT_REF(_i, _, _elem) \
235 GMOCK_PP_CAT(GMOCK_INTERNAL_DETECT_REF_I_, _elem)
237 #define GMOCK_INTERNAL_DETECT_REF_I_ref ,
239 #define GMOCK_INTERNAL_UNPACK_ref(x) x
241 #define GMOCK_INTERNAL_GET_CALLTYPE_IMPL(_i, _, _elem) \
242 GMOCK_PP_IF(GMOCK_INTERNAL_IS_CALLTYPE(_elem), \
243 GMOCK_INTERNAL_GET_VALUE_CALLTYPE, GMOCK_PP_EMPTY) \
249 #define GMOCK_INTERNAL_IS_CALLTYPE(_arg) \
250 GMOCK_INTERNAL_IS_CALLTYPE_I( \
251 GMOCK_PP_CAT(GMOCK_INTERNAL_IS_CALLTYPE_HELPER_, _arg))
252 #define GMOCK_INTERNAL_IS_CALLTYPE_I(_arg) GMOCK_PP_IS_ENCLOSED_PARENS(_arg)
254 #define GMOCK_INTERNAL_GET_VALUE_CALLTYPE(_arg) \
255 GMOCK_INTERNAL_GET_VALUE_CALLTYPE_I( \
256 GMOCK_PP_CAT(GMOCK_INTERNAL_IS_CALLTYPE_HELPER_, _arg))
257 #define GMOCK_INTERNAL_GET_VALUE_CALLTYPE_I(_arg) \
258 GMOCK_PP_IDENTITY _arg
260 #define GMOCK_INTERNAL_IS_CALLTYPE_HELPER_Calltype
275 #define GMOCK_INTERNAL_SIGNATURE(_Ret, _Args) \
276 ::testing::internal::identity_t<GMOCK_PP_IF(GMOCK_PP_IS_BEGIN_PARENS(_Ret), \
277 GMOCK_PP_REMOVE_PARENS, \
278 GMOCK_PP_IDENTITY)(_Ret)>( \
279 GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_GET_TYPE, _, _Args))
281 #define GMOCK_INTERNAL_GET_TYPE(_i, _, _elem) \
282 GMOCK_PP_COMMA_IF(_i) \
283 GMOCK_PP_IF(GMOCK_PP_IS_BEGIN_PARENS(_elem), GMOCK_PP_REMOVE_PARENS, \
287 #define GMOCK_INTERNAL_PARAMETER(_i, _Signature, _) \
288 GMOCK_PP_COMMA_IF(_i) \
289 GMOCK_INTERNAL_ARG_O(_i, GMOCK_PP_REMOVE_PARENS(_Signature)) \
292 #define GMOCK_INTERNAL_FORWARD_ARG(_i, _Signature, _) \
293 GMOCK_PP_COMMA_IF(_i) \
294 ::std::forward<GMOCK_INTERNAL_ARG_O( \
295 _i, GMOCK_PP_REMOVE_PARENS(_Signature))>(gmock_a##_i)
297 #define GMOCK_INTERNAL_MATCHER_PARAMETER(_i, _Signature, _) \
298 GMOCK_PP_COMMA_IF(_i) \
299 GMOCK_INTERNAL_MATCHER_O(_i, GMOCK_PP_REMOVE_PARENS(_Signature)) \
302 #define GMOCK_INTERNAL_MATCHER_ARGUMENT(_i, _1, _2) \
303 GMOCK_PP_COMMA_IF(_i) \
306 #define GMOCK_INTERNAL_A_MATCHER_ARGUMENT(_i, _Signature, _) \
307 GMOCK_PP_COMMA_IF(_i) \
308 ::testing::A<GMOCK_INTERNAL_ARG_O(_i, GMOCK_PP_REMOVE_PARENS(_Signature))>()
310 #define GMOCK_INTERNAL_ARG_O(_i, ...) \
311 typename ::testing::internal::Function<__VA_ARGS__>::template Arg<_i>::type
313 #define GMOCK_INTERNAL_MATCHER_O(_i, ...) \
314 const ::testing::Matcher<typename ::testing::internal::Function< \
315 __VA_ARGS__>::template Arg<_i>::type>&
317 #define MOCK_METHOD0(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 0, __VA_ARGS__)
318 #define MOCK_METHOD1(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 1, __VA_ARGS__)
319 #define MOCK_METHOD2(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 2, __VA_ARGS__)
320 #define MOCK_METHOD3(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 3, __VA_ARGS__)
321 #define MOCK_METHOD4(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 4, __VA_ARGS__)
322 #define MOCK_METHOD5(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 5, __VA_ARGS__)
323 #define MOCK_METHOD6(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 6, __VA_ARGS__)
324 #define MOCK_METHOD7(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 7, __VA_ARGS__)
325 #define MOCK_METHOD8(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 8, __VA_ARGS__)
326 #define MOCK_METHOD9(m, ...) GMOCK_INTERNAL_MOCK_METHODN(, , m, 9, __VA_ARGS__)
327 #define MOCK_METHOD10(m, ...) \
328 GMOCK_INTERNAL_MOCK_METHODN(, , m, 10, __VA_ARGS__)
330 #define MOCK_CONST_METHOD0(m, ...) \
331 GMOCK_INTERNAL_MOCK_METHODN(const, , m, 0, __VA_ARGS__)
332 #define MOCK_CONST_METHOD1(m, ...) \
333 GMOCK_INTERNAL_MOCK_METHODN(const, , m, 1, __VA_ARGS__)
334 #define MOCK_CONST_METHOD2(m, ...) \
335 GMOCK_INTERNAL_MOCK_METHODN(const, , m, 2, __VA_ARGS__)
336 #define MOCK_CONST_METHOD3(m, ...) \
337 GMOCK_INTERNAL_MOCK_METHODN(const, , m, 3, __VA_ARGS__)
338 #define MOCK_CONST_METHOD4(m, ...) \
339 GMOCK_INTERNAL_MOCK_METHODN(const, , m, 4, __VA_ARGS__)
340 #define MOCK_CONST_METHOD5(m, ...) \
341 GMOCK_INTERNAL_MOCK_METHODN(const, , m, 5, __VA_ARGS__)
342 #define MOCK_CONST_METHOD6(m, ...) \
343 GMOCK_INTERNAL_MOCK_METHODN(const, , m, 6, __VA_ARGS__)
344 #define MOCK_CONST_METHOD7(m, ...) \
345 GMOCK_INTERNAL_MOCK_METHODN(const, , m, 7, __VA_ARGS__)
346 #define MOCK_CONST_METHOD8(m, ...) \
347 GMOCK_INTERNAL_MOCK_METHODN(const, , m, 8, __VA_ARGS__)
348 #define MOCK_CONST_METHOD9(m, ...) \
349 GMOCK_INTERNAL_MOCK_METHODN(const, , m, 9, __VA_ARGS__)
350 #define MOCK_CONST_METHOD10(m, ...) \
351 GMOCK_INTERNAL_MOCK_METHODN(const, , m, 10, __VA_ARGS__)
353 #define MOCK_METHOD0_T(m, ...) MOCK_METHOD0(m, __VA_ARGS__)
354 #define MOCK_METHOD1_T(m, ...) MOCK_METHOD1(m, __VA_ARGS__)
355 #define MOCK_METHOD2_T(m, ...) MOCK_METHOD2(m, __VA_ARGS__)
356 #define MOCK_METHOD3_T(m, ...) MOCK_METHOD3(m, __VA_ARGS__)
357 #define MOCK_METHOD4_T(m, ...) MOCK_METHOD4(m, __VA_ARGS__)
358 #define MOCK_METHOD5_T(m, ...) MOCK_METHOD5(m, __VA_ARGS__)
359 #define MOCK_METHOD6_T(m, ...) MOCK_METHOD6(m, __VA_ARGS__)
360 #define MOCK_METHOD7_T(m, ...) MOCK_METHOD7(m, __VA_ARGS__)
361 #define MOCK_METHOD8_T(m, ...) MOCK_METHOD8(m, __VA_ARGS__)
362 #define MOCK_METHOD9_T(m, ...) MOCK_METHOD9(m, __VA_ARGS__)
363 #define MOCK_METHOD10_T(m, ...) MOCK_METHOD10(m, __VA_ARGS__)
365 #define MOCK_CONST_METHOD0_T(m, ...) MOCK_CONST_METHOD0(m, __VA_ARGS__)
366 #define MOCK_CONST_METHOD1_T(m, ...) MOCK_CONST_METHOD1(m, __VA_ARGS__)
367 #define MOCK_CONST_METHOD2_T(m, ...) MOCK_CONST_METHOD2(m, __VA_ARGS__)
368 #define MOCK_CONST_METHOD3_T(m, ...) MOCK_CONST_METHOD3(m, __VA_ARGS__)
369 #define MOCK_CONST_METHOD4_T(m, ...) MOCK_CONST_METHOD4(m, __VA_ARGS__)
370 #define MOCK_CONST_METHOD5_T(m, ...) MOCK_CONST_METHOD5(m, __VA_ARGS__)
371 #define MOCK_CONST_METHOD6_T(m, ...) MOCK_CONST_METHOD6(m, __VA_ARGS__)
372 #define MOCK_CONST_METHOD7_T(m, ...) MOCK_CONST_METHOD7(m, __VA_ARGS__)
373 #define MOCK_CONST_METHOD8_T(m, ...) MOCK_CONST_METHOD8(m, __VA_ARGS__)
374 #define MOCK_CONST_METHOD9_T(m, ...) MOCK_CONST_METHOD9(m, __VA_ARGS__)
375 #define MOCK_CONST_METHOD10_T(m, ...) MOCK_CONST_METHOD10(m, __VA_ARGS__)
377 #define MOCK_METHOD0_WITH_CALLTYPE(ct, m, ...) \
378 GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 0, __VA_ARGS__)
379 #define MOCK_METHOD1_WITH_CALLTYPE(ct, m, ...) \
380 GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 1, __VA_ARGS__)
381 #define MOCK_METHOD2_WITH_CALLTYPE(ct, m, ...) \
382 GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 2, __VA_ARGS__)
383 #define MOCK_METHOD3_WITH_CALLTYPE(ct, m, ...) \
384 GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 3, __VA_ARGS__)
385 #define MOCK_METHOD4_WITH_CALLTYPE(ct, m, ...) \
386 GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 4, __VA_ARGS__)
387 #define MOCK_METHOD5_WITH_CALLTYPE(ct, m, ...) \
388 GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 5, __VA_ARGS__)
389 #define MOCK_METHOD6_WITH_CALLTYPE(ct, m, ...) \
390 GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 6, __VA_ARGS__)
391 #define MOCK_METHOD7_WITH_CALLTYPE(ct, m, ...) \
392 GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 7, __VA_ARGS__)
393 #define MOCK_METHOD8_WITH_CALLTYPE(ct, m, ...) \
394 GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 8, __VA_ARGS__)
395 #define MOCK_METHOD9_WITH_CALLTYPE(ct, m, ...) \
396 GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 9, __VA_ARGS__)
397 #define MOCK_METHOD10_WITH_CALLTYPE(ct, m, ...) \
398 GMOCK_INTERNAL_MOCK_METHODN(, ct, m, 10, __VA_ARGS__)
400 #define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, ...) \
401 GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 0, __VA_ARGS__)
402 #define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, ...) \
403 GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 1, __VA_ARGS__)
404 #define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, ...) \
405 GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 2, __VA_ARGS__)
406 #define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, ...) \
407 GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 3, __VA_ARGS__)
408 #define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, ...) \
409 GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 4, __VA_ARGS__)
410 #define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, ...) \
411 GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 5, __VA_ARGS__)
412 #define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, ...) \
413 GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 6, __VA_ARGS__)
414 #define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, ...) \
415 GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 7, __VA_ARGS__)
416 #define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, ...) \
417 GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 8, __VA_ARGS__)
418 #define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, ...) \
419 GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 9, __VA_ARGS__)
420 #define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, ...) \
421 GMOCK_INTERNAL_MOCK_METHODN(const, ct, m, 10, __VA_ARGS__)
423 #define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
424 MOCK_METHOD0_WITH_CALLTYPE(ct, m, __VA_ARGS__)
425 #define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
426 MOCK_METHOD1_WITH_CALLTYPE(ct, m, __VA_ARGS__)
427 #define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
428 MOCK_METHOD2_WITH_CALLTYPE(ct, m, __VA_ARGS__)
429 #define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
430 MOCK_METHOD3_WITH_CALLTYPE(ct, m, __VA_ARGS__)
431 #define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
432 MOCK_METHOD4_WITH_CALLTYPE(ct, m, __VA_ARGS__)
433 #define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
434 MOCK_METHOD5_WITH_CALLTYPE(ct, m, __VA_ARGS__)
435 #define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
436 MOCK_METHOD6_WITH_CALLTYPE(ct, m, __VA_ARGS__)
437 #define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
438 MOCK_METHOD7_WITH_CALLTYPE(ct, m, __VA_ARGS__)
439 #define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
440 MOCK_METHOD8_WITH_CALLTYPE(ct, m, __VA_ARGS__)
441 #define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
442 MOCK_METHOD9_WITH_CALLTYPE(ct, m, __VA_ARGS__)
443 #define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
444 MOCK_METHOD10_WITH_CALLTYPE(ct, m, __VA_ARGS__)
446 #define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
447 MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, __VA_ARGS__)
448 #define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
449 MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, __VA_ARGS__)
450 #define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
451 MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, __VA_ARGS__)
452 #define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
453 MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, __VA_ARGS__)
454 #define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
455 MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, __VA_ARGS__)
456 #define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
457 MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, __VA_ARGS__)
458 #define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
459 MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, __VA_ARGS__)
460 #define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
461 MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, __VA_ARGS__)
462 #define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
463 MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, __VA_ARGS__)
464 #define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
465 MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, __VA_ARGS__)
466 #define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
467 MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, __VA_ARGS__)
469 #define GMOCK_INTERNAL_MOCK_METHODN(constness, ct, Method, args_num, ...) \
470 GMOCK_INTERNAL_ASSERT_VALID_SIGNATURE( \
471 args_num, ::testing::internal::identity_t<__VA_ARGS__>); \
472 GMOCK_INTERNAL_MOCK_METHOD_IMPL( \
473 args_num, Method, GMOCK_PP_NARG0(constness), 0, 0, , ct, , \
474 (::testing::internal::identity_t<__VA_ARGS__>))
476 #define GMOCK_MOCKER_(arity, constness, Method) \
477 GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__)
T identity_t
Definition: cmake-build-debug/googletest-src/googlemock/include/gmock/gmock-function-mocker.h:49
Definition: cmake-build-debug/googletest-src/googlemock/include/gmock/gmock-actions.h:154
typename std::conditional< std::is_const< typename std::remove_reference< Pattern >::type >::value, typename std::conditional< std::is_lvalue_reference< Pattern >::value, const T &, const T && >::type, typename std::conditional< std::is_lvalue_reference< Pattern >::value, T &, T && >::type >::type AdjustT
Definition: cmake-build-debug/googletest-src/googlemock/include/gmock/gmock-function-mocker.h:59
static AdjustT< MockType > Adjust(const MockType &mock)
Definition: cmake-build-release/googletest-src/googlemock/include/gmock/gmock-function-mocker.h:62