mirror of
https://github.com/google/googletest.git
synced 2025-12-04 14:57:29 +08:00
Googletest export
Use GMOCK_PP to create GMOCK_INTERNAL_ACTION macro. Create GMOCK_INTERNAL_ACTION macro that generates ACTION_P* macroses using GMOCK_PP. PiperOrigin-RevId: 289815906
This commit is contained in:
@@ -47,101 +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
|
||||
|
||||
|
||||
// Sometimes you want to give an action explicit template parameters
|
||||
// that cannot be inferred from its value parameters. ACTION() and
|
||||
@@ -563,628 +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 <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, 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 <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\
|
||||
return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) 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 <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\
|
||||
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 <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\
|
||||
return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) 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 <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\
|
||||
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 <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\
|
||||
return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) 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 <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\
|
||||
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 <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\
|
||||
return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) 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 <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\
|
||||
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 <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\
|
||||
return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) 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 <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\
|
||||
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 <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\
|
||||
return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) 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 <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\
|
||||
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 <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\
|
||||
return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) 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 <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\
|
||||
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 <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\
|
||||
return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) 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 <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\
|
||||
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 <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\
|
||||
return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) 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 <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\
|
||||
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 <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\
|
||||
return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) 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 <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_>\
|
||||
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 {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user