diff options
Diffstat (limited to 'googlemock')
-rw-r--r-- | googlemock/include/gmock/gmock-actions.h | 251 | ||||
-rw-r--r-- | googlemock/include/gmock/gmock-generated-actions.h | 868 | ||||
-rw-r--r-- | googlemock/include/gmock/gmock-generated-actions.h.pump | 180 | ||||
-rw-r--r-- | googlemock/test/gmock-matchers_test.cc | 6 |
4 files changed, 260 insertions, 1045 deletions
diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h index a7b84d1b..88011798 100644 --- a/googlemock/include/gmock/gmock-actions.h +++ b/googlemock/include/gmock/gmock-actions.h @@ -30,7 +30,100 @@ // Google Mock - a framework for writing C++ mock classes. // -// This file implements some commonly used actions. +// The ACTION* family of macros can be used in a namespace scope to +// define custom actions easily. The syntax: +// +// ACTION(name) { statements; } +// +// will define an action with the given name that executes the +// statements. The value returned by the statements will be used as +// the return value of the action. Inside the statements, you can +// refer to the K-th (0-based) argument of the mock function by +// 'argK', and refer to its type by 'argK_type'. For example: +// +// ACTION(IncrementArg1) { +// arg1_type temp = arg1; +// return ++(*temp); +// } +// +// allows you to write +// +// ...WillOnce(IncrementArg1()); +// +// You can also refer to the entire argument tuple and its type by +// 'args' and 'args_type', and refer to the mock function type and its +// return type by 'function_type' and 'return_type'. +// +// Note that you don't need to specify the types of the mock function +// arguments. However rest assured that your code is still type-safe: +// you'll get a compiler error if *arg1 doesn't support the ++ +// operator, or if the type of ++(*arg1) isn't compatible with the +// mock function's return type, for example. +// +// Sometimes you'll want to parameterize the action. For that you can use +// another macro: +// +// ACTION_P(name, param_name) { statements; } +// +// For example: +// +// ACTION_P(Add, n) { return arg0 + n; } +// +// will allow you to write: +// +// ...WillOnce(Add(5)); +// +// Note that you don't need to provide the type of the parameter +// either. If you need to reference the type of a parameter named +// 'foo', you can write 'foo_type'. For example, in the body of +// ACTION_P(Add, n) above, you can write 'n_type' to refer to the type +// of 'n'. +// +// We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P10 to support +// multi-parameter actions. +// +// For the purpose of typing, you can view +// +// ACTION_Pk(Foo, p1, ..., pk) { ... } +// +// as shorthand for +// +// template <typename p1_type, ..., typename pk_type> +// FooActionPk<p1_type, ..., pk_type> Foo(p1_type p1, ..., pk_type pk) { ... } +// +// In particular, you can provide the template type arguments +// explicitly when invoking Foo(), as in Foo<long, bool>(5, false); +// although usually you can rely on the compiler to infer the types +// for you automatically. You can assign the result of expression +// Foo(p1, ..., pk) to a variable of type FooActionPk<p1_type, ..., +// pk_type>. This can be useful when composing actions. +// +// You can also overload actions with different numbers of parameters: +// +// ACTION_P(Plus, a) { ... } +// ACTION_P2(Plus, a, b) { ... } +// +// While it's tempting to always use the ACTION* macros when defining +// a new action, you should also consider implementing ActionInterface +// or using MakePolymorphicAction() instead, especially if you need to +// use the action a lot. While these approaches require more work, +// they give you more control on the types of the mock function +// arguments and the action parameters, which in general leads to +// better compiler error messages that pay off in the long run. They +// also allow overloading actions based on parameter types (as opposed +// to just based on the number of parameters). +// +// CAVEAT: +// +// ACTION*() can only be used in a namespace scope as templates cannot be +// declared inside of a local class. +// Users can, however, define any local functors (e.g. a lambda) that +// can be used as actions. +// +// MORE INFORMATION: +// +// To learn more about using these macros, please search for 'ACTION' on +// https://github.com/google/googletest/blob/master/googlemock/docs/cook_book.md // GOOGLETEST_CM0002 DO NOT DELETE @@ -50,6 +143,7 @@ #include "gmock/internal/gmock-internal-utils.h" #include "gmock/internal/gmock-port.h" +#include "gmock/internal/gmock-pp.h" #ifdef _MSC_VER # pragma warning(push) @@ -1275,8 +1369,163 @@ auto InvokeArgumentAdl(AdlTag, F f, Args... args) -> decltype(f(args...)) { } } // namespace invoke_argument + +#define GMOCK_INTERNAL_ARG_UNUSED(i, data, el) \ + , const arg##i##_type& arg##i GTEST_ATTRIBUTE_UNUSED_ +#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_ \ + const args_type& args GTEST_ATTRIBUTE_UNUSED_ GMOCK_PP_REPEAT( \ + GMOCK_INTERNAL_ARG_UNUSED, , 10) + +#define GMOCK_INTERNAL_ARG(i, data, el) , const arg##i##_type& arg##i +#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_ \ + const args_type& args GMOCK_PP_REPEAT(GMOCK_INTERNAL_ARG, , 10) + +#define GMOCK_INTERNAL_TEMPLATE_ARG(i, data, el) , typename arg##i##_type +#define GMOCK_ACTION_TEMPLATE_ARGS_NAMES_ \ + GMOCK_PP_TAIL(GMOCK_PP_REPEAT(GMOCK_INTERNAL_TEMPLATE_ARG, , 10)) + +#define GMOCK_INTERNAL_TYPENAME_PARAM(i, data, param) , typename param##_type +#define GMOCK_ACTION_TYPENAME_PARAMS_(params) \ + GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_TYPENAME_PARAM, , params)) + +#define GMOCK_INTERNAL_TYPE_PARAM(i, data, param) , param##_type +#define GMOCK_ACTION_TYPE_PARAMS_(params) \ + GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_TYPE_PARAM, , params)) + +#define GMOCK_INTERNAL_TYPE_GVALUE_PARAM(i, data, param) \ + , param##_type gmock_p##i +#define GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params) \ + GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_TYPE_GVALUE_PARAM, , params)) + +#define GMOCK_INTERNAL_GVALUE_PARAM(i, data, param) \ + , std::forward<param##_type>(gmock_p##i) +#define GMOCK_ACTION_GVALUE_PARAMS_(params) \ + GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_GVALUE_PARAM, , params)) + +#define GMOCK_INTERNAL_INIT_PARAM(i, data, param) \ + , param(::std::forward<param##_type>(gmock_p##i)) +#define GMOCK_ACTION_INIT_PARAMS_(params) \ + GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_INIT_PARAM, , params)) + +#define GMOCK_INTERNAL_FIELD_PARAM(i, data, param) param##_type param; +#define GMOCK_ACTION_FIELD_PARAMS_(params) \ + GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_FIELD_PARAM, , params) + +#define GMOCK_INTERNAL_ACTION(name, full_name, params) \ + template <GMOCK_ACTION_TYPENAME_PARAMS_(params)> \ + class full_name : public ::testing::internal::ActionImpl< \ + full_name<GMOCK_ACTION_TYPE_PARAMS_(params)>> { \ + using base_type = ::testing::internal::ActionImpl<full_name>; \ + \ + public: \ + using base_type::base_type; \ + template <typename F> \ + class gmock_Impl : public ::testing::ActionInterface<F> { \ + public: \ + typedef F function_type; \ + typedef typename ::testing::internal::Function<F>::Result return_type; \ + typedef \ + typename ::testing::internal::Function<F>::ArgumentTuple args_type; \ + gmock_Impl(GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params)) \ + : GMOCK_ACTION_INIT_PARAMS_(params) {} \ + return_type Perform(const args_type& args) override { \ + return ::testing::internal::ActionHelper<return_type, \ + gmock_Impl>::Perform(this, \ + args); \ + } \ + template <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_> \ + return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) const; \ + GMOCK_ACTION_FIELD_PARAMS_(params) \ + \ + private: \ + GTEST_DISALLOW_ASSIGN_(gmock_Impl); \ + }; \ + \ + private: \ + GTEST_DISALLOW_ASSIGN_(full_name); \ + }; \ + template <GMOCK_ACTION_TYPENAME_PARAMS_(params)> \ + inline full_name<GMOCK_ACTION_TYPE_PARAMS_(params)> name( \ + GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params)) { \ + return full_name<GMOCK_ACTION_TYPE_PARAMS_(params)>( \ + GMOCK_ACTION_GVALUE_PARAMS_(params)); \ + } \ + template <GMOCK_ACTION_TYPENAME_PARAMS_(params)> \ + template <typename F> \ + template <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_> \ + typename ::testing::internal::Function<F>::Result \ + full_name<GMOCK_ACTION_TYPE_PARAMS_(params)>::gmock_Impl< \ + F>::gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) \ + const + } // namespace internal +#define ACTION(name) \ + class name##Action : public ::testing::internal::ActionImpl<name##Action> { \ + using base_type = ::testing::internal::ActionImpl<name##Action>; \ + \ + public: \ + using base_type::base_type; \ + template <typename F> \ + class gmock_Impl : public ::testing::ActionInterface<F> { \ + public: \ + typedef F function_type; \ + typedef typename ::testing::internal::Function<F>::Result return_type; \ + typedef \ + typename ::testing::internal::Function<F>::ArgumentTuple args_type; \ + gmock_Impl() {} \ + return_type Perform(const args_type& args) override { \ + return ::testing::internal::ActionHelper<return_type, \ + gmock_Impl>::Perform(this, \ + args); \ + } \ + template <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_> \ + return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) const; \ + \ + private: \ + GTEST_DISALLOW_ASSIGN_(gmock_Impl); \ + }; \ + \ + private: \ + GTEST_DISALLOW_ASSIGN_(name##Action); \ + }; \ + inline name##Action name() { return name##Action(); } \ + template <typename F> \ + template <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_> \ + typename ::testing::internal::Function<F>::Result \ + name##Action::gmock_Impl<F>::gmock_PerformImpl( \ + GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const + +#define ACTION_P(name, ...) \ + GMOCK_INTERNAL_ACTION(name, name##ActionP, (__VA_ARGS__)) + +#define ACTION_P2(name, ...) \ + GMOCK_INTERNAL_ACTION(name, name##ActionP2, (__VA_ARGS__)) + +#define ACTION_P3(name, ...) \ + GMOCK_INTERNAL_ACTION(name, name##ActionP3, (__VA_ARGS__)) + +#define ACTION_P4(name, ...) \ + GMOCK_INTERNAL_ACTION(name, name##ActionP4, (__VA_ARGS__)) + +#define ACTION_P5(name, ...) \ + GMOCK_INTERNAL_ACTION(name, name##ActionP5, (__VA_ARGS__)) + +#define ACTION_P6(name, ...) \ + GMOCK_INTERNAL_ACTION(name, name##ActionP6, (__VA_ARGS__)) + +#define ACTION_P7(name, ...) \ + GMOCK_INTERNAL_ACTION(name, name##ActionP7, (__VA_ARGS__)) + +#define ACTION_P8(name, ...) \ + GMOCK_INTERNAL_ACTION(name, name##ActionP8, (__VA_ARGS__)) + +#define ACTION_P9(name, ...) \ + GMOCK_INTERNAL_ACTION(name, name##ActionP9, (__VA_ARGS__)) + +#define ACTION_P10(name, ...) \ + GMOCK_INTERNAL_ACTION(name, name##ActionP10, (__VA_ARGS__)) + } // namespace testing #ifdef _MSC_VER diff --git a/googlemock/include/gmock/gmock-generated-actions.h b/googlemock/include/gmock/gmock-generated-actions.h index 2db4b3c1..c78debef 100644 --- a/googlemock/include/gmock/gmock-generated-actions.h +++ b/googlemock/include/gmock/gmock-generated-actions.h @@ -47,114 +47,6 @@ #include "gmock/gmock-actions.h" #include "gmock/internal/gmock-port.h" -// The ACTION* family of macros can be used in a namespace scope to -// define custom actions easily. The syntax: -// -// ACTION(name) { statements; } -// -// will define an action with the given name that executes the -// statements. The value returned by the statements will be used as -// the return value of the action. Inside the statements, you can -// refer to the K-th (0-based) argument of the mock function by -// 'argK', and refer to its type by 'argK_type'. For example: -// -// ACTION(IncrementArg1) { -// arg1_type temp = arg1; -// return ++(*temp); -// } -// -// allows you to write -// -// ...WillOnce(IncrementArg1()); -// -// You can also refer to the entire argument tuple and its type by -// 'args' and 'args_type', and refer to the mock function type and its -// return type by 'function_type' and 'return_type'. -// -// Note that you don't need to specify the types of the mock function -// arguments. However rest assured that your code is still type-safe: -// you'll get a compiler error if *arg1 doesn't support the ++ -// operator, or if the type of ++(*arg1) isn't compatible with the -// mock function's return type, for example. -// -// Sometimes you'll want to parameterize the action. For that you can use -// another macro: -// -// ACTION_P(name, param_name) { statements; } -// -// For example: -// -// ACTION_P(Add, n) { return arg0 + n; } -// -// will allow you to write: -// -// ...WillOnce(Add(5)); -// -// Note that you don't need to provide the type of the parameter -// either. If you need to reference the type of a parameter named -// 'foo', you can write 'foo_type'. For example, in the body of -// ACTION_P(Add, n) above, you can write 'n_type' to refer to the type -// of 'n'. -// -// We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P10 to support -// multi-parameter actions. -// -// For the purpose of typing, you can view -// -// ACTION_Pk(Foo, p1, ..., pk) { ... } -// -// as shorthand for -// -// template <typename p1_type, ..., typename pk_type> -// FooActionPk<p1_type, ..., pk_type> Foo(p1_type p1, ..., pk_type pk) { ... } -// -// In particular, you can provide the template type arguments -// explicitly when invoking Foo(), as in Foo<long, bool>(5, false); -// although usually you can rely on the compiler to infer the types -// for you automatically. You can assign the result of expression -// Foo(p1, ..., pk) to a variable of type FooActionPk<p1_type, ..., -// pk_type>. This can be useful when composing actions. -// -// You can also overload actions with different numbers of parameters: -// -// ACTION_P(Plus, a) { ... } -// ACTION_P2(Plus, a, b) { ... } -// -// While it's tempting to always use the ACTION* macros when defining -// a new action, you should also consider implementing ActionInterface -// or using MakePolymorphicAction() instead, especially if you need to -// use the action a lot. While these approaches require more work, -// they give you more control on the types of the mock function -// arguments and the action parameters, which in general leads to -// better compiler error messages that pay off in the long run. They -// also allow overloading actions based on parameter types (as opposed -// to just based on the number of parameters). -// -// CAVEAT: -// -// ACTION*() can only be used in a namespace scope as templates cannot be -// declared inside of a local class. -// Users can, however, define any local functors (e.g. a lambda) that -// can be used as actions. -// -// MORE INFORMATION: -// -// To learn more about using these macros, please search for 'ACTION' on -// https://github.com/google/googletest/blob/master/googlemock/docs/cook_book.md - -// An internal macro needed for implementing ACTION*(). -#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\ - const args_type& args GTEST_ATTRIBUTE_UNUSED_, \ - const arg0_type& arg0 GTEST_ATTRIBUTE_UNUSED_, \ - const arg1_type& arg1 GTEST_ATTRIBUTE_UNUSED_, \ - const arg2_type& arg2 GTEST_ATTRIBUTE_UNUSED_, \ - const arg3_type& arg3 GTEST_ATTRIBUTE_UNUSED_, \ - const arg4_type& arg4 GTEST_ATTRIBUTE_UNUSED_, \ - const arg5_type& arg5 GTEST_ATTRIBUTE_UNUSED_, \ - const arg6_type& arg6 GTEST_ATTRIBUTE_UNUSED_, \ - const arg7_type& arg7 GTEST_ATTRIBUTE_UNUSED_, \ - const arg8_type& arg8 GTEST_ATTRIBUTE_UNUSED_, \ - const arg9_type& arg9 GTEST_ATTRIBUTE_UNUSED_ // Sometimes you want to give an action explicit template parameters // that cannot be inferred from its value parameters. ACTION() and @@ -540,16 +432,8 @@ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ Perform(this, args);\ }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ + template <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\ + return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) const;\ GMOCK_INTERNAL_DEFN_##value_params\ private:\ GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ @@ -576,10 +460,7 @@ template <GMOCK_INTERNAL_DECL_##template_params\ GMOCK_INTERNAL_DECL_TYPE_##value_params>\ template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ + template <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\ typename ::testing::internal::Function<F>::Result\ GMOCK_ACTION_CLASS_(name, value_params)<\ GMOCK_INTERNAL_LIST_##template_params\ @@ -587,749 +468,6 @@ gmock_PerformImpl(\ GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const -#define ACTION(name)\ - class name##Action : public ::testing::internal::ActionImpl<name##Action> {\ - using base_type = ::testing::internal::ActionImpl<name##Action>;\ - public:\ - using base_type::base_type;\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - gmock_Impl() {}\ - return_type Perform(const args_type& args) override {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##Action);\ - };\ - inline name##Action name() {\ - return name##Action();\ - }\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - name##Action::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P(name, p0)\ - template <typename p0##_type>\ - class name##ActionP : public \ - ::testing::internal::ActionImpl<name##ActionP<p0##_type>> {\ - using base_type = ::testing::internal::ActionImpl<name##ActionP>;\ - public:\ - using base_type::base_type;\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - explicit gmock_Impl(p0##_type gmock_p0) : \ - p0(::std::forward<p0##_type>(gmock_p0)) {}\ - return_type Perform(const args_type& args) override {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - p0##_type p0;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP);\ - };\ - template <typename p0##_type>\ - inline name##ActionP<p0##_type> name(p0##_type p0) {\ - return name##ActionP<p0##_type>(p0);\ - }\ - template <typename p0##_type>\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - name##ActionP<p0##_type>::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P2(name, p0, p1)\ - template <typename p0##_type, typename p1##_type>\ - class name##ActionP2 : public \ - ::testing::internal::ActionImpl<name##ActionP2<p0##_type, \ - p1##_type>> {\ - using base_type = ::testing::internal::ActionImpl<name##ActionP2>;\ - public:\ - using base_type::base_type;\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, \ - p1##_type gmock_p1) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)) {}\ - return_type Perform(const args_type& args) override {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP2);\ - };\ - template <typename p0##_type, typename p1##_type>\ - inline name##ActionP2<p0##_type, p1##_type> name(p0##_type p0, \ - p1##_type p1) {\ - return name##ActionP2<p0##_type, p1##_type>(p0, p1);\ - }\ - template <typename p0##_type, typename p1##_type>\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - name##ActionP2<p0##_type, p1##_type>::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P3(name, p0, p1, p2)\ - template <typename p0##_type, typename p1##_type, typename p2##_type>\ - class name##ActionP3 : public \ - ::testing::internal::ActionImpl<name##ActionP3<p0##_type, p1##_type, \ - p2##_type>> {\ - using base_type = ::testing::internal::ActionImpl<name##ActionP3>;\ - public:\ - using base_type::base_type;\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \ - p2##_type gmock_p2) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)) {}\ - return_type Perform(const args_type& args) override {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP3);\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type>\ - inline name##ActionP3<p0##_type, p1##_type, p2##_type> name(p0##_type p0, \ - p1##_type p1, p2##_type p2) {\ - return name##ActionP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type>\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - name##ActionP3<p0##_type, p1##_type, \ - p2##_type>::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P4(name, p0, p1, p2, p3)\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type>\ - class name##ActionP4 : public \ - ::testing::internal::ActionImpl<name##ActionP4<p0##_type, p1##_type, \ - p2##_type, p3##_type>> {\ - using base_type = ::testing::internal::ActionImpl<name##ActionP4>;\ - public:\ - using base_type::base_type;\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)), \ - p3(::std::forward<p3##_type>(gmock_p3)) {}\ - return_type Perform(const args_type& args) override {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP4);\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type>\ - inline name##ActionP4<p0##_type, p1##_type, p2##_type, \ - p3##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \ - p3##_type p3) {\ - return name##ActionP4<p0##_type, p1##_type, p2##_type, p3##_type>(p0, p1, \ - p2, p3);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type>\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - name##ActionP4<p0##_type, p1##_type, p2##_type, \ - p3##_type>::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P5(name, p0, p1, p2, p3, p4)\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type>\ - class name##ActionP5 : public \ - ::testing::internal::ActionImpl<name##ActionP5<p0##_type, p1##_type, \ - p2##_type, p3##_type, p4##_type>> {\ - using base_type = ::testing::internal::ActionImpl<name##ActionP5>;\ - public:\ - using base_type::base_type;\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, \ - p4##_type gmock_p4) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)), \ - p3(::std::forward<p3##_type>(gmock_p3)), \ - p4(::std::forward<p4##_type>(gmock_p4)) {}\ - return_type Perform(const args_type& args) override {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP5);\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type>\ - inline name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ - p4##_type p4) {\ - return name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type>(p0, p1, p2, p3, p4);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type>\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type>::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P6(name, p0, p1, p2, p3, p4, p5)\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type>\ - class name##ActionP6 : public \ - ::testing::internal::ActionImpl<name##ActionP6<p0##_type, p1##_type, \ - p2##_type, p3##_type, p4##_type, p5##_type>> {\ - using base_type = ::testing::internal::ActionImpl<name##ActionP6>;\ - public:\ - using base_type::base_type;\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, \ - p5##_type gmock_p5) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)), \ - p3(::std::forward<p3##_type>(gmock_p3)), \ - p4(::std::forward<p4##_type>(gmock_p4)), \ - p5(::std::forward<p5##_type>(gmock_p5)) {}\ - return_type Perform(const args_type& args) override {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP6);\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type>\ - inline name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, \ - p3##_type p3, p4##_type p4, p5##_type p5) {\ - return name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type>(p0, p1, p2, p3, p4, p5);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type>\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type>::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P7(name, p0, p1, p2, p3, p4, p5, p6)\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type>\ - class name##ActionP7 : public \ - ::testing::internal::ActionImpl<name##ActionP7<p0##_type, p1##_type, \ - p2##_type, p3##_type, p4##_type, p5##_type, p6##_type>> {\ - using base_type = ::testing::internal::ActionImpl<name##ActionP7>;\ - public:\ - using base_type::base_type;\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)), \ - p3(::std::forward<p3##_type>(gmock_p3)), \ - p4(::std::forward<p4##_type>(gmock_p4)), \ - p5(::std::forward<p5##_type>(gmock_p5)), \ - p6(::std::forward<p6##_type>(gmock_p6)) {}\ - return_type Perform(const args_type& args) override {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP7);\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type>\ - inline name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type> name(p0##_type p0, p1##_type p1, \ - p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ - p6##_type p6) {\ - return name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type>(p0, p1, p2, p3, p4, p5, p6);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type>\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type, p6##_type>::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P8(name, p0, p1, p2, p3, p4, p5, p6, p7)\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type>\ - class name##ActionP8 : public \ - ::testing::internal::ActionImpl<name##ActionP8<p0##_type, p1##_type, \ - p2##_type, p3##_type, p4##_type, p5##_type, p6##_type, p7##_type>> {\ - using base_type = ::testing::internal::ActionImpl<name##ActionP8>;\ - public:\ - using base_type::base_type;\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, \ - p7##_type gmock_p7) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)), \ - p3(::std::forward<p3##_type>(gmock_p3)), \ - p4(::std::forward<p4##_type>(gmock_p4)), \ - p5(::std::forward<p5##_type>(gmock_p5)), \ - p6(::std::forward<p6##_type>(gmock_p6)), \ - p7(::std::forward<p7##_type>(gmock_p7)) {}\ - return_type Perform(const args_type& args) override {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - p7##_type p7;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP8);\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type>\ - inline name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type> name(p0##_type p0, \ - p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p4, p5##_type p5, \ - p6##_type p6, p7##_type p7) {\ - return name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type>(p0, p1, p2, p3, p4, p5, \ - p6, p7);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type>\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type, p6##_type, \ - p7##_type>::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8)\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type, typename p8##_type>\ - class name##ActionP9 : public \ - ::testing::internal::ActionImpl<name##ActionP9<p0##_type, p1##_type, \ - p2##_type, p3##_type, p4##_type, p5##_type, p6##_type, p7##_type, \ - p8##_type>> {\ - using base_type = ::testing::internal::ActionImpl<name##ActionP9>;\ - public:\ - using base_type::base_type;\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7, \ - p8##_type gmock_p8) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)), \ - p3(::std::forward<p3##_type>(gmock_p3)), \ - p4(::std::forward<p4##_type>(gmock_p4)), \ - p5(::std::forward<p5##_type>(gmock_p5)), \ - p6(::std::forward<p6##_type>(gmock_p6)), \ - p7(::std::forward<p7##_type>(gmock_p7)), \ - p8(::std::forward<p8##_type>(gmock_p8)) {}\ - return_type Perform(const args_type& args) override {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - p7##_type p7;\ - p8##_type p8;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP9);\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type, typename p8##_type>\ - inline name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type, \ - p8##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ - p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, \ - p8##_type p8) {\ - return name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type, p8##_type>(p0, p1, p2, \ - p3, p4, p5, p6, p7, p8);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type, typename p8##_type>\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type, p6##_type, p7##_type, \ - p8##_type>::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const - -#define ACTION_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type, typename p8##_type, \ - typename p9##_type>\ - class name##ActionP10 : public \ - ::testing::internal::ActionImpl<name##ActionP10<p0##_type, p1##_type, \ - p2##_type, p3##_type, p4##_type, p5##_type, p6##_type, p7##_type, \ - p8##_type, p9##_type>> {\ - using base_type = ::testing::internal::ActionImpl<name##ActionP10>;\ - public:\ - using base_type::base_type;\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ - p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ - p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ - p9##_type gmock_p9) : p0(::std::forward<p0##_type>(gmock_p0)), \ - p1(::std::forward<p1##_type>(gmock_p1)), \ - p2(::std::forward<p2##_type>(gmock_p2)), \ - p3(::std::forward<p3##_type>(gmock_p3)), \ - p4(::std::forward<p4##_type>(gmock_p4)), \ - p5(::std::forward<p5##_type>(gmock_p5)), \ - p6(::std::forward<p6##_type>(gmock_p6)), \ - p7(::std::forward<p7##_type>(gmock_p7)), \ - p8(::std::forward<p8##_type>(gmock_p8)), \ - p9(::std::forward<p9##_type>(gmock_p9)) {}\ - return_type Perform(const args_type& args) override {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - return_type gmock_PerformImpl(const args_type& args, \ - const arg0_type& arg0, const arg1_type& arg1, \ - const arg2_type& arg2, const arg3_type& arg3, \ - const arg4_type& arg4, const arg5_type& arg5, \ - const arg6_type& arg6, const arg7_type& arg7, \ - const arg8_type& arg8, const arg9_type& arg9) const;\ - p0##_type p0;\ - p1##_type p1;\ - p2##_type p2;\ - p3##_type p3;\ - p4##_type p4;\ - p5##_type p5;\ - p6##_type p6;\ - p7##_type p7;\ - p8##_type p8;\ - p9##_type p9;\ - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - private:\ - GTEST_DISALLOW_ASSIGN_(name##ActionP10);\ - };\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type, typename p8##_type, \ - typename p9##_type>\ - inline name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, \ - p9##_type> name(p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ - p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \ - p9##_type p9) {\ - return name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, \ - p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>(p0, \ - p1, p2, p3, p4, p5, p6, p7, p8, p9);\ - }\ - template <typename p0##_type, typename p1##_type, typename p2##_type, \ - typename p3##_type, typename p4##_type, typename p5##_type, \ - typename p6##_type, typename p7##_type, typename p8##_type, \ - typename p9##_type>\ - template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ - typename ::testing::internal::Function<F>::Result\ - name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ - p5##_type, p6##_type, p7##_type, p8##_type, \ - p9##_type>::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const namespace testing { diff --git a/googlemock/include/gmock/gmock-generated-actions.h.pump b/googlemock/include/gmock/gmock-generated-actions.h.pump index 45751c68..be9d99fe 100644 --- a/googlemock/include/gmock/gmock-generated-actions.h.pump +++ b/googlemock/include/gmock/gmock-generated-actions.h.pump @@ -49,110 +49,9 @@ $$}} This meta comment fixes auto-indentation in editors. #include "gmock/gmock-actions.h" #include "gmock/internal/gmock-port.h" -// The ACTION* family of macros can be used in a namespace scope to -// define custom actions easily. The syntax: -// -// ACTION(name) { statements; } -// -// will define an action with the given name that executes the -// statements. The value returned by the statements will be used as -// the return value of the action. Inside the statements, you can -// refer to the K-th (0-based) argument of the mock function by -// 'argK', and refer to its type by 'argK_type'. For example: -// -// ACTION(IncrementArg1) { -// arg1_type temp = arg1; -// return ++(*temp); -// } -// -// allows you to write -// -// ...WillOnce(IncrementArg1()); -// -// You can also refer to the entire argument tuple and its type by -// 'args' and 'args_type', and refer to the mock function type and its -// return type by 'function_type' and 'return_type'. -// -// Note that you don't need to specify the types of the mock function -// arguments. However rest assured that your code is still type-safe: -// you'll get a compiler error if *arg1 doesn't support the ++ -// operator, or if the type of ++(*arg1) isn't compatible with the -// mock function's return type, for example. -// -// Sometimes you'll want to parameterize the action. For that you can use -// another macro: -// -// ACTION_P(name, param_name) { statements; } -// -// For example: -// -// ACTION_P(Add, n) { return arg0 + n; } -// -// will allow you to write: -// -// ...WillOnce(Add(5)); -// -// Note that you don't need to provide the type of the parameter -// either. If you need to reference the type of a parameter named -// 'foo', you can write 'foo_type'. For example, in the body of -// ACTION_P(Add, n) above, you can write 'n_type' to refer to the type -// of 'n'. -// -// We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P$n to support -// multi-parameter actions. -// -// For the purpose of typing, you can view -// -// ACTION_Pk(Foo, p1, ..., pk) { ... } -// -// as shorthand for -// -// template <typename p1_type, ..., typename pk_type> -// FooActionPk<p1_type, ..., pk_type> Foo(p1_type p1, ..., pk_type pk) { ... } -// -// In particular, you can provide the template type arguments -// explicitly when invoking Foo(), as in Foo<long, bool>(5, false); -// although usually you can rely on the compiler to infer the types -// for you automatically. You can assign the result of expression -// Foo(p1, ..., pk) to a variable of type FooActionPk<p1_type, ..., -// pk_type>. This can be useful when composing actions. -// -// You can also overload actions with different numbers of parameters: -// -// ACTION_P(Plus, a) { ... } -// ACTION_P2(Plus, a, b) { ... } -// -// While it's tempting to always use the ACTION* macros when defining -// a new action, you should also consider implementing ActionInterface -// or using MakePolymorphicAction() instead, especially if you need to -// use the action a lot. While these approaches require more work, -// they give you more control on the types of the mock function -// arguments and the action parameters, which in general leads to -// better compiler error messages that pay off in the long run. They -// also allow overloading actions based on parameter types (as opposed -// to just based on the number of parameters). -// -// CAVEAT: -// -// ACTION*() can only be used in a namespace scope as templates cannot be -// declared inside of a local class. -// Users can, however, define any local functors (e.g. a lambda) that -// can be used as actions. -// -// MORE INFORMATION: -// -// To learn more about using these macros, please search for 'ACTION' on -// https://github.com/google/googletest/blob/master/googlemock/docs/cook_book.md - $range i 0..n $range k 0..n-1 -// An internal macro needed for implementing ACTION*(). -#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\ - const args_type& args GTEST_ATTRIBUTE_UNUSED_ -$for k [[, \ - const arg$k[[]]_type& arg$k GTEST_ATTRIBUTE_UNUSED_]] - // Sometimes you want to give an action explicit template parameters // that cannot be inferred from its value parameters. ACTION() and @@ -351,9 +250,8 @@ $range k 0..n-1 return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ Perform(this, args);\ }\ - template <$for k, [[typename arg$k[[]]_type]]>\ - return_type gmock_PerformImpl(const args_type& args[[]] -$for k [[, const arg$k[[]]_type& arg$k]]) const;\ + template <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\ + return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) const;\ GMOCK_INTERNAL_DEFN_##value_params\ private:\ GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ @@ -380,10 +278,7 @@ $for k [[, const arg$k[[]]_type& arg$k]]) const;\ template <GMOCK_INTERNAL_DECL_##template_params\ GMOCK_INTERNAL_DECL_TYPE_##value_params>\ template <typename F>\ - template <typename arg0_type, typename arg1_type, typename arg2_type, \ - typename arg3_type, typename arg4_type, typename arg5_type, \ - typename arg6_type, typename arg7_type, typename arg8_type, \ - typename arg9_type>\ + template <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\ typename ::testing::internal::Function<F>::Result\ GMOCK_ACTION_CLASS_(name, value_params)<\ GMOCK_INTERNAL_LIST_##template_params\ @@ -391,75 +286,6 @@ $for k [[, const arg$k[[]]_type& arg$k]]) const;\ gmock_PerformImpl(\ GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const -$for i - -[[ -$var template = [[$if i==0 [[]] $else [[ -$range j 0..i-1 - - template <$for j, [[typename p$j##_type]]>\ -]]]] -$var class_name = [[name##Action[[$if i==0 [[]] $elif i==1 [[P]] - $else [[P$i]]]]]] -$range j 0..i-1 -$var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]] -$var param_types_and_names = [[$for j, [[p$j##_type p$j]]]] -$var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(::std::forward<p$j##_type>(gmock_p$j))]]]]]] -$var param_field_decls = [[$for j -[[ - - p$j##_type p$j;\ -]]]] -$var param_field_decls2 = [[$for j -[[ - - p$j##_type p$j;\ -]]]] -$var params = [[$for j, [[p$j]]]] -$var param_types = [[$if i==0 [[]] $else [[<$for j, [[p$j##_type]]>]]]] -$var typename_arg_types = [[$for k, [[typename arg$k[[]]_type]]]] -$var arg_types_and_names = [[$for k, [[const arg$k[[]]_type& arg$k]]]] -$var macro_name = [[$if i==0 [[ACTION]] $elif i==1 [[ACTION_P]] - $else [[ACTION_P$i]]]] - -#define $macro_name(name$for j [[, p$j]])\$template - class $class_name : public ::testing::internal::ActionImpl<$class_name$param_types> {\ - using base_type = ::testing::internal::ActionImpl<$class_name>;\ - public:\ - using base_type::base_type;\ - template <typename F>\ - class gmock_Impl : public ::testing::ActionInterface<F> {\ - public:\ - typedef F function_type;\ - typedef typename ::testing::internal::Function<F>::Result return_type;\ - typedef typename ::testing::internal::Function<F>::ArgumentTuple\ - args_type;\ - [[$if i==1 [[explicit ]]]]gmock_Impl($ctor_param_list)$inits {}\ - return_type Perform(const args_type& args) override {\ - return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ - Perform(this, args);\ - }\ - template <$typename_arg_types>\ - return_type gmock_PerformImpl(const args_type& args, [[]] -$arg_types_and_names) const;\$param_field_decls - private:\ - GTEST_DISALLOW_ASSIGN_(gmock_Impl);\ - };\ - private:\ - GTEST_DISALLOW_ASSIGN_($class_name);\ - };\$template - inline $class_name$param_types name($param_types_and_names) {\ - return $class_name$param_types($params);\ - }\$template - template <typename F>\ - template <$typename_arg_types>\ - typename ::testing::internal::Function<F>::Result\ - $class_name$param_types::gmock_Impl<F>::gmock_PerformImpl(\ - GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const -]] -$$ } // This meta comment fixes auto-indentation in Emacs. It won't -$$ // show up in the generated code. - namespace testing { diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index 96ca8959..c667ecbe 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -6885,7 +6885,8 @@ TEST_F(PredicateFormatterFromMatcherTest, NoShortCircuitOnFailure) { EXPECT_FALSE(result); // Implicit cast to bool. std::string expect = "Value of: dummy-name\nExpected: [DescribeTo]\n" - " Actual: 1" + OfType(internal::GetTypeName<Behavior>()) + ", [MatchAndExplain]"; + " Actual: 1" + + OfType(internal::GetTypeName<Behavior>()) + ", [MatchAndExplain]"; EXPECT_EQ(expect, result.message()); } @@ -6896,7 +6897,8 @@ TEST_F(PredicateFormatterFromMatcherTest, DetectsFlakyShortCircuit) { "Value of: dummy-name\nExpected: [DescribeTo]\n" " The matcher failed on the initial attempt; but passed when rerun to " "generate the explanation.\n" - " Actual: 2" + OfType(internal::GetTypeName<Behavior>()) + ", [MatchAndExplain]"; + " Actual: 2" + + OfType(internal::GetTypeName<Behavior>()) + ", [MatchAndExplain]"; EXPECT_EQ(expect, result.message()); } |