40 #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
41 #define GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_
46 #if GTEST_HAS_STD_FUNCTION_
47 # include <functional>
65 class FunctionMocker<
R()> :
public
72 return this->current_spec();
84 template <
typename R,
typename A1>
85 class FunctionMocker<
R(A1)> :
public
93 return this->current_spec();
105 template <
typename R,
typename A1,
typename A2>
106 class FunctionMocker<
R(A1, A2)> :
public
114 return this->current_spec();
126 template <
typename R,
typename A1,
typename A2,
typename A3>
127 class FunctionMocker<
R(A1, A2, A3)> :
public
130 typedef R F(A1, A2, A3);
136 return this->current_spec();
148 template <
typename R,
typename A1,
typename A2,
typename A3,
typename A4>
149 class FunctionMocker<
R(A1, A2, A3, A4)> :
public
152 typedef R F(A1, A2, A3, A4);
158 return this->current_spec();
170 template <
typename R,
typename A1,
typename A2,
typename A3,
typename A4,
172 class FunctionMocker<
R(A1, A2, A3, A4, A5)> :
public
175 typedef R F(A1, A2, A3, A4, A5);
181 return this->current_spec();
193 template <
typename R,
typename A1,
typename A2,
typename A3,
typename A4,
194 typename A5,
typename A6>
195 class FunctionMocker<
R(A1, A2, A3, A4, A5, A6)> :
public
198 typedef R F(A1, A2, A3, A4, A5, A6);
206 return this->current_spec();
214 return this->InvokeWith(
ArgumentTuple(a1, a2, a3, a4, a5, a6));
218 template <
typename R,
typename A1,
typename A2,
typename A3,
typename A4,
219 typename A5,
typename A6,
typename A7>
220 class FunctionMocker<
R(A1, A2, A3, A4, A5, A6, A7)> :
public
223 typedef R F(A1, A2, A3, A4, A5, A6, A7);
231 return this->current_spec();
234 R Invoke(A1 a1, A2
a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) {
239 return this->InvokeWith(
ArgumentTuple(a1, a2, a3, a4, a5, a6, a7));
243 template <
typename R,
typename A1,
typename A2,
typename A3,
typename A4,
244 typename A5,
typename A6,
typename A7,
typename A8>
245 class FunctionMocker<
R(A1, A2, A3, A4, A5, A6, A7, A8)> :
public
248 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8);
256 return this->current_spec();
259 R Invoke(A1 a1, A2
a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) {
264 return this->InvokeWith(
ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8));
268 template <
typename R,
typename A1,
typename A2,
typename A3,
typename A4,
269 typename A5,
typename A6,
typename A7,
typename A8,
typename A9>
270 class FunctionMocker<
R(A1, A2, A3, A4, A5, A6, A7, A8, A9)> :
public
273 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9);
282 return this->current_spec();
285 R Invoke(A1 a1, A2
a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9) {
290 return this->InvokeWith(
ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8, a9));
294 template <
typename R,
typename A1,
typename A2,
typename A3,
typename A4,
295 typename A5,
typename A6,
typename A7,
typename A8,
typename A9,
297 class FunctionMocker<
R(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10)> :
public
300 typedef R F(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10);
308 m6, m7, m8, m9, m10));
309 return this->current_spec();
312 R Invoke(A1 a1, A2
a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a9,
318 return this->InvokeWith(
ArgumentTuple(a1, a2, a3, a4, a5, a6, a7, a8, a9,
330 using internal::FunctionMocker;
337 #define GMOCK_RESULT_(tn, ...) \
338 tn ::testing::internal::Function<__VA_ARGS__>::Result
342 #define GMOCK_ARG_(tn, N, ...) \
343 tn ::testing::internal::Function<__VA_ARGS__>::Argument##N
347 #define GMOCK_MATCHER_(tn, N, ...) \
348 const ::testing::Matcher<GMOCK_ARG_(tn, N, __VA_ARGS__)>&
352 #define GMOCK_MOCKER_(arity, constness, Method) \
353 GTEST_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__)
356 #define GMOCK_METHOD0_(tn, constness, ct, Method, ...) \
357 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
359 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
360 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
362 this_method_does_not_take_0_arguments); \
363 GMOCK_MOCKER_(0, constness, Method).SetOwnerAndName(this, #Method); \
364 return GMOCK_MOCKER_(0, constness, Method).Invoke(); \
366 ::testing::MockSpec<__VA_ARGS__>& \
367 gmock_##Method() constness { \
368 GMOCK_MOCKER_(0, constness, Method).RegisterOwner(this); \
369 return GMOCK_MOCKER_(0, constness, Method).With(); \
371 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(0, constness, \
375 #define GMOCK_METHOD1_(tn, constness, ct, Method, ...) \
376 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
377 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1) constness { \
378 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
379 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
381 this_method_does_not_take_1_argument); \
382 GMOCK_MOCKER_(1, constness, Method).SetOwnerAndName(this, #Method); \
383 return GMOCK_MOCKER_(1, constness, Method).Invoke(gmock_a1); \
385 ::testing::MockSpec<__VA_ARGS__>& \
386 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1) constness { \
387 GMOCK_MOCKER_(1, constness, Method).RegisterOwner(this); \
388 return GMOCK_MOCKER_(1, constness, Method).With(gmock_a1); \
390 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(1, constness, \
394 #define GMOCK_METHOD2_(tn, constness, ct, Method, ...) \
395 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
396 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
397 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2) constness { \
398 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
399 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
401 this_method_does_not_take_2_arguments); \
402 GMOCK_MOCKER_(2, constness, Method).SetOwnerAndName(this, #Method); \
403 return GMOCK_MOCKER_(2, constness, Method).Invoke(gmock_a1, gmock_a2); \
405 ::testing::MockSpec<__VA_ARGS__>& \
406 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
407 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2) constness { \
408 GMOCK_MOCKER_(2, constness, Method).RegisterOwner(this); \
409 return GMOCK_MOCKER_(2, constness, Method).With(gmock_a1, gmock_a2); \
411 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(2, constness, \
415 #define GMOCK_METHOD3_(tn, constness, ct, Method, ...) \
416 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
417 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
418 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
419 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3) constness { \
420 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
421 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
423 this_method_does_not_take_3_arguments); \
424 GMOCK_MOCKER_(3, constness, Method).SetOwnerAndName(this, #Method); \
425 return GMOCK_MOCKER_(3, constness, Method).Invoke(gmock_a1, gmock_a2, \
428 ::testing::MockSpec<__VA_ARGS__>& \
429 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
430 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
431 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3) constness { \
432 GMOCK_MOCKER_(3, constness, Method).RegisterOwner(this); \
433 return GMOCK_MOCKER_(3, constness, Method).With(gmock_a1, gmock_a2, \
436 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(3, constness, \
440 #define GMOCK_METHOD4_(tn, constness, ct, Method, ...) \
441 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
442 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
443 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
444 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
445 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4) constness { \
446 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
447 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
449 this_method_does_not_take_4_arguments); \
450 GMOCK_MOCKER_(4, constness, Method).SetOwnerAndName(this, #Method); \
451 return GMOCK_MOCKER_(4, constness, Method).Invoke(gmock_a1, gmock_a2, \
452 gmock_a3, gmock_a4); \
454 ::testing::MockSpec<__VA_ARGS__>& \
455 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
456 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
457 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
458 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4) constness { \
459 GMOCK_MOCKER_(4, constness, Method).RegisterOwner(this); \
460 return GMOCK_MOCKER_(4, constness, Method).With(gmock_a1, gmock_a2, \
461 gmock_a3, gmock_a4); \
463 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(4, constness, \
467 #define GMOCK_METHOD5_(tn, constness, ct, Method, ...) \
468 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
469 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
470 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
471 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
472 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
473 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5) constness { \
474 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
475 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
477 this_method_does_not_take_5_arguments); \
478 GMOCK_MOCKER_(5, constness, Method).SetOwnerAndName(this, #Method); \
479 return GMOCK_MOCKER_(5, constness, Method).Invoke(gmock_a1, gmock_a2, \
480 gmock_a3, gmock_a4, gmock_a5); \
482 ::testing::MockSpec<__VA_ARGS__>& \
483 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
484 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
485 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
486 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
487 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5) constness { \
488 GMOCK_MOCKER_(5, constness, Method).RegisterOwner(this); \
489 return GMOCK_MOCKER_(5, constness, Method).With(gmock_a1, gmock_a2, \
490 gmock_a3, gmock_a4, gmock_a5); \
492 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(5, constness, \
496 #define GMOCK_METHOD6_(tn, constness, ct, Method, ...) \
497 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
498 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
499 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
500 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
501 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
502 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
503 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6) constness { \
504 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
505 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
507 this_method_does_not_take_6_arguments); \
508 GMOCK_MOCKER_(6, constness, Method).SetOwnerAndName(this, #Method); \
509 return GMOCK_MOCKER_(6, constness, Method).Invoke(gmock_a1, gmock_a2, \
510 gmock_a3, gmock_a4, gmock_a5, gmock_a6); \
512 ::testing::MockSpec<__VA_ARGS__>& \
513 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
514 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
515 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
516 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
517 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
518 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6) constness { \
519 GMOCK_MOCKER_(6, constness, Method).RegisterOwner(this); \
520 return GMOCK_MOCKER_(6, constness, Method).With(gmock_a1, gmock_a2, \
521 gmock_a3, gmock_a4, gmock_a5, gmock_a6); \
523 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(6, constness, \
527 #define GMOCK_METHOD7_(tn, constness, ct, Method, ...) \
528 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
529 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
530 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
531 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
532 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
533 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
534 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
535 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7) constness { \
536 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
537 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
539 this_method_does_not_take_7_arguments); \
540 GMOCK_MOCKER_(7, constness, Method).SetOwnerAndName(this, #Method); \
541 return GMOCK_MOCKER_(7, constness, Method).Invoke(gmock_a1, gmock_a2, \
542 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \
544 ::testing::MockSpec<__VA_ARGS__>& \
545 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
546 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
547 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
548 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
549 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
550 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
551 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7) constness { \
552 GMOCK_MOCKER_(7, constness, Method).RegisterOwner(this); \
553 return GMOCK_MOCKER_(7, constness, Method).With(gmock_a1, gmock_a2, \
554 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \
556 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(7, constness, \
560 #define GMOCK_METHOD8_(tn, constness, ct, Method, ...) \
561 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
562 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
563 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
564 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
565 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
566 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
567 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
568 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
569 GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8) constness { \
570 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
571 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
573 this_method_does_not_take_8_arguments); \
574 GMOCK_MOCKER_(8, constness, Method).SetOwnerAndName(this, #Method); \
575 return GMOCK_MOCKER_(8, constness, Method).Invoke(gmock_a1, gmock_a2, \
576 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \
578 ::testing::MockSpec<__VA_ARGS__>& \
579 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
580 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
581 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
582 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
583 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
584 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
585 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
586 GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8) constness { \
587 GMOCK_MOCKER_(8, constness, Method).RegisterOwner(this); \
588 return GMOCK_MOCKER_(8, constness, Method).With(gmock_a1, gmock_a2, \
589 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \
591 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(8, constness, \
595 #define GMOCK_METHOD9_(tn, constness, ct, Method, ...) \
596 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
597 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
598 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
599 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
600 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
601 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
602 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
603 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
604 GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8, \
605 GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9) constness { \
606 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
607 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
609 this_method_does_not_take_9_arguments); \
610 GMOCK_MOCKER_(9, constness, Method).SetOwnerAndName(this, #Method); \
611 return GMOCK_MOCKER_(9, constness, Method).Invoke(gmock_a1, gmock_a2, \
612 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \
615 ::testing::MockSpec<__VA_ARGS__>& \
616 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
617 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
618 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
619 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
620 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
621 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
622 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
623 GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \
624 GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9) constness { \
625 GMOCK_MOCKER_(9, constness, Method).RegisterOwner(this); \
626 return GMOCK_MOCKER_(9, constness, Method).With(gmock_a1, gmock_a2, \
627 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \
630 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(9, constness, \
634 #define GMOCK_METHOD10_(tn, constness, ct, Method, ...) \
635 GMOCK_RESULT_(tn, __VA_ARGS__) ct Method( \
636 GMOCK_ARG_(tn, 1, __VA_ARGS__) gmock_a1, \
637 GMOCK_ARG_(tn, 2, __VA_ARGS__) gmock_a2, \
638 GMOCK_ARG_(tn, 3, __VA_ARGS__) gmock_a3, \
639 GMOCK_ARG_(tn, 4, __VA_ARGS__) gmock_a4, \
640 GMOCK_ARG_(tn, 5, __VA_ARGS__) gmock_a5, \
641 GMOCK_ARG_(tn, 6, __VA_ARGS__) gmock_a6, \
642 GMOCK_ARG_(tn, 7, __VA_ARGS__) gmock_a7, \
643 GMOCK_ARG_(tn, 8, __VA_ARGS__) gmock_a8, \
644 GMOCK_ARG_(tn, 9, __VA_ARGS__) gmock_a9, \
645 GMOCK_ARG_(tn, 10, __VA_ARGS__) gmock_a10) constness { \
646 GTEST_COMPILE_ASSERT_((::testing::tuple_size< \
647 tn ::testing::internal::Function<__VA_ARGS__>::ArgumentTuple>::value \
649 this_method_does_not_take_10_arguments); \
650 GMOCK_MOCKER_(10, constness, Method).SetOwnerAndName(this, #Method); \
651 return GMOCK_MOCKER_(10, constness, Method).Invoke(gmock_a1, gmock_a2, \
652 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \
655 ::testing::MockSpec<__VA_ARGS__>& \
656 gmock_##Method(GMOCK_MATCHER_(tn, 1, __VA_ARGS__) gmock_a1, \
657 GMOCK_MATCHER_(tn, 2, __VA_ARGS__) gmock_a2, \
658 GMOCK_MATCHER_(tn, 3, __VA_ARGS__) gmock_a3, \
659 GMOCK_MATCHER_(tn, 4, __VA_ARGS__) gmock_a4, \
660 GMOCK_MATCHER_(tn, 5, __VA_ARGS__) gmock_a5, \
661 GMOCK_MATCHER_(tn, 6, __VA_ARGS__) gmock_a6, \
662 GMOCK_MATCHER_(tn, 7, __VA_ARGS__) gmock_a7, \
663 GMOCK_MATCHER_(tn, 8, __VA_ARGS__) gmock_a8, \
664 GMOCK_MATCHER_(tn, 9, __VA_ARGS__) gmock_a9, \
665 GMOCK_MATCHER_(tn, 10, \
666 __VA_ARGS__) gmock_a10) constness { \
667 GMOCK_MOCKER_(10, constness, Method).RegisterOwner(this); \
668 return GMOCK_MOCKER_(10, constness, Method).With(gmock_a1, gmock_a2, \
669 gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \
672 mutable ::testing::FunctionMocker<__VA_ARGS__> GMOCK_MOCKER_(10, constness, \
675 #define MOCK_METHOD0(m, ...) GMOCK_METHOD0_(, , , m, __VA_ARGS__)
676 #define MOCK_METHOD1(m, ...) GMOCK_METHOD1_(, , , m, __VA_ARGS__)
677 #define MOCK_METHOD2(m, ...) GMOCK_METHOD2_(, , , m, __VA_ARGS__)
678 #define MOCK_METHOD3(m, ...) GMOCK_METHOD3_(, , , m, __VA_ARGS__)
679 #define MOCK_METHOD4(m, ...) GMOCK_METHOD4_(, , , m, __VA_ARGS__)
680 #define MOCK_METHOD5(m, ...) GMOCK_METHOD5_(, , , m, __VA_ARGS__)
681 #define MOCK_METHOD6(m, ...) GMOCK_METHOD6_(, , , m, __VA_ARGS__)
682 #define MOCK_METHOD7(m, ...) GMOCK_METHOD7_(, , , m, __VA_ARGS__)
683 #define MOCK_METHOD8(m, ...) GMOCK_METHOD8_(, , , m, __VA_ARGS__)
684 #define MOCK_METHOD9(m, ...) GMOCK_METHOD9_(, , , m, __VA_ARGS__)
685 #define MOCK_METHOD10(m, ...) GMOCK_METHOD10_(, , , m, __VA_ARGS__)
687 #define MOCK_CONST_METHOD0(m, ...) GMOCK_METHOD0_(, const, , m, __VA_ARGS__)
688 #define MOCK_CONST_METHOD1(m, ...) GMOCK_METHOD1_(, const, , m, __VA_ARGS__)
689 #define MOCK_CONST_METHOD2(m, ...) GMOCK_METHOD2_(, const, , m, __VA_ARGS__)
690 #define MOCK_CONST_METHOD3(m, ...) GMOCK_METHOD3_(, const, , m, __VA_ARGS__)
691 #define MOCK_CONST_METHOD4(m, ...) GMOCK_METHOD4_(, const, , m, __VA_ARGS__)
692 #define MOCK_CONST_METHOD5(m, ...) GMOCK_METHOD5_(, const, , m, __VA_ARGS__)
693 #define MOCK_CONST_METHOD6(m, ...) GMOCK_METHOD6_(, const, , m, __VA_ARGS__)
694 #define MOCK_CONST_METHOD7(m, ...) GMOCK_METHOD7_(, const, , m, __VA_ARGS__)
695 #define MOCK_CONST_METHOD8(m, ...) GMOCK_METHOD8_(, const, , m, __VA_ARGS__)
696 #define MOCK_CONST_METHOD9(m, ...) GMOCK_METHOD9_(, const, , m, __VA_ARGS__)
697 #define MOCK_CONST_METHOD10(m, ...) GMOCK_METHOD10_(, const, , m, __VA_ARGS__)
699 #define MOCK_METHOD0_T(m, ...) GMOCK_METHOD0_(typename, , , m, __VA_ARGS__)
700 #define MOCK_METHOD1_T(m, ...) GMOCK_METHOD1_(typename, , , m, __VA_ARGS__)
701 #define MOCK_METHOD2_T(m, ...) GMOCK_METHOD2_(typename, , , m, __VA_ARGS__)
702 #define MOCK_METHOD3_T(m, ...) GMOCK_METHOD3_(typename, , , m, __VA_ARGS__)
703 #define MOCK_METHOD4_T(m, ...) GMOCK_METHOD4_(typename, , , m, __VA_ARGS__)
704 #define MOCK_METHOD5_T(m, ...) GMOCK_METHOD5_(typename, , , m, __VA_ARGS__)
705 #define MOCK_METHOD6_T(m, ...) GMOCK_METHOD6_(typename, , , m, __VA_ARGS__)
706 #define MOCK_METHOD7_T(m, ...) GMOCK_METHOD7_(typename, , , m, __VA_ARGS__)
707 #define MOCK_METHOD8_T(m, ...) GMOCK_METHOD8_(typename, , , m, __VA_ARGS__)
708 #define MOCK_METHOD9_T(m, ...) GMOCK_METHOD9_(typename, , , m, __VA_ARGS__)
709 #define MOCK_METHOD10_T(m, ...) GMOCK_METHOD10_(typename, , , m, __VA_ARGS__)
711 #define MOCK_CONST_METHOD0_T(m, ...) \
712 GMOCK_METHOD0_(typename, const, , m, __VA_ARGS__)
713 #define MOCK_CONST_METHOD1_T(m, ...) \
714 GMOCK_METHOD1_(typename, const, , m, __VA_ARGS__)
715 #define MOCK_CONST_METHOD2_T(m, ...) \
716 GMOCK_METHOD2_(typename, const, , m, __VA_ARGS__)
717 #define MOCK_CONST_METHOD3_T(m, ...) \
718 GMOCK_METHOD3_(typename, const, , m, __VA_ARGS__)
719 #define MOCK_CONST_METHOD4_T(m, ...) \
720 GMOCK_METHOD4_(typename, const, , m, __VA_ARGS__)
721 #define MOCK_CONST_METHOD5_T(m, ...) \
722 GMOCK_METHOD5_(typename, const, , m, __VA_ARGS__)
723 #define MOCK_CONST_METHOD6_T(m, ...) \
724 GMOCK_METHOD6_(typename, const, , m, __VA_ARGS__)
725 #define MOCK_CONST_METHOD7_T(m, ...) \
726 GMOCK_METHOD7_(typename, const, , m, __VA_ARGS__)
727 #define MOCK_CONST_METHOD8_T(m, ...) \
728 GMOCK_METHOD8_(typename, const, , m, __VA_ARGS__)
729 #define MOCK_CONST_METHOD9_T(m, ...) \
730 GMOCK_METHOD9_(typename, const, , m, __VA_ARGS__)
731 #define MOCK_CONST_METHOD10_T(m, ...) \
732 GMOCK_METHOD10_(typename, const, , m, __VA_ARGS__)
734 #define MOCK_METHOD0_WITH_CALLTYPE(ct, m, ...) \
735 GMOCK_METHOD0_(, , ct, m, __VA_ARGS__)
736 #define MOCK_METHOD1_WITH_CALLTYPE(ct, m, ...) \
737 GMOCK_METHOD1_(, , ct, m, __VA_ARGS__)
738 #define MOCK_METHOD2_WITH_CALLTYPE(ct, m, ...) \
739 GMOCK_METHOD2_(, , ct, m, __VA_ARGS__)
740 #define MOCK_METHOD3_WITH_CALLTYPE(ct, m, ...) \
741 GMOCK_METHOD3_(, , ct, m, __VA_ARGS__)
742 #define MOCK_METHOD4_WITH_CALLTYPE(ct, m, ...) \
743 GMOCK_METHOD4_(, , ct, m, __VA_ARGS__)
744 #define MOCK_METHOD5_WITH_CALLTYPE(ct, m, ...) \
745 GMOCK_METHOD5_(, , ct, m, __VA_ARGS__)
746 #define MOCK_METHOD6_WITH_CALLTYPE(ct, m, ...) \
747 GMOCK_METHOD6_(, , ct, m, __VA_ARGS__)
748 #define MOCK_METHOD7_WITH_CALLTYPE(ct, m, ...) \
749 GMOCK_METHOD7_(, , ct, m, __VA_ARGS__)
750 #define MOCK_METHOD8_WITH_CALLTYPE(ct, m, ...) \
751 GMOCK_METHOD8_(, , ct, m, __VA_ARGS__)
752 #define MOCK_METHOD9_WITH_CALLTYPE(ct, m, ...) \
753 GMOCK_METHOD9_(, , ct, m, __VA_ARGS__)
754 #define MOCK_METHOD10_WITH_CALLTYPE(ct, m, ...) \
755 GMOCK_METHOD10_(, , ct, m, __VA_ARGS__)
757 #define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, ...) \
758 GMOCK_METHOD0_(, const, ct, m, __VA_ARGS__)
759 #define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, ...) \
760 GMOCK_METHOD1_(, const, ct, m, __VA_ARGS__)
761 #define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, ...) \
762 GMOCK_METHOD2_(, const, ct, m, __VA_ARGS__)
763 #define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, ...) \
764 GMOCK_METHOD3_(, const, ct, m, __VA_ARGS__)
765 #define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, ...) \
766 GMOCK_METHOD4_(, const, ct, m, __VA_ARGS__)
767 #define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, ...) \
768 GMOCK_METHOD5_(, const, ct, m, __VA_ARGS__)
769 #define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, ...) \
770 GMOCK_METHOD6_(, const, ct, m, __VA_ARGS__)
771 #define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, ...) \
772 GMOCK_METHOD7_(, const, ct, m, __VA_ARGS__)
773 #define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, ...) \
774 GMOCK_METHOD8_(, const, ct, m, __VA_ARGS__)
775 #define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, ...) \
776 GMOCK_METHOD9_(, const, ct, m, __VA_ARGS__)
777 #define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, ...) \
778 GMOCK_METHOD10_(, const, ct, m, __VA_ARGS__)
780 #define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
781 GMOCK_METHOD0_(typename, , ct, m, __VA_ARGS__)
782 #define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
783 GMOCK_METHOD1_(typename, , ct, m, __VA_ARGS__)
784 #define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
785 GMOCK_METHOD2_(typename, , ct, m, __VA_ARGS__)
786 #define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
787 GMOCK_METHOD3_(typename, , ct, m, __VA_ARGS__)
788 #define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
789 GMOCK_METHOD4_(typename, , ct, m, __VA_ARGS__)
790 #define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
791 GMOCK_METHOD5_(typename, , ct, m, __VA_ARGS__)
792 #define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
793 GMOCK_METHOD6_(typename, , ct, m, __VA_ARGS__)
794 #define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
795 GMOCK_METHOD7_(typename, , ct, m, __VA_ARGS__)
796 #define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
797 GMOCK_METHOD8_(typename, , ct, m, __VA_ARGS__)
798 #define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
799 GMOCK_METHOD9_(typename, , ct, m, __VA_ARGS__)
800 #define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
801 GMOCK_METHOD10_(typename, , ct, m, __VA_ARGS__)
803 #define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, ...) \
804 GMOCK_METHOD0_(typename, const, ct, m, __VA_ARGS__)
805 #define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, ...) \
806 GMOCK_METHOD1_(typename, const, ct, m, __VA_ARGS__)
807 #define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, ...) \
808 GMOCK_METHOD2_(typename, const, ct, m, __VA_ARGS__)
809 #define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, ...) \
810 GMOCK_METHOD3_(typename, const, ct, m, __VA_ARGS__)
811 #define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, ...) \
812 GMOCK_METHOD4_(typename, const, ct, m, __VA_ARGS__)
813 #define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, ...) \
814 GMOCK_METHOD5_(typename, const, ct, m, __VA_ARGS__)
815 #define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, ...) \
816 GMOCK_METHOD6_(typename, const, ct, m, __VA_ARGS__)
817 #define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, ...) \
818 GMOCK_METHOD7_(typename, const, ct, m, __VA_ARGS__)
819 #define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, ...) \
820 GMOCK_METHOD8_(typename, const, ct, m, __VA_ARGS__)
821 #define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, ...) \
822 GMOCK_METHOD9_(typename, const, ct, m, __VA_ARGS__)
823 #define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, ...) \
824 GMOCK_METHOD10_(typename, const, ct, m, __VA_ARGS__)
872 template <
typename F>
875 template <
typename R>
882 #if GTEST_HAS_STD_FUNCTION_
883 std::function<R()> AsStdFunction() {
884 return [
this]() ->
R {
888 #endif // GTEST_HAS_STD_FUNCTION_
894 template <
typename R,
typename A0>
901 #if GTEST_HAS_STD_FUNCTION_
902 std::function<R(A0)> AsStdFunction() {
903 return [
this](A0 a0) ->
R {
904 return this->Call(a0);
907 #endif // GTEST_HAS_STD_FUNCTION_
913 template <
typename R,
typename A0,
typename A1>
920 #if GTEST_HAS_STD_FUNCTION_
921 std::function<R(A0, A1)> AsStdFunction() {
922 return [
this](A0 a0, A1 a1) ->
R {
923 return this->Call(a0, a1);
926 #endif // GTEST_HAS_STD_FUNCTION_
932 template <
typename R,
typename A0,
typename A1,
typename A2>
939 #if GTEST_HAS_STD_FUNCTION_
940 std::function<R(A0, A1, A2)> AsStdFunction() {
941 return [
this](A0 a0, A1 a1, A2
a2) ->
R {
942 return this->Call(a0, a1,
a2);
945 #endif // GTEST_HAS_STD_FUNCTION_
951 template <
typename R,
typename A0,
typename A1,
typename A2,
typename A3>
958 #if GTEST_HAS_STD_FUNCTION_
959 std::function<R(A0, A1, A2, A3)> AsStdFunction() {
960 return [
this](A0 a0, A1 a1, A2
a2, A3 a3) ->
R {
961 return this->Call(a0, a1, a2, a3);
964 #endif // GTEST_HAS_STD_FUNCTION_
970 template <
typename R,
typename A0,
typename A1,
typename A2,
typename A3,
978 #if GTEST_HAS_STD_FUNCTION_
979 std::function<R(A0, A1, A2, A3, A4)> AsStdFunction() {
980 return [
this](A0 a0, A1 a1, A2
a2, A3 a3, A4 a4) ->
R {
981 return this->Call(a0, a1, a2, a3, a4);
984 #endif // GTEST_HAS_STD_FUNCTION_
990 template <
typename R,
typename A0,
typename A1,
typename A2,
typename A3,
991 typename A4,
typename A5>
998 #if GTEST_HAS_STD_FUNCTION_
999 std::function<R(A0, A1, A2, A3, A4, A5)> AsStdFunction() {
1000 return [
this](A0 a0, A1 a1, A2
a2, A3 a3, A4 a4, A5 a5) ->
R {
1001 return this->Call(a0, a1, a2, a3, a4, a5);
1004 #endif // GTEST_HAS_STD_FUNCTION_
1010 template <
typename R,
typename A0,
typename A1,
typename A2,
typename A3,
1011 typename A4,
typename A5,
typename A6>
1018 #if GTEST_HAS_STD_FUNCTION_
1019 std::function<R(A0, A1, A2, A3, A4, A5, A6)> AsStdFunction() {
1020 return [
this](A0 a0, A1 a1, A2
a2, A3 a3, A4 a4, A5 a5, A6 a6) ->
R {
1021 return this->Call(a0, a1, a2, a3, a4, a5, a6);
1024 #endif // GTEST_HAS_STD_FUNCTION_
1030 template <
typename R,
typename A0,
typename A1,
typename A2,
typename A3,
1031 typename A4,
typename A5,
typename A6,
typename A7>
1038 #if GTEST_HAS_STD_FUNCTION_
1039 std::function<R(A0, A1, A2, A3, A4, A5, A6, A7)> AsStdFunction() {
1040 return [
this](A0 a0, A1 a1, A2
a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) ->
R {
1041 return this->Call(a0, a1, a2, a3, a4, a5, a6, a7);
1044 #endif // GTEST_HAS_STD_FUNCTION_
1050 template <
typename R,
typename A0,
typename A1,
typename A2,
typename A3,
1051 typename A4,
typename A5,
typename A6,
typename A7,
typename A8>
1058 #if GTEST_HAS_STD_FUNCTION_
1059 std::function<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> AsStdFunction() {
1060 return [
this](A0 a0, A1 a1, A2
a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7,
1062 return this->Call(a0, a1, a2, a3, a4, a5, a6, a7, a8);
1065 #endif // GTEST_HAS_STD_FUNCTION_
1071 template <
typename R,
typename A0,
typename A1,
typename A2,
typename A3,
1072 typename A4,
typename A5,
typename A6,
typename A7,
typename A8,
1078 MOCK_METHOD10_T(Call,
R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9));
1080 #if GTEST_HAS_STD_FUNCTION_
1081 std::function<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> AsStdFunction() {
1082 return [
this](A0 a0, A1 a1, A2
a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7,
1083 A8 a8, A9 a9) ->
R {
1084 return this->Call(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
1087 #endif // GTEST_HAS_STD_FUNCTION_
1095 #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_