Makes sure all internal macros are named GMOCK_*_. No functionality is changed.

This commit is contained in:
zhanyong.wan 2009-02-19 00:33:37 +00:00
parent 7a13fee2f0
commit e0d051ea64
14 changed files with 465 additions and 445 deletions

View File

@ -100,7 +100,7 @@ class BuiltInDefaultValue<T*> {
// The following specializations define the default values for
// specific types we care about.
#define GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE(type, value) \
#define GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(type, value) \
template <> \
class BuiltInDefaultValue<type> { \
public: \
@ -108,17 +108,17 @@ class BuiltInDefaultValue<T*> {
static type Get() { return value; } \
}
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE(void, ); // NOLINT
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(void, ); // NOLINT
#if GTEST_HAS_GLOBAL_STRING
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE(::string, "");
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(::string, "");
#endif // GTEST_HAS_GLOBAL_STRING
#if GTEST_HAS_STD_STRING
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE(::std::string, "");
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(::std::string, "");
#endif // GTEST_HAS_STD_STRING
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE(bool, false);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE(unsigned char, '\0');
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE(signed char, '\0');
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE(char, '\0');
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(bool, false);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned char, '\0');
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed char, '\0');
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(char, '\0');
// signed wchar_t and unsigned wchar_t are NOT in the C++ standard.
// Using them is a bad practice and not portable. So don't use them.
@ -146,21 +146,21 @@ GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE(char, '\0');
// that type is the same as unsigned int for gcc, and invalid for
// MSVC.
#if defined(__GNUC__) || defined(_NATIVE_WCHAR_T_DEFINED)
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE(wchar_t, 0U); // NOLINT
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(wchar_t, 0U); // NOLINT
#endif
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE(unsigned short, 0U); // NOLINT
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE(signed short, 0); // NOLINT
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE(unsigned int, 0U);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE(signed int, 0);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE(unsigned long, 0UL); // NOLINT
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE(signed long, 0L); // NOLINT
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE(UInt64, 0);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE(Int64, 0);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE(float, 0);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE(double, 0);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned short, 0U); // NOLINT
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed short, 0); // NOLINT
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned int, 0U);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed int, 0);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(unsigned long, 0UL); // NOLINT
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(signed long, 0L); // NOLINT
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(UInt64, 0);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(Int64, 0);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(float, 0);
GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(double, 0);
#undef GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE
#undef GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_
} // namespace internal
@ -460,8 +460,9 @@ class ReturnAction {
// and put the typedef both here (for use in assert statement) and
// in the Impl class. But both definitions must be the same.
typedef typename Function<F>::Result Result;
GMOCK_COMPILE_ASSERT(!internal::is_reference<Result>::value,
use_ReturnRef_instead_of_Return_to_return_a_reference);
GMOCK_COMPILE_ASSERT_(
!internal::is_reference<Result>::value,
use_ReturnRef_instead_of_Return_to_return_a_reference);
return Action<F>(new Impl<F>(value_));
}
private:
@ -489,8 +490,8 @@ class ReturnNullAction {
// Allows ReturnNull() to be used in any pointer-returning function.
template <typename Result, typename ArgumentTuple>
static Result Perform(const ArgumentTuple&) {
GMOCK_COMPILE_ASSERT(internal::is_pointer<Result>::value,
ReturnNull_can_be_used_to_return_a_pointer_only);
GMOCK_COMPILE_ASSERT_(internal::is_pointer<Result>::value,
ReturnNull_can_be_used_to_return_a_pointer_only);
return NULL;
}
};
@ -522,8 +523,8 @@ class ReturnRefAction {
// Asserts that the function return type is a reference. This
// catches the user error of using ReturnRef(x) when Return(x)
// should be used, and generates some helpful error message.
GMOCK_COMPILE_ASSERT(internal::is_reference<Result>::value,
use_Return_instead_of_ReturnRef_to_return_a_value);
GMOCK_COMPILE_ASSERT_(internal::is_reference<Result>::value,
use_Return_instead_of_ReturnRef_to_return_a_value);
return Action<F>(new Impl<F>(ref_));
}
private:

View File

@ -703,7 +703,7 @@ class InvokeArgumentAction10 {
// An INTERNAL macro for extracting the type of a tuple field. It's
// subject to change without notice - DO NOT USE IN USER CODE!
#define GMOCK_FIELD(Tuple, N) \
#define GMOCK_FIELD_(Tuple, N) \
typename ::std::tr1::tuple_element<N, Tuple>::type
// SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::type is the
@ -728,12 +728,12 @@ template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
int k4, int k5, int k6, int k7, int k8, int k9, int k10>
class SelectArgs {
public:
typedef Result type(GMOCK_FIELD(ArgumentTuple, k1),
GMOCK_FIELD(ArgumentTuple, k2), GMOCK_FIELD(ArgumentTuple, k3),
GMOCK_FIELD(ArgumentTuple, k4), GMOCK_FIELD(ArgumentTuple, k5),
GMOCK_FIELD(ArgumentTuple, k6), GMOCK_FIELD(ArgumentTuple, k7),
GMOCK_FIELD(ArgumentTuple, k8), GMOCK_FIELD(ArgumentTuple, k9),
GMOCK_FIELD(ArgumentTuple, k10));
typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9),
GMOCK_FIELD_(ArgumentTuple, k10));
typedef typename Function<type>::ArgumentTuple SelectedArgs;
static SelectedArgs Select(const ArgumentTuple& args) {
using ::std::tr1::get;
@ -759,7 +759,7 @@ template <typename Result, typename ArgumentTuple, int k1>
class SelectArgs<Result, ArgumentTuple,
k1, -1, -1, -1, -1, -1, -1, -1, -1, -1> {
public:
typedef Result type(GMOCK_FIELD(ArgumentTuple, k1));
typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1));
typedef typename Function<type>::ArgumentTuple SelectedArgs;
static SelectedArgs Select(const ArgumentTuple& args) {
using ::std::tr1::get;
@ -771,8 +771,8 @@ template <typename Result, typename ArgumentTuple, int k1, int k2>
class SelectArgs<Result, ArgumentTuple,
k1, k2, -1, -1, -1, -1, -1, -1, -1, -1> {
public:
typedef Result type(GMOCK_FIELD(ArgumentTuple, k1),
GMOCK_FIELD(ArgumentTuple, k2));
typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
GMOCK_FIELD_(ArgumentTuple, k2));
typedef typename Function<type>::ArgumentTuple SelectedArgs;
static SelectedArgs Select(const ArgumentTuple& args) {
using ::std::tr1::get;
@ -784,8 +784,8 @@ template <typename Result, typename ArgumentTuple, int k1, int k2, int k3>
class SelectArgs<Result, ArgumentTuple,
k1, k2, k3, -1, -1, -1, -1, -1, -1, -1> {
public:
typedef Result type(GMOCK_FIELD(ArgumentTuple, k1),
GMOCK_FIELD(ArgumentTuple, k2), GMOCK_FIELD(ArgumentTuple, k3));
typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3));
typedef typename Function<type>::ArgumentTuple SelectedArgs;
static SelectedArgs Select(const ArgumentTuple& args) {
using ::std::tr1::get;
@ -798,9 +798,9 @@ template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
class SelectArgs<Result, ArgumentTuple,
k1, k2, k3, k4, -1, -1, -1, -1, -1, -1> {
public:
typedef Result type(GMOCK_FIELD(ArgumentTuple, k1),
GMOCK_FIELD(ArgumentTuple, k2), GMOCK_FIELD(ArgumentTuple, k3),
GMOCK_FIELD(ArgumentTuple, k4));
typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
GMOCK_FIELD_(ArgumentTuple, k4));
typedef typename Function<type>::ArgumentTuple SelectedArgs;
static SelectedArgs Select(const ArgumentTuple& args) {
using ::std::tr1::get;
@ -814,9 +814,9 @@ template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
class SelectArgs<Result, ArgumentTuple,
k1, k2, k3, k4, k5, -1, -1, -1, -1, -1> {
public:
typedef Result type(GMOCK_FIELD(ArgumentTuple, k1),
GMOCK_FIELD(ArgumentTuple, k2), GMOCK_FIELD(ArgumentTuple, k3),
GMOCK_FIELD(ArgumentTuple, k4), GMOCK_FIELD(ArgumentTuple, k5));
typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5));
typedef typename Function<type>::ArgumentTuple SelectedArgs;
static SelectedArgs Select(const ArgumentTuple& args) {
using ::std::tr1::get;
@ -830,10 +830,10 @@ template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
class SelectArgs<Result, ArgumentTuple,
k1, k2, k3, k4, k5, k6, -1, -1, -1, -1> {
public:
typedef Result type(GMOCK_FIELD(ArgumentTuple, k1),
GMOCK_FIELD(ArgumentTuple, k2), GMOCK_FIELD(ArgumentTuple, k3),
GMOCK_FIELD(ArgumentTuple, k4), GMOCK_FIELD(ArgumentTuple, k5),
GMOCK_FIELD(ArgumentTuple, k6));
typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
GMOCK_FIELD_(ArgumentTuple, k6));
typedef typename Function<type>::ArgumentTuple SelectedArgs;
static SelectedArgs Select(const ArgumentTuple& args) {
using ::std::tr1::get;
@ -847,10 +847,10 @@ template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
class SelectArgs<Result, ArgumentTuple,
k1, k2, k3, k4, k5, k6, k7, -1, -1, -1> {
public:
typedef Result type(GMOCK_FIELD(ArgumentTuple, k1),
GMOCK_FIELD(ArgumentTuple, k2), GMOCK_FIELD(ArgumentTuple, k3),
GMOCK_FIELD(ArgumentTuple, k4), GMOCK_FIELD(ArgumentTuple, k5),
GMOCK_FIELD(ArgumentTuple, k6), GMOCK_FIELD(ArgumentTuple, k7));
typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7));
typedef typename Function<type>::ArgumentTuple SelectedArgs;
static SelectedArgs Select(const ArgumentTuple& args) {
using ::std::tr1::get;
@ -864,11 +864,11 @@ template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
class SelectArgs<Result, ArgumentTuple,
k1, k2, k3, k4, k5, k6, k7, k8, -1, -1> {
public:
typedef Result type(GMOCK_FIELD(ArgumentTuple, k1),
GMOCK_FIELD(ArgumentTuple, k2), GMOCK_FIELD(ArgumentTuple, k3),
GMOCK_FIELD(ArgumentTuple, k4), GMOCK_FIELD(ArgumentTuple, k5),
GMOCK_FIELD(ArgumentTuple, k6), GMOCK_FIELD(ArgumentTuple, k7),
GMOCK_FIELD(ArgumentTuple, k8));
typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
GMOCK_FIELD_(ArgumentTuple, k8));
typedef typename Function<type>::ArgumentTuple SelectedArgs;
static SelectedArgs Select(const ArgumentTuple& args) {
using ::std::tr1::get;
@ -883,11 +883,11 @@ template <typename Result, typename ArgumentTuple, int k1, int k2, int k3,
class SelectArgs<Result, ArgumentTuple,
k1, k2, k3, k4, k5, k6, k7, k8, k9, -1> {
public:
typedef Result type(GMOCK_FIELD(ArgumentTuple, k1),
GMOCK_FIELD(ArgumentTuple, k2), GMOCK_FIELD(ArgumentTuple, k3),
GMOCK_FIELD(ArgumentTuple, k4), GMOCK_FIELD(ArgumentTuple, k5),
GMOCK_FIELD(ArgumentTuple, k6), GMOCK_FIELD(ArgumentTuple, k7),
GMOCK_FIELD(ArgumentTuple, k8), GMOCK_FIELD(ArgumentTuple, k9));
typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1),
GMOCK_FIELD_(ArgumentTuple, k2), GMOCK_FIELD_(ArgumentTuple, k3),
GMOCK_FIELD_(ArgumentTuple, k4), GMOCK_FIELD_(ArgumentTuple, k5),
GMOCK_FIELD_(ArgumentTuple, k6), GMOCK_FIELD_(ArgumentTuple, k7),
GMOCK_FIELD_(ArgumentTuple, k8), GMOCK_FIELD_(ArgumentTuple, k9));
typedef typename Function<type>::ArgumentTuple SelectedArgs;
static SelectedArgs Select(const ArgumentTuple& args) {
using ::std::tr1::get;
@ -897,7 +897,7 @@ class SelectArgs<Result, ArgumentTuple,
}
};
#undef GMOCK_FIELD
#undef GMOCK_FIELD_
// Implements the WithArgs action.
template <typename InnerAction, int k1 = -1, int k2 = -1, int k3 = -1,

View File

@ -270,7 +270,7 @@ $for j [[
// An INTERNAL macro for extracting the type of a tuple field. It's
// subject to change without notice - DO NOT USE IN USER CODE!
#define GMOCK_FIELD(Tuple, N) \
#define GMOCK_FIELD_(Tuple, N) \
typename ::std::tr1::tuple_element<N, Tuple>::type
$range i 1..n
@ -296,7 +296,7 @@ $range i 1..n
template <typename Result, typename ArgumentTuple, $for i, [[int k$i]]>
class SelectArgs {
public:
typedef Result type($for i, [[GMOCK_FIELD(ArgumentTuple, k$i)]]);
typedef Result type($for i, [[GMOCK_FIELD_(ArgumentTuple, k$i)]]);
typedef typename Function<type>::ArgumentTuple SelectedArgs;
static SelectedArgs Select(const ArgumentTuple& args) {
using ::std::tr1::get;
@ -312,7 +312,7 @@ template <typename Result, typename ArgumentTuple$for j1[[, int k$j1]]>
class SelectArgs<Result, ArgumentTuple,
$for j, [[$if j <= i-1 [[k$j]] $else [[-1]]]]> {
public:
typedef Result type($for j1, [[GMOCK_FIELD(ArgumentTuple, k$j1)]]);
typedef Result type($for j1, [[GMOCK_FIELD_(ArgumentTuple, k$j1)]]);
typedef typename Function<type>::ArgumentTuple SelectedArgs;
static SelectedArgs Select(const ArgumentTuple& args) {
using ::std::tr1::get;
@ -322,7 +322,7 @@ class SelectArgs<Result, ArgumentTuple,
]]
#undef GMOCK_FIELD
#undef GMOCK_FIELD_
$var ks = [[$for i, [[k$i]]]]

View File

@ -285,421 +285,421 @@ using internal::FunctionMocker;
// The result type of function type F.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_RESULT(tn, F) tn ::testing::internal::Function<F>::Result
#define GMOCK_RESULT_(tn, F) tn ::testing::internal::Function<F>::Result
// The type of argument N of function type F.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_ARG(tn, F, N) tn ::testing::internal::Function<F>::Argument##N
#define GMOCK_ARG_(tn, F, N) tn ::testing::internal::Function<F>::Argument##N
// The matcher type for argument N of function type F.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_MATCHER(tn, F, N) const ::testing::Matcher<GMOCK_ARG(tn, F, N)>&
#define GMOCK_MATCHER_(tn, F, N) const ::testing::Matcher<GMOCK_ARG_(tn, F, N)>&
// The variable for mocking the given method.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_MOCKER(Method) GMOCK_CONCAT_TOKEN(gmock_##Method##_, __LINE__)
#define GMOCK_MOCKER_(Method) GMOCK_CONCAT_TOKEN_(gmock_##Method##_, __LINE__)
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD0(tn, constness, ct, Method, F) \
GMOCK_RESULT(tn, F) ct Method() constness { \
GMOCK_COMPILE_ASSERT(::std::tr1::tuple_size< \
#define GMOCK_METHOD0_(tn, constness, ct, Method, F) \
GMOCK_RESULT_(tn, F) ct Method() constness { \
GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
tn ::testing::internal::Function<F>::ArgumentTuple>::value == 0, \
this_method_does_not_take_0_arguments); \
GMOCK_MOCKER(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER(Method).Invoke(); \
GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(Method).Invoke(); \
} \
::testing::MockSpec<F>& \
gmock_##Method() constness { \
return GMOCK_MOCKER(Method).RegisterOwner(this).With(); \
return GMOCK_MOCKER_(Method).RegisterOwner(this).With(); \
} \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER(Method)
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method)
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD1(tn, constness, ct, Method, F) \
GMOCK_RESULT(tn, F) ct Method(GMOCK_ARG(tn, F, 1) gmock_a1) constness { \
GMOCK_COMPILE_ASSERT(::std::tr1::tuple_size< \
#define GMOCK_METHOD1_(tn, constness, ct, Method, F) \
GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1) constness { \
GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
tn ::testing::internal::Function<F>::ArgumentTuple>::value == 1, \
this_method_does_not_take_1_argument); \
GMOCK_MOCKER(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER(Method).Invoke(gmock_a1); \
GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(Method).Invoke(gmock_a1); \
} \
::testing::MockSpec<F>& \
gmock_##Method(GMOCK_MATCHER(tn, F, 1) gmock_a1) constness { \
return GMOCK_MOCKER(Method).RegisterOwner(this).With(gmock_a1); \
gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1) constness { \
return GMOCK_MOCKER_(Method).RegisterOwner(this).With(gmock_a1); \
} \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER(Method)
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method)
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD2(tn, constness, ct, Method, F) \
GMOCK_RESULT(tn, F) ct Method(GMOCK_ARG(tn, F, 1) gmock_a1, \
GMOCK_ARG(tn, F, 2) gmock_a2) constness { \
GMOCK_COMPILE_ASSERT(::std::tr1::tuple_size< \
#define GMOCK_METHOD2_(tn, constness, ct, Method, F) \
GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
GMOCK_ARG_(tn, F, 2) gmock_a2) constness { \
GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
tn ::testing::internal::Function<F>::ArgumentTuple>::value == 2, \
this_method_does_not_take_2_arguments); \
GMOCK_MOCKER(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER(Method).Invoke(gmock_a1, gmock_a2); \
GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(Method).Invoke(gmock_a1, gmock_a2); \
} \
::testing::MockSpec<F>& \
gmock_##Method(GMOCK_MATCHER(tn, F, 1) gmock_a1, \
GMOCK_MATCHER(tn, F, 2) gmock_a2) constness { \
return GMOCK_MOCKER(Method).RegisterOwner(this).With(gmock_a1, gmock_a2); \
gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
GMOCK_MATCHER_(tn, F, 2) gmock_a2) constness { \
return GMOCK_MOCKER_(Method).RegisterOwner(this).With(gmock_a1, gmock_a2); \
} \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER(Method)
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method)
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD3(tn, constness, ct, Method, F) \
GMOCK_RESULT(tn, F) ct Method(GMOCK_ARG(tn, F, 1) gmock_a1, \
GMOCK_ARG(tn, F, 2) gmock_a2, \
GMOCK_ARG(tn, F, 3) gmock_a3) constness { \
GMOCK_COMPILE_ASSERT(::std::tr1::tuple_size< \
#define GMOCK_METHOD3_(tn, constness, ct, Method, F) \
GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
GMOCK_ARG_(tn, F, 2) gmock_a2, \
GMOCK_ARG_(tn, F, 3) gmock_a3) constness { \
GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
tn ::testing::internal::Function<F>::ArgumentTuple>::value == 3, \
this_method_does_not_take_3_arguments); \
GMOCK_MOCKER(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER(Method).Invoke(gmock_a1, gmock_a2, gmock_a3); \
GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(Method).Invoke(gmock_a1, gmock_a2, gmock_a3); \
} \
::testing::MockSpec<F>& \
gmock_##Method(GMOCK_MATCHER(tn, F, 1) gmock_a1, \
GMOCK_MATCHER(tn, F, 2) gmock_a2, \
GMOCK_MATCHER(tn, F, 3) gmock_a3) constness { \
return GMOCK_MOCKER(Method).RegisterOwner(this).With(gmock_a1, gmock_a2, \
gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
GMOCK_MATCHER_(tn, F, 3) gmock_a3) constness { \
return GMOCK_MOCKER_(Method).RegisterOwner(this).With(gmock_a1, gmock_a2, \
gmock_a3); \
} \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER(Method)
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method)
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD4(tn, constness, ct, Method, F) \
GMOCK_RESULT(tn, F) ct Method(GMOCK_ARG(tn, F, 1) gmock_a1, \
GMOCK_ARG(tn, F, 2) gmock_a2, \
GMOCK_ARG(tn, F, 3) gmock_a3, \
GMOCK_ARG(tn, F, 4) gmock_a4) constness { \
GMOCK_COMPILE_ASSERT(::std::tr1::tuple_size< \
#define GMOCK_METHOD4_(tn, constness, ct, Method, F) \
GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
GMOCK_ARG_(tn, F, 2) gmock_a2, \
GMOCK_ARG_(tn, F, 3) gmock_a3, \
GMOCK_ARG_(tn, F, 4) gmock_a4) constness { \
GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
tn ::testing::internal::Function<F>::ArgumentTuple>::value == 4, \
this_method_does_not_take_4_arguments); \
GMOCK_MOCKER(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER(Method).Invoke(gmock_a1, gmock_a2, gmock_a3, \
GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(Method).Invoke(gmock_a1, gmock_a2, gmock_a3, \
gmock_a4); \
} \
::testing::MockSpec<F>& \
gmock_##Method(GMOCK_MATCHER(tn, F, 1) gmock_a1, \
GMOCK_MATCHER(tn, F, 2) gmock_a2, \
GMOCK_MATCHER(tn, F, 3) gmock_a3, \
GMOCK_MATCHER(tn, F, 4) gmock_a4) constness { \
return GMOCK_MOCKER(Method).RegisterOwner(this).With(gmock_a1, gmock_a2, \
gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
GMOCK_MATCHER_(tn, F, 3) gmock_a3, \
GMOCK_MATCHER_(tn, F, 4) gmock_a4) constness { \
return GMOCK_MOCKER_(Method).RegisterOwner(this).With(gmock_a1, gmock_a2, \
gmock_a3, gmock_a4); \
} \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER(Method)
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method)
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD5(tn, constness, ct, Method, F) \
GMOCK_RESULT(tn, F) ct Method(GMOCK_ARG(tn, F, 1) gmock_a1, \
GMOCK_ARG(tn, F, 2) gmock_a2, \
GMOCK_ARG(tn, F, 3) gmock_a3, \
GMOCK_ARG(tn, F, 4) gmock_a4, \
GMOCK_ARG(tn, F, 5) gmock_a5) constness { \
GMOCK_COMPILE_ASSERT(::std::tr1::tuple_size< \
#define GMOCK_METHOD5_(tn, constness, ct, Method, F) \
GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
GMOCK_ARG_(tn, F, 2) gmock_a2, \
GMOCK_ARG_(tn, F, 3) gmock_a3, \
GMOCK_ARG_(tn, F, 4) gmock_a4, \
GMOCK_ARG_(tn, F, 5) gmock_a5) constness { \
GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
tn ::testing::internal::Function<F>::ArgumentTuple>::value == 5, \
this_method_does_not_take_5_arguments); \
GMOCK_MOCKER(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER(Method).Invoke(gmock_a1, gmock_a2, gmock_a3, \
GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(Method).Invoke(gmock_a1, gmock_a2, gmock_a3, \
gmock_a4, gmock_a5); \
} \
::testing::MockSpec<F>& \
gmock_##Method(GMOCK_MATCHER(tn, F, 1) gmock_a1, \
GMOCK_MATCHER(tn, F, 2) gmock_a2, \
GMOCK_MATCHER(tn, F, 3) gmock_a3, \
GMOCK_MATCHER(tn, F, 4) gmock_a4, \
GMOCK_MATCHER(tn, F, 5) gmock_a5) constness { \
return GMOCK_MOCKER(Method).RegisterOwner(this).With(gmock_a1, gmock_a2, \
gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
GMOCK_MATCHER_(tn, F, 3) gmock_a3, \
GMOCK_MATCHER_(tn, F, 4) gmock_a4, \
GMOCK_MATCHER_(tn, F, 5) gmock_a5) constness { \
return GMOCK_MOCKER_(Method).RegisterOwner(this).With(gmock_a1, gmock_a2, \
gmock_a3, gmock_a4, gmock_a5); \
} \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER(Method)
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method)
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD6(tn, constness, ct, Method, F) \
GMOCK_RESULT(tn, F) ct Method(GMOCK_ARG(tn, F, 1) gmock_a1, \
GMOCK_ARG(tn, F, 2) gmock_a2, \
GMOCK_ARG(tn, F, 3) gmock_a3, \
GMOCK_ARG(tn, F, 4) gmock_a4, \
GMOCK_ARG(tn, F, 5) gmock_a5, \
GMOCK_ARG(tn, F, 6) gmock_a6) constness { \
GMOCK_COMPILE_ASSERT(::std::tr1::tuple_size< \
#define GMOCK_METHOD6_(tn, constness, ct, Method, F) \
GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
GMOCK_ARG_(tn, F, 2) gmock_a2, \
GMOCK_ARG_(tn, F, 3) gmock_a3, \
GMOCK_ARG_(tn, F, 4) gmock_a4, \
GMOCK_ARG_(tn, F, 5) gmock_a5, \
GMOCK_ARG_(tn, F, 6) gmock_a6) constness { \
GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
tn ::testing::internal::Function<F>::ArgumentTuple>::value == 6, \
this_method_does_not_take_6_arguments); \
GMOCK_MOCKER(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER(Method).Invoke(gmock_a1, gmock_a2, gmock_a3, \
GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(Method).Invoke(gmock_a1, gmock_a2, gmock_a3, \
gmock_a4, gmock_a5, gmock_a6); \
} \
::testing::MockSpec<F>& \
gmock_##Method(GMOCK_MATCHER(tn, F, 1) gmock_a1, \
GMOCK_MATCHER(tn, F, 2) gmock_a2, \
GMOCK_MATCHER(tn, F, 3) gmock_a3, \
GMOCK_MATCHER(tn, F, 4) gmock_a4, \
GMOCK_MATCHER(tn, F, 5) gmock_a5, \
GMOCK_MATCHER(tn, F, 6) gmock_a6) constness { \
return GMOCK_MOCKER(Method).RegisterOwner(this).With(gmock_a1, gmock_a2, \
gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
GMOCK_MATCHER_(tn, F, 3) gmock_a3, \
GMOCK_MATCHER_(tn, F, 4) gmock_a4, \
GMOCK_MATCHER_(tn, F, 5) gmock_a5, \
GMOCK_MATCHER_(tn, F, 6) gmock_a6) constness { \
return GMOCK_MOCKER_(Method).RegisterOwner(this).With(gmock_a1, gmock_a2, \
gmock_a3, gmock_a4, gmock_a5, gmock_a6); \
} \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER(Method)
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method)
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD7(tn, constness, ct, Method, F) \
GMOCK_RESULT(tn, F) ct Method(GMOCK_ARG(tn, F, 1) gmock_a1, \
GMOCK_ARG(tn, F, 2) gmock_a2, \
GMOCK_ARG(tn, F, 3) gmock_a3, \
GMOCK_ARG(tn, F, 4) gmock_a4, \
GMOCK_ARG(tn, F, 5) gmock_a5, \
GMOCK_ARG(tn, F, 6) gmock_a6, \
GMOCK_ARG(tn, F, 7) gmock_a7) constness { \
GMOCK_COMPILE_ASSERT(::std::tr1::tuple_size< \
#define GMOCK_METHOD7_(tn, constness, ct, Method, F) \
GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
GMOCK_ARG_(tn, F, 2) gmock_a2, \
GMOCK_ARG_(tn, F, 3) gmock_a3, \
GMOCK_ARG_(tn, F, 4) gmock_a4, \
GMOCK_ARG_(tn, F, 5) gmock_a5, \
GMOCK_ARG_(tn, F, 6) gmock_a6, \
GMOCK_ARG_(tn, F, 7) gmock_a7) constness { \
GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
tn ::testing::internal::Function<F>::ArgumentTuple>::value == 7, \
this_method_does_not_take_7_arguments); \
GMOCK_MOCKER(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER(Method).Invoke(gmock_a1, gmock_a2, gmock_a3, \
GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(Method).Invoke(gmock_a1, gmock_a2, gmock_a3, \
gmock_a4, gmock_a5, gmock_a6, gmock_a7); \
} \
::testing::MockSpec<F>& \
gmock_##Method(GMOCK_MATCHER(tn, F, 1) gmock_a1, \
GMOCK_MATCHER(tn, F, 2) gmock_a2, \
GMOCK_MATCHER(tn, F, 3) gmock_a3, \
GMOCK_MATCHER(tn, F, 4) gmock_a4, \
GMOCK_MATCHER(tn, F, 5) gmock_a5, \
GMOCK_MATCHER(tn, F, 6) gmock_a6, \
GMOCK_MATCHER(tn, F, 7) gmock_a7) constness { \
return GMOCK_MOCKER(Method).RegisterOwner(this).With(gmock_a1, gmock_a2, \
gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
GMOCK_MATCHER_(tn, F, 3) gmock_a3, \
GMOCK_MATCHER_(tn, F, 4) gmock_a4, \
GMOCK_MATCHER_(tn, F, 5) gmock_a5, \
GMOCK_MATCHER_(tn, F, 6) gmock_a6, \
GMOCK_MATCHER_(tn, F, 7) gmock_a7) constness { \
return GMOCK_MOCKER_(Method).RegisterOwner(this).With(gmock_a1, gmock_a2, \
gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \
} \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER(Method)
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method)
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD8(tn, constness, ct, Method, F) \
GMOCK_RESULT(tn, F) ct Method(GMOCK_ARG(tn, F, 1) gmock_a1, \
GMOCK_ARG(tn, F, 2) gmock_a2, \
GMOCK_ARG(tn, F, 3) gmock_a3, \
GMOCK_ARG(tn, F, 4) gmock_a4, \
GMOCK_ARG(tn, F, 5) gmock_a5, \
GMOCK_ARG(tn, F, 6) gmock_a6, \
GMOCK_ARG(tn, F, 7) gmock_a7, \
GMOCK_ARG(tn, F, 8) gmock_a8) constness { \
GMOCK_COMPILE_ASSERT(::std::tr1::tuple_size< \
#define GMOCK_METHOD8_(tn, constness, ct, Method, F) \
GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
GMOCK_ARG_(tn, F, 2) gmock_a2, \
GMOCK_ARG_(tn, F, 3) gmock_a3, \
GMOCK_ARG_(tn, F, 4) gmock_a4, \
GMOCK_ARG_(tn, F, 5) gmock_a5, \
GMOCK_ARG_(tn, F, 6) gmock_a6, \
GMOCK_ARG_(tn, F, 7) gmock_a7, \
GMOCK_ARG_(tn, F, 8) gmock_a8) constness { \
GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
tn ::testing::internal::Function<F>::ArgumentTuple>::value == 8, \
this_method_does_not_take_8_arguments); \
GMOCK_MOCKER(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER(Method).Invoke(gmock_a1, gmock_a2, gmock_a3, \
GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(Method).Invoke(gmock_a1, gmock_a2, gmock_a3, \
gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \
} \
::testing::MockSpec<F>& \
gmock_##Method(GMOCK_MATCHER(tn, F, 1) gmock_a1, \
GMOCK_MATCHER(tn, F, 2) gmock_a2, \
GMOCK_MATCHER(tn, F, 3) gmock_a3, \
GMOCK_MATCHER(tn, F, 4) gmock_a4, \
GMOCK_MATCHER(tn, F, 5) gmock_a5, \
GMOCK_MATCHER(tn, F, 6) gmock_a6, \
GMOCK_MATCHER(tn, F, 7) gmock_a7, \
GMOCK_MATCHER(tn, F, 8) gmock_a8) constness { \
return GMOCK_MOCKER(Method).RegisterOwner(this).With(gmock_a1, gmock_a2, \
gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
GMOCK_MATCHER_(tn, F, 3) gmock_a3, \
GMOCK_MATCHER_(tn, F, 4) gmock_a4, \
GMOCK_MATCHER_(tn, F, 5) gmock_a5, \
GMOCK_MATCHER_(tn, F, 6) gmock_a6, \
GMOCK_MATCHER_(tn, F, 7) gmock_a7, \
GMOCK_MATCHER_(tn, F, 8) gmock_a8) constness { \
return GMOCK_MOCKER_(Method).RegisterOwner(this).With(gmock_a1, gmock_a2, \
gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \
} \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER(Method)
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method)
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD9(tn, constness, ct, Method, F) \
GMOCK_RESULT(tn, F) ct Method(GMOCK_ARG(tn, F, 1) gmock_a1, \
GMOCK_ARG(tn, F, 2) gmock_a2, \
GMOCK_ARG(tn, F, 3) gmock_a3, \
GMOCK_ARG(tn, F, 4) gmock_a4, \
GMOCK_ARG(tn, F, 5) gmock_a5, \
GMOCK_ARG(tn, F, 6) gmock_a6, \
GMOCK_ARG(tn, F, 7) gmock_a7, \
GMOCK_ARG(tn, F, 8) gmock_a8, \
GMOCK_ARG(tn, F, 9) gmock_a9) constness { \
GMOCK_COMPILE_ASSERT(::std::tr1::tuple_size< \
#define GMOCK_METHOD9_(tn, constness, ct, Method, F) \
GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
GMOCK_ARG_(tn, F, 2) gmock_a2, \
GMOCK_ARG_(tn, F, 3) gmock_a3, \
GMOCK_ARG_(tn, F, 4) gmock_a4, \
GMOCK_ARG_(tn, F, 5) gmock_a5, \
GMOCK_ARG_(tn, F, 6) gmock_a6, \
GMOCK_ARG_(tn, F, 7) gmock_a7, \
GMOCK_ARG_(tn, F, 8) gmock_a8, \
GMOCK_ARG_(tn, F, 9) gmock_a9) constness { \
GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
tn ::testing::internal::Function<F>::ArgumentTuple>::value == 9, \
this_method_does_not_take_9_arguments); \
GMOCK_MOCKER(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER(Method).Invoke(gmock_a1, gmock_a2, gmock_a3, \
GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(Method).Invoke(gmock_a1, gmock_a2, gmock_a3, \
gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9); \
} \
::testing::MockSpec<F>& \
gmock_##Method(GMOCK_MATCHER(tn, F, 1) gmock_a1, \
GMOCK_MATCHER(tn, F, 2) gmock_a2, \
GMOCK_MATCHER(tn, F, 3) gmock_a3, \
GMOCK_MATCHER(tn, F, 4) gmock_a4, \
GMOCK_MATCHER(tn, F, 5) gmock_a5, \
GMOCK_MATCHER(tn, F, 6) gmock_a6, \
GMOCK_MATCHER(tn, F, 7) gmock_a7, \
GMOCK_MATCHER(tn, F, 8) gmock_a8, \
GMOCK_MATCHER(tn, F, 9) gmock_a9) constness { \
return GMOCK_MOCKER(Method).RegisterOwner(this).With(gmock_a1, gmock_a2, \
gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
GMOCK_MATCHER_(tn, F, 3) gmock_a3, \
GMOCK_MATCHER_(tn, F, 4) gmock_a4, \
GMOCK_MATCHER_(tn, F, 5) gmock_a5, \
GMOCK_MATCHER_(tn, F, 6) gmock_a6, \
GMOCK_MATCHER_(tn, F, 7) gmock_a7, \
GMOCK_MATCHER_(tn, F, 8) gmock_a8, \
GMOCK_MATCHER_(tn, F, 9) gmock_a9) constness { \
return GMOCK_MOCKER_(Method).RegisterOwner(this).With(gmock_a1, gmock_a2, \
gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \
gmock_a9); \
} \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER(Method)
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method)
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD10(tn, constness, ct, Method, F) \
GMOCK_RESULT(tn, F) ct Method(GMOCK_ARG(tn, F, 1) gmock_a1, \
GMOCK_ARG(tn, F, 2) gmock_a2, \
GMOCK_ARG(tn, F, 3) gmock_a3, \
GMOCK_ARG(tn, F, 4) gmock_a4, \
GMOCK_ARG(tn, F, 5) gmock_a5, \
GMOCK_ARG(tn, F, 6) gmock_a6, \
GMOCK_ARG(tn, F, 7) gmock_a7, \
GMOCK_ARG(tn, F, 8) gmock_a8, \
GMOCK_ARG(tn, F, 9) gmock_a9, \
GMOCK_ARG(tn, F, 10) gmock_a10) constness { \
GMOCK_COMPILE_ASSERT(::std::tr1::tuple_size< \
#define GMOCK_METHOD10_(tn, constness, ct, Method, F) \
GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \
GMOCK_ARG_(tn, F, 2) gmock_a2, \
GMOCK_ARG_(tn, F, 3) gmock_a3, \
GMOCK_ARG_(tn, F, 4) gmock_a4, \
GMOCK_ARG_(tn, F, 5) gmock_a5, \
GMOCK_ARG_(tn, F, 6) gmock_a6, \
GMOCK_ARG_(tn, F, 7) gmock_a7, \
GMOCK_ARG_(tn, F, 8) gmock_a8, \
GMOCK_ARG_(tn, F, 9) gmock_a9, \
GMOCK_ARG_(tn, F, 10) gmock_a10) constness { \
GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
tn ::testing::internal::Function<F>::ArgumentTuple>::value == 10, \
this_method_does_not_take_10_arguments); \
GMOCK_MOCKER(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER(Method).Invoke(gmock_a1, gmock_a2, gmock_a3, \
GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(Method).Invoke(gmock_a1, gmock_a2, gmock_a3, \
gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \
gmock_a10); \
} \
::testing::MockSpec<F>& \
gmock_##Method(GMOCK_MATCHER(tn, F, 1) gmock_a1, \
GMOCK_MATCHER(tn, F, 2) gmock_a2, \
GMOCK_MATCHER(tn, F, 3) gmock_a3, \
GMOCK_MATCHER(tn, F, 4) gmock_a4, \
GMOCK_MATCHER(tn, F, 5) gmock_a5, \
GMOCK_MATCHER(tn, F, 6) gmock_a6, \
GMOCK_MATCHER(tn, F, 7) gmock_a7, \
GMOCK_MATCHER(tn, F, 8) gmock_a8, \
GMOCK_MATCHER(tn, F, 9) gmock_a9, \
GMOCK_MATCHER(tn, F, 10) gmock_a10) constness { \
return GMOCK_MOCKER(Method).RegisterOwner(this).With(gmock_a1, gmock_a2, \
gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \
GMOCK_MATCHER_(tn, F, 2) gmock_a2, \
GMOCK_MATCHER_(tn, F, 3) gmock_a3, \
GMOCK_MATCHER_(tn, F, 4) gmock_a4, \
GMOCK_MATCHER_(tn, F, 5) gmock_a5, \
GMOCK_MATCHER_(tn, F, 6) gmock_a6, \
GMOCK_MATCHER_(tn, F, 7) gmock_a7, \
GMOCK_MATCHER_(tn, F, 8) gmock_a8, \
GMOCK_MATCHER_(tn, F, 9) gmock_a9, \
GMOCK_MATCHER_(tn, F, 10) gmock_a10) constness { \
return GMOCK_MOCKER_(Method).RegisterOwner(this).With(gmock_a1, gmock_a2, \
gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \
gmock_a10); \
} \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER(Method)
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method)
#define MOCK_METHOD0(m, F) GMOCK_METHOD0(, , , m, F)
#define MOCK_METHOD1(m, F) GMOCK_METHOD1(, , , m, F)
#define MOCK_METHOD2(m, F) GMOCK_METHOD2(, , , m, F)
#define MOCK_METHOD3(m, F) GMOCK_METHOD3(, , , m, F)
#define MOCK_METHOD4(m, F) GMOCK_METHOD4(, , , m, F)
#define MOCK_METHOD5(m, F) GMOCK_METHOD5(, , , m, F)
#define MOCK_METHOD6(m, F) GMOCK_METHOD6(, , , m, F)
#define MOCK_METHOD7(m, F) GMOCK_METHOD7(, , , m, F)
#define MOCK_METHOD8(m, F) GMOCK_METHOD8(, , , m, F)
#define MOCK_METHOD9(m, F) GMOCK_METHOD9(, , , m, F)
#define MOCK_METHOD10(m, F) GMOCK_METHOD10(, , , m, F)
#define MOCK_METHOD0(m, F) GMOCK_METHOD0_(, , , m, F)
#define MOCK_METHOD1(m, F) GMOCK_METHOD1_(, , , m, F)
#define MOCK_METHOD2(m, F) GMOCK_METHOD2_(, , , m, F)
#define MOCK_METHOD3(m, F) GMOCK_METHOD3_(, , , m, F)
#define MOCK_METHOD4(m, F) GMOCK_METHOD4_(, , , m, F)
#define MOCK_METHOD5(m, F) GMOCK_METHOD5_(, , , m, F)
#define MOCK_METHOD6(m, F) GMOCK_METHOD6_(, , , m, F)
#define MOCK_METHOD7(m, F) GMOCK_METHOD7_(, , , m, F)
#define MOCK_METHOD8(m, F) GMOCK_METHOD8_(, , , m, F)
#define MOCK_METHOD9(m, F) GMOCK_METHOD9_(, , , m, F)
#define MOCK_METHOD10(m, F) GMOCK_METHOD10_(, , , m, F)
#define MOCK_CONST_METHOD0(m, F) GMOCK_METHOD0(, const, , m, F)
#define MOCK_CONST_METHOD1(m, F) GMOCK_METHOD1(, const, , m, F)
#define MOCK_CONST_METHOD2(m, F) GMOCK_METHOD2(, const, , m, F)
#define MOCK_CONST_METHOD3(m, F) GMOCK_METHOD3(, const, , m, F)
#define MOCK_CONST_METHOD4(m, F) GMOCK_METHOD4(, const, , m, F)
#define MOCK_CONST_METHOD5(m, F) GMOCK_METHOD5(, const, , m, F)
#define MOCK_CONST_METHOD6(m, F) GMOCK_METHOD6(, const, , m, F)
#define MOCK_CONST_METHOD7(m, F) GMOCK_METHOD7(, const, , m, F)
#define MOCK_CONST_METHOD8(m, F) GMOCK_METHOD8(, const, , m, F)
#define MOCK_CONST_METHOD9(m, F) GMOCK_METHOD9(, const, , m, F)
#define MOCK_CONST_METHOD10(m, F) GMOCK_METHOD10(, const, , m, F)
#define MOCK_CONST_METHOD0(m, F) GMOCK_METHOD0_(, const, , m, F)
#define MOCK_CONST_METHOD1(m, F) GMOCK_METHOD1_(, const, , m, F)
#define MOCK_CONST_METHOD2(m, F) GMOCK_METHOD2_(, const, , m, F)
#define MOCK_CONST_METHOD3(m, F) GMOCK_METHOD3_(, const, , m, F)
#define MOCK_CONST_METHOD4(m, F) GMOCK_METHOD4_(, const, , m, F)
#define MOCK_CONST_METHOD5(m, F) GMOCK_METHOD5_(, const, , m, F)
#define MOCK_CONST_METHOD6(m, F) GMOCK_METHOD6_(, const, , m, F)
#define MOCK_CONST_METHOD7(m, F) GMOCK_METHOD7_(, const, , m, F)
#define MOCK_CONST_METHOD8(m, F) GMOCK_METHOD8_(, const, , m, F)
#define MOCK_CONST_METHOD9(m, F) GMOCK_METHOD9_(, const, , m, F)
#define MOCK_CONST_METHOD10(m, F) GMOCK_METHOD10_(, const, , m, F)
#define MOCK_METHOD0_T(m, F) GMOCK_METHOD0(typename, , , m, F)
#define MOCK_METHOD1_T(m, F) GMOCK_METHOD1(typename, , , m, F)
#define MOCK_METHOD2_T(m, F) GMOCK_METHOD2(typename, , , m, F)
#define MOCK_METHOD3_T(m, F) GMOCK_METHOD3(typename, , , m, F)
#define MOCK_METHOD4_T(m, F) GMOCK_METHOD4(typename, , , m, F)
#define MOCK_METHOD5_T(m, F) GMOCK_METHOD5(typename, , , m, F)
#define MOCK_METHOD6_T(m, F) GMOCK_METHOD6(typename, , , m, F)
#define MOCK_METHOD7_T(m, F) GMOCK_METHOD7(typename, , , m, F)
#define MOCK_METHOD8_T(m, F) GMOCK_METHOD8(typename, , , m, F)
#define MOCK_METHOD9_T(m, F) GMOCK_METHOD9(typename, , , m, F)
#define MOCK_METHOD10_T(m, F) GMOCK_METHOD10(typename, , , m, F)
#define MOCK_METHOD0_T(m, F) GMOCK_METHOD0_(typename, , , m, F)
#define MOCK_METHOD1_T(m, F) GMOCK_METHOD1_(typename, , , m, F)
#define MOCK_METHOD2_T(m, F) GMOCK_METHOD2_(typename, , , m, F)
#define MOCK_METHOD3_T(m, F) GMOCK_METHOD3_(typename, , , m, F)
#define MOCK_METHOD4_T(m, F) GMOCK_METHOD4_(typename, , , m, F)
#define MOCK_METHOD5_T(m, F) GMOCK_METHOD5_(typename, , , m, F)
#define MOCK_METHOD6_T(m, F) GMOCK_METHOD6_(typename, , , m, F)
#define MOCK_METHOD7_T(m, F) GMOCK_METHOD7_(typename, , , m, F)
#define MOCK_METHOD8_T(m, F) GMOCK_METHOD8_(typename, , , m, F)
#define MOCK_METHOD9_T(m, F) GMOCK_METHOD9_(typename, , , m, F)
#define MOCK_METHOD10_T(m, F) GMOCK_METHOD10_(typename, , , m, F)
#define MOCK_CONST_METHOD0_T(m, F) GMOCK_METHOD0(typename, const, , m, F)
#define MOCK_CONST_METHOD1_T(m, F) GMOCK_METHOD1(typename, const, , m, F)
#define MOCK_CONST_METHOD2_T(m, F) GMOCK_METHOD2(typename, const, , m, F)
#define MOCK_CONST_METHOD3_T(m, F) GMOCK_METHOD3(typename, const, , m, F)
#define MOCK_CONST_METHOD4_T(m, F) GMOCK_METHOD4(typename, const, , m, F)
#define MOCK_CONST_METHOD5_T(m, F) GMOCK_METHOD5(typename, const, , m, F)
#define MOCK_CONST_METHOD6_T(m, F) GMOCK_METHOD6(typename, const, , m, F)
#define MOCK_CONST_METHOD7_T(m, F) GMOCK_METHOD7(typename, const, , m, F)
#define MOCK_CONST_METHOD8_T(m, F) GMOCK_METHOD8(typename, const, , m, F)
#define MOCK_CONST_METHOD9_T(m, F) GMOCK_METHOD9(typename, const, , m, F)
#define MOCK_CONST_METHOD10_T(m, F) GMOCK_METHOD10(typename, const, , m, F)
#define MOCK_CONST_METHOD0_T(m, F) GMOCK_METHOD0_(typename, const, , m, F)
#define MOCK_CONST_METHOD1_T(m, F) GMOCK_METHOD1_(typename, const, , m, F)
#define MOCK_CONST_METHOD2_T(m, F) GMOCK_METHOD2_(typename, const, , m, F)
#define MOCK_CONST_METHOD3_T(m, F) GMOCK_METHOD3_(typename, const, , m, F)
#define MOCK_CONST_METHOD4_T(m, F) GMOCK_METHOD4_(typename, const, , m, F)
#define MOCK_CONST_METHOD5_T(m, F) GMOCK_METHOD5_(typename, const, , m, F)
#define MOCK_CONST_METHOD6_T(m, F) GMOCK_METHOD6_(typename, const, , m, F)
#define MOCK_CONST_METHOD7_T(m, F) GMOCK_METHOD7_(typename, const, , m, F)
#define MOCK_CONST_METHOD8_T(m, F) GMOCK_METHOD8_(typename, const, , m, F)
#define MOCK_CONST_METHOD9_T(m, F) GMOCK_METHOD9_(typename, const, , m, F)
#define MOCK_CONST_METHOD10_T(m, F) GMOCK_METHOD10_(typename, const, , m, F)
#define MOCK_METHOD0_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD0(, , ct, m, F)
#define MOCK_METHOD1_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD1(, , ct, m, F)
#define MOCK_METHOD2_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD2(, , ct, m, F)
#define MOCK_METHOD3_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD3(, , ct, m, F)
#define MOCK_METHOD4_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD4(, , ct, m, F)
#define MOCK_METHOD5_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD5(, , ct, m, F)
#define MOCK_METHOD6_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD6(, , ct, m, F)
#define MOCK_METHOD7_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD7(, , ct, m, F)
#define MOCK_METHOD8_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD8(, , ct, m, F)
#define MOCK_METHOD9_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD9(, , ct, m, F)
#define MOCK_METHOD10_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD10(, , ct, m, F)
#define MOCK_METHOD0_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD0_(, , ct, m, F)
#define MOCK_METHOD1_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD1_(, , ct, m, F)
#define MOCK_METHOD2_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD2_(, , ct, m, F)
#define MOCK_METHOD3_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD3_(, , ct, m, F)
#define MOCK_METHOD4_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD4_(, , ct, m, F)
#define MOCK_METHOD5_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD5_(, , ct, m, F)
#define MOCK_METHOD6_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD6_(, , ct, m, F)
#define MOCK_METHOD7_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD7_(, , ct, m, F)
#define MOCK_METHOD8_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD8_(, , ct, m, F)
#define MOCK_METHOD9_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD9_(, , ct, m, F)
#define MOCK_METHOD10_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD10_(, , ct, m, F)
#define MOCK_CONST_METHOD0_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD0(, const, ct, m, F)
GMOCK_METHOD0_(, const, ct, m, F)
#define MOCK_CONST_METHOD1_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD1(, const, ct, m, F)
GMOCK_METHOD1_(, const, ct, m, F)
#define MOCK_CONST_METHOD2_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD2(, const, ct, m, F)
GMOCK_METHOD2_(, const, ct, m, F)
#define MOCK_CONST_METHOD3_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD3(, const, ct, m, F)
GMOCK_METHOD3_(, const, ct, m, F)
#define MOCK_CONST_METHOD4_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD4(, const, ct, m, F)
GMOCK_METHOD4_(, const, ct, m, F)
#define MOCK_CONST_METHOD5_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD5(, const, ct, m, F)
GMOCK_METHOD5_(, const, ct, m, F)
#define MOCK_CONST_METHOD6_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD6(, const, ct, m, F)
GMOCK_METHOD6_(, const, ct, m, F)
#define MOCK_CONST_METHOD7_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD7(, const, ct, m, F)
GMOCK_METHOD7_(, const, ct, m, F)
#define MOCK_CONST_METHOD8_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD8(, const, ct, m, F)
GMOCK_METHOD8_(, const, ct, m, F)
#define MOCK_CONST_METHOD9_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD9(, const, ct, m, F)
GMOCK_METHOD9_(, const, ct, m, F)
#define MOCK_CONST_METHOD10_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD10(, const, ct, m, F)
GMOCK_METHOD10_(, const, ct, m, F)
#define MOCK_METHOD0_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD0(typename, , ct, m, F)
GMOCK_METHOD0_(typename, , ct, m, F)
#define MOCK_METHOD1_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD1(typename, , ct, m, F)
GMOCK_METHOD1_(typename, , ct, m, F)
#define MOCK_METHOD2_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD2(typename, , ct, m, F)
GMOCK_METHOD2_(typename, , ct, m, F)
#define MOCK_METHOD3_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD3(typename, , ct, m, F)
GMOCK_METHOD3_(typename, , ct, m, F)
#define MOCK_METHOD4_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD4(typename, , ct, m, F)
GMOCK_METHOD4_(typename, , ct, m, F)
#define MOCK_METHOD5_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD5(typename, , ct, m, F)
GMOCK_METHOD5_(typename, , ct, m, F)
#define MOCK_METHOD6_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD6(typename, , ct, m, F)
GMOCK_METHOD6_(typename, , ct, m, F)
#define MOCK_METHOD7_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD7(typename, , ct, m, F)
GMOCK_METHOD7_(typename, , ct, m, F)
#define MOCK_METHOD8_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD8(typename, , ct, m, F)
GMOCK_METHOD8_(typename, , ct, m, F)
#define MOCK_METHOD9_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD9(typename, , ct, m, F)
GMOCK_METHOD9_(typename, , ct, m, F)
#define MOCK_METHOD10_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD10(typename, , ct, m, F)
GMOCK_METHOD10_(typename, , ct, m, F)
#define MOCK_CONST_METHOD0_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD0(typename, const, ct, m, F)
GMOCK_METHOD0_(typename, const, ct, m, F)
#define MOCK_CONST_METHOD1_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD1(typename, const, ct, m, F)
GMOCK_METHOD1_(typename, const, ct, m, F)
#define MOCK_CONST_METHOD2_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD2(typename, const, ct, m, F)
GMOCK_METHOD2_(typename, const, ct, m, F)
#define MOCK_CONST_METHOD3_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD3(typename, const, ct, m, F)
GMOCK_METHOD3_(typename, const, ct, m, F)
#define MOCK_CONST_METHOD4_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD4(typename, const, ct, m, F)
GMOCK_METHOD4_(typename, const, ct, m, F)
#define MOCK_CONST_METHOD5_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD5(typename, const, ct, m, F)
GMOCK_METHOD5_(typename, const, ct, m, F)
#define MOCK_CONST_METHOD6_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD6(typename, const, ct, m, F)
GMOCK_METHOD6_(typename, const, ct, m, F)
#define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD7(typename, const, ct, m, F)
GMOCK_METHOD7_(typename, const, ct, m, F)
#define MOCK_CONST_METHOD8_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD8(typename, const, ct, m, F)
GMOCK_METHOD8_(typename, const, ct, m, F)
#define MOCK_CONST_METHOD9_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD9(typename, const, ct, m, F)
GMOCK_METHOD9_(typename, const, ct, m, F)
#define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD10(typename, const, ct, m, F)
GMOCK_METHOD10_(typename, const, ct, m, F)
} // namespace testing

View File

@ -106,92 +106,94 @@ using internal::FunctionMocker;
// The result type of function type F.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_RESULT(tn, F) tn ::testing::internal::Function<F>::Result
#define GMOCK_RESULT_(tn, F) tn ::testing::internal::Function<F>::Result
// The type of argument N of function type F.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_ARG(tn, F, N) tn ::testing::internal::Function<F>::Argument##N
#define GMOCK_ARG_(tn, F, N) tn ::testing::internal::Function<F>::Argument##N
// The matcher type for argument N of function type F.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_MATCHER(tn, F, N) const ::testing::Matcher<GMOCK_ARG(tn, F, N)>&
#define GMOCK_MATCHER_(tn, F, N) const ::testing::Matcher<GMOCK_ARG_(tn, F, N)>&
// The variable for mocking the given method.
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_MOCKER(Method) GMOCK_CONCAT_TOKEN(gmock_##Method##_, __LINE__)
#define GMOCK_MOCKER_(Method) GMOCK_CONCAT_TOKEN_(gmock_##Method##_, __LINE__)
$for i [[
$range j 1..i
$var arg_as = [[$for j, \
[[GMOCK_ARG(tn, F, $j) gmock_a$j]]]]
[[GMOCK_ARG_(tn, F, $j) gmock_a$j]]]]
$var as = [[$for j, [[gmock_a$j]]]]
$var matcher_as = [[$for j, \
[[GMOCK_MATCHER(tn, F, $j) gmock_a$j]]]]
[[GMOCK_MATCHER_(tn, F, $j) gmock_a$j]]]]
// INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!!
#define GMOCK_METHOD$i(tn, constness, ct, Method, F) \
GMOCK_RESULT(tn, F) ct Method($arg_as) constness { \
GMOCK_COMPILE_ASSERT(::std::tr1::tuple_size< \
#define GMOCK_METHOD$i[[]]_(tn, constness, ct, Method, F) \
GMOCK_RESULT_(tn, F) ct Method($arg_as) constness { \
GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \
tn ::testing::internal::Function<F>::ArgumentTuple>::value == $i, \
this_method_does_not_take_$i[[]]_argument[[$if i != 1 [[s]]]]); \
GMOCK_MOCKER(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER(Method).Invoke($as); \
GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \
return GMOCK_MOCKER_(Method).Invoke($as); \
} \
::testing::MockSpec<F>& \
gmock_##Method($matcher_as) constness { \
return GMOCK_MOCKER(Method).RegisterOwner(this).With($as); \
return GMOCK_MOCKER_(Method).RegisterOwner(this).With($as); \
} \
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER(Method)
mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method)
]]
$for i [[
#define MOCK_METHOD$i(m, F) GMOCK_METHOD$i(, , , m, F)
#define MOCK_METHOD$i(m, F) GMOCK_METHOD$i[[]]_(, , , m, F)
]]
$for i [[
#define MOCK_CONST_METHOD$i(m, F) GMOCK_METHOD$i(, const, , m, F)
#define MOCK_CONST_METHOD$i(m, F) GMOCK_METHOD$i[[]]_(, const, , m, F)
]]
$for i [[
#define MOCK_METHOD$i[[]]_T(m, F) GMOCK_METHOD$i(typename, , , m, F)
#define MOCK_METHOD$i[[]]_T(m, F) GMOCK_METHOD$i[[]]_(typename, , , m, F)
]]
$for i [[
#define MOCK_CONST_METHOD$i[[]]_T(m, F) GMOCK_METHOD$i(typename, const, , m, F)
#define MOCK_CONST_METHOD$i[[]]_T(m, F) [[]]
GMOCK_METHOD$i[[]]_(typename, const, , m, F)
]]
$for i [[
#define MOCK_METHOD$i[[]]_WITH_CALLTYPE(ct, m, F) GMOCK_METHOD$i(, , ct, m, F)
#define MOCK_METHOD$i[[]]_WITH_CALLTYPE(ct, m, F) [[]]
GMOCK_METHOD$i[[]]_(, , ct, m, F)
]]
$for i [[
#define MOCK_CONST_METHOD$i[[]]_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD$i(, const, ct, m, F)
GMOCK_METHOD$i[[]]_(, const, ct, m, F)
]]
$for i [[
#define MOCK_METHOD$i[[]]_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD$i(typename, , ct, m, F)
GMOCK_METHOD$i[[]]_(typename, , ct, m, F)
]]
$for i [[
#define MOCK_CONST_METHOD$i[[]]_T_WITH_CALLTYPE(ct, m, F) \
GMOCK_METHOD$i(typename, const, ct, m, F)
GMOCK_METHOD$i[[]]_(typename, const, ct, m, F)
]]

View File

@ -56,7 +56,7 @@ inline void ValidateMatcherDescription(const char* description) {
template <typename Container>
class ElementsAreMatcherImpl : public MatcherInterface<Container> {
public:
typedef GMOCK_REMOVE_CONST(GMOCK_REMOVE_REFERENCE(Container)) RawContainer;
typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) RawContainer;
typedef typename RawContainer::value_type Element;
// Constructs the matcher from a sequence of element values or
@ -195,7 +195,8 @@ class ElementsAreMatcher0 {
template <typename Container>
operator Matcher<Container>() const {
typedef GMOCK_REMOVE_CONST(GMOCK_REMOVE_REFERENCE(Container)) RawContainer;
typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
RawContainer;
typedef typename RawContainer::value_type Element;
const Matcher<const Element&>* const matchers = NULL;
@ -210,7 +211,8 @@ class ElementsAreMatcher1 {
template <typename Container>
operator Matcher<Container>() const {
typedef GMOCK_REMOVE_CONST(GMOCK_REMOVE_REFERENCE(Container)) RawContainer;
typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
RawContainer;
typedef typename RawContainer::value_type Element;
const Matcher<const Element&> matchers[] = {
@ -231,7 +233,8 @@ class ElementsAreMatcher2 {
template <typename Container>
operator Matcher<Container>() const {
typedef GMOCK_REMOVE_CONST(GMOCK_REMOVE_REFERENCE(Container)) RawContainer;
typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
RawContainer;
typedef typename RawContainer::value_type Element;
const Matcher<const Element&> matchers[] = {
@ -255,7 +258,8 @@ class ElementsAreMatcher3 {
template <typename Container>
operator Matcher<Container>() const {
typedef GMOCK_REMOVE_CONST(GMOCK_REMOVE_REFERENCE(Container)) RawContainer;
typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
RawContainer;
typedef typename RawContainer::value_type Element;
const Matcher<const Element&> matchers[] = {
@ -281,7 +285,8 @@ class ElementsAreMatcher4 {
template <typename Container>
operator Matcher<Container>() const {
typedef GMOCK_REMOVE_CONST(GMOCK_REMOVE_REFERENCE(Container)) RawContainer;
typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
RawContainer;
typedef typename RawContainer::value_type Element;
const Matcher<const Element&> matchers[] = {
@ -309,7 +314,8 @@ class ElementsAreMatcher5 {
template <typename Container>
operator Matcher<Container>() const {
typedef GMOCK_REMOVE_CONST(GMOCK_REMOVE_REFERENCE(Container)) RawContainer;
typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
RawContainer;
typedef typename RawContainer::value_type Element;
const Matcher<const Element&> matchers[] = {
@ -341,7 +347,8 @@ class ElementsAreMatcher6 {
template <typename Container>
operator Matcher<Container>() const {
typedef GMOCK_REMOVE_CONST(GMOCK_REMOVE_REFERENCE(Container)) RawContainer;
typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
RawContainer;
typedef typename RawContainer::value_type Element;
const Matcher<const Element&> matchers[] = {
@ -375,7 +382,8 @@ class ElementsAreMatcher7 {
template <typename Container>
operator Matcher<Container>() const {
typedef GMOCK_REMOVE_CONST(GMOCK_REMOVE_REFERENCE(Container)) RawContainer;
typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
RawContainer;
typedef typename RawContainer::value_type Element;
const Matcher<const Element&> matchers[] = {
@ -411,7 +419,8 @@ class ElementsAreMatcher8 {
template <typename Container>
operator Matcher<Container>() const {
typedef GMOCK_REMOVE_CONST(GMOCK_REMOVE_REFERENCE(Container)) RawContainer;
typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
RawContainer;
typedef typename RawContainer::value_type Element;
const Matcher<const Element&> matchers[] = {
@ -450,7 +459,8 @@ class ElementsAreMatcher9 {
template <typename Container>
operator Matcher<Container>() const {
typedef GMOCK_REMOVE_CONST(GMOCK_REMOVE_REFERENCE(Container)) RawContainer;
typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
RawContainer;
typedef typename RawContainer::value_type Element;
const Matcher<const Element&> matchers[] = {
@ -491,7 +501,8 @@ class ElementsAreMatcher10 {
template <typename Container>
operator Matcher<Container>() const {
typedef GMOCK_REMOVE_CONST(GMOCK_REMOVE_REFERENCE(Container)) RawContainer;
typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
RawContainer;
typedef typename RawContainer::value_type Element;
const Matcher<const Element&> matchers[] = {
@ -532,7 +543,8 @@ class ElementsAreArrayMatcher {
template <typename Container>
operator Matcher<Container>() const {
typedef GMOCK_REMOVE_CONST(GMOCK_REMOVE_REFERENCE(Container)) RawContainer;
typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
RawContainer;
typedef typename RawContainer::value_type Element;
return MakeMatcher(new ElementsAreMatcherImpl<Container>(first_, count_));

View File

@ -59,7 +59,7 @@ inline void ValidateMatcherDescription(const char* description) {
template <typename Container>
class ElementsAreMatcherImpl : public MatcherInterface<Container> {
public:
typedef GMOCK_REMOVE_CONST(GMOCK_REMOVE_REFERENCE(Container)) RawContainer;
typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) RawContainer;
typedef typename RawContainer::value_type Element;
// Constructs the matcher from a sequence of element values or
@ -198,7 +198,8 @@ class ElementsAreMatcher0 {
template <typename Container>
operator Matcher<Container>() const {
typedef GMOCK_REMOVE_CONST(GMOCK_REMOVE_REFERENCE(Container)) RawContainer;
typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
RawContainer;
typedef typename RawContainer::value_type Element;
const Matcher<const Element&>* const matchers = NULL;
@ -218,7 +219,8 @@ class ElementsAreMatcher$i {
template <typename Container>
operator Matcher<Container>() const {
typedef GMOCK_REMOVE_CONST(GMOCK_REMOVE_REFERENCE(Container)) RawContainer;
typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
RawContainer;
typedef typename RawContainer::value_type Element;
const Matcher<const Element&> matchers[] = {
@ -251,7 +253,8 @@ class ElementsAreArrayMatcher {
template <typename Container>
operator Matcher<Container>() const {
typedef GMOCK_REMOVE_CONST(GMOCK_REMOVE_REFERENCE(Container)) RawContainer;
typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))
RawContainer;
typedef typename RawContainer::value_type Element;
return MakeMatcher(new ElementsAreMatcherImpl<Container>(first_, count_));

View File

@ -377,7 +377,7 @@ class TuplePrefix {
// isn't interesting to the user most of the time. The
// matcher's ExplainMatchResultTo() method handles the case when
// the address is interesting.
internal::UniversalPrinter<GMOCK_REMOVE_REFERENCE(Value)>::
internal::UniversalPrinter<GMOCK_REMOVE_REFERENCE_(Value)>::
Print(value, os);
ExplainMatchResultAsNeededTo<Value>(matcher, value, os);
*os << "\n";
@ -412,9 +412,9 @@ bool TupleMatches(const MatcherTuple& matcher_tuple,
using ::std::tr1::tuple_size;
// Makes sure that matcher_tuple and value_tuple have the same
// number of fields.
GMOCK_COMPILE_ASSERT(tuple_size<MatcherTuple>::value ==
tuple_size<ValueTuple>::value,
matcher_and_value_have_different_numbers_of_fields);
GMOCK_COMPILE_ASSERT_(tuple_size<MatcherTuple>::value ==
tuple_size<ValueTuple>::value,
matcher_and_value_have_different_numbers_of_fields);
return TuplePrefix<tuple_size<ValueTuple>::value>::
Matches(matcher_tuple, value_tuple);
}
@ -528,7 +528,7 @@ class AnythingMatcher {
//
// The following template definition assumes that the Rhs parameter is
// a "bare" type (i.e. neither 'const T' nor 'T&').
#define GMOCK_IMPLEMENT_COMPARISON_MATCHER(name, op, relation) \
#define GMOCK_IMPLEMENT_COMPARISON_MATCHER_(name, op, relation) \
template <typename Rhs> class name##Matcher { \
public: \
explicit name##Matcher(const Rhs& rhs) : rhs_(rhs) {} \
@ -558,14 +558,14 @@ class AnythingMatcher {
// Implements Eq(v), Ge(v), Gt(v), Le(v), Lt(v), and Ne(v)
// respectively.
GMOCK_IMPLEMENT_COMPARISON_MATCHER(Eq, ==, "equal to");
GMOCK_IMPLEMENT_COMPARISON_MATCHER(Ge, >=, "greater than or equal to");
GMOCK_IMPLEMENT_COMPARISON_MATCHER(Gt, >, "greater than");
GMOCK_IMPLEMENT_COMPARISON_MATCHER(Le, <=, "less than or equal to");
GMOCK_IMPLEMENT_COMPARISON_MATCHER(Lt, <, "less than");
GMOCK_IMPLEMENT_COMPARISON_MATCHER(Ne, !=, "not equal to");
GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Eq, ==, "equal to");
GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Ge, >=, "greater than or equal to");
GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Gt, >, "greater than");
GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Le, <=, "less than or equal to");
GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Lt, <, "less than");
GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Ne, !=, "not equal to");
#undef GMOCK_IMPLEMENT_COMPARISON_MATCHER
#undef GMOCK_IMPLEMENT_COMPARISON_MATCHER_
// Implements the polymorphic NotNull() matcher, which matches any
// pointer that is not NULL.
@ -893,7 +893,7 @@ class MatchesRegexMatcher {
//
// We define this as a macro in order to eliminate duplicated source
// code.
#define GMOCK_IMPLEMENT_COMPARISON2_MATCHER(name, op, relation) \
#define GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(name, op, relation) \
class name##2Matcher { \
public: \
template <typename T1, typename T2> \
@ -917,14 +917,14 @@ class MatchesRegexMatcher {
}
// Implements Eq(), Ge(), Gt(), Le(), Lt(), and Ne() respectively.
GMOCK_IMPLEMENT_COMPARISON2_MATCHER(Eq, ==, "equal to");
GMOCK_IMPLEMENT_COMPARISON2_MATCHER(Ge, >=, "greater than or equal to");
GMOCK_IMPLEMENT_COMPARISON2_MATCHER(Gt, >, "greater than");
GMOCK_IMPLEMENT_COMPARISON2_MATCHER(Le, <=, "less than or equal to");
GMOCK_IMPLEMENT_COMPARISON2_MATCHER(Lt, <, "less than");
GMOCK_IMPLEMENT_COMPARISON2_MATCHER(Ne, !=, "not equal to");
GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Eq, ==, "equal to");
GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Ge, >=, "greater than or equal to");
GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Gt, >, "greater than");
GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Le, <=, "less than or equal to");
GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Lt, <, "less than");
GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Ne, !=, "not equal to");
#undef GMOCK_IMPLEMENT_COMPARISON2_MATCHER
#undef GMOCK_IMPLEMENT_COMPARISON2_MATCHER_
// Implements the Not(m) matcher, which matches a value that doesn't
// match matcher m.
@ -1364,8 +1364,8 @@ class PointeeMatcher {
template <typename Pointer>
class Impl : public MatcherInterface<Pointer> {
public:
typedef typename PointeeOf<GMOCK_REMOVE_CONST( // NOLINT
GMOCK_REMOVE_REFERENCE(Pointer))>::type Pointee;
typedef typename PointeeOf<GMOCK_REMOVE_CONST_( // NOLINT
GMOCK_REMOVE_REFERENCE_(Pointer))>::type Pointee;
explicit Impl(const InnerMatcher& matcher)
: matcher_(MatcherCast<const Pointee&>(matcher)) {}
@ -1474,7 +1474,7 @@ class PropertyMatcher {
// may cause double references and fail to compile. That's why we
// need GMOCK_REFERENCE_TO_CONST, which works regardless of
// PropertyType being a reference or not.
typedef GMOCK_REFERENCE_TO_CONST(PropertyType) RefToConstProperty;
typedef GMOCK_REFERENCE_TO_CONST_(PropertyType) RefToConstProperty;
PropertyMatcher(PropertyType (Class::*property)() const,
const Matcher<RefToConstProperty>& matcher)
@ -1859,7 +1859,7 @@ inline PolymorphicMatcher<
return MakePolymorphicMatcher(
internal::PropertyMatcher<Class, PropertyType>(
property,
MatcherCast<GMOCK_REFERENCE_TO_CONST(PropertyType)>(matcher)));
MatcherCast<GMOCK_REFERENCE_TO_CONST_(PropertyType)>(matcher)));
// The call to MatcherCast() is required for supporting inner
// matchers of compatible types. For example, it allows
// Property(&Foo::bar, m)

View File

@ -378,7 +378,7 @@ class InSequence {
bool sequence_created_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(InSequence); // NOLINT
} GMOCK_ATTRIBUTE_UNUSED;
} GMOCK_ATTRIBUTE_UNUSED_;
namespace internal {
@ -1562,13 +1562,13 @@ inline const T& Const(const T& x) { return x; }
// of the method used in call is a result of macro expansion.
// See CompilesWithMethodNameExpandedFromMacro tests in
// internal/gmock-spec-builders_test.cc for more details.
#define ON_CALL_IMPL_(obj, call) \
#define GMOCK_ON_CALL_IMPL_(obj, call) \
((obj).gmock_##call).InternalDefaultActionSetAt(__FILE__, __LINE__, \
#obj, #call)
#define ON_CALL(obj, call) ON_CALL_IMPL_(obj, call)
#define ON_CALL(obj, call) GMOCK_ON_CALL_IMPL_(obj, call)
#define EXPECT_CALL_IMPL_(obj, call) \
#define GMOCK_EXPECT_CALL_IMPL_(obj, call) \
((obj).gmock_##call).InternalExpectedAt(__FILE__, __LINE__, #obj, #call)
#define EXPECT_CALL(obj, call) EXPECT_CALL_IMPL_(obj, call)
#define EXPECT_CALL(obj, call) GMOCK_EXPECT_CALL_IMPL_(obj, call)
#endif // GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_

View File

@ -68,7 +68,7 @@
namespace testing {
// Declares Google Mock flags that we want a user to use programmatically.
GMOCK_DECLARE_string(verbose);
GMOCK_DECLARE_string_(verbose);
// Initializes Google Mock. This must be called before running the
// tests. In particular, it parses the command line for the flags

View File

@ -48,13 +48,13 @@
// Concatenates two pre-processor symbols; works for concatenating
// built-in macros like __FILE__ and __LINE__.
#define GMOCK_CONCAT_TOKEN_IMPL(foo, bar) foo##bar
#define GMOCK_CONCAT_TOKEN(foo, bar) GMOCK_CONCAT_TOKEN_IMPL(foo, bar)
#define GMOCK_CONCAT_TOKEN_IMPL_(foo, bar) foo##bar
#define GMOCK_CONCAT_TOKEN_(foo, bar) GMOCK_CONCAT_TOKEN_IMPL_(foo, bar)
#ifdef __GNUC__
#define GMOCK_ATTRIBUTE_UNUSED __attribute__ ((unused))
#define GMOCK_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
#else
#define GMOCK_ATTRIBUTE_UNUSED
#define GMOCK_ATTRIBUTE_UNUSED_
#endif // __GNUC__
class ProtocolMessage;
@ -88,7 +88,7 @@ struct RemoveReference<T&> { typedef T type; }; // NOLINT
// A handy wrapper around RemoveReference that works when the argument
// T depends on template parameters.
#define GMOCK_REMOVE_REFERENCE(T) \
#define GMOCK_REMOVE_REFERENCE_(T) \
typename ::testing::internal::RemoveReference<T>::type
// Removes const from a type if it is a const type, otherwise leaves
@ -101,7 +101,7 @@ struct RemoveConst<const T> { typedef T type; }; // NOLINT
// A handy wrapper around RemoveConst that works when the argument
// T depends on template parameters.
#define GMOCK_REMOVE_CONST(T) \
#define GMOCK_REMOVE_CONST_(T) \
typename ::testing::internal::RemoveConst<T>::type
// Adds reference to a type if it is not a reference type,
@ -114,7 +114,7 @@ struct AddReference<T&> { typedef T& type; }; // NOLINT
// A handy wrapper around AddReference that works when the argument T
// depends on template parameters.
#define GMOCK_ADD_REFERENCE(T) \
#define GMOCK_ADD_REFERENCE_(T) \
typename ::testing::internal::AddReference<T>::type
// Adds a reference to const on top of T as necessary. For example,
@ -126,8 +126,8 @@ struct AddReference<T&> { typedef T& type; }; // NOLINT
// const char& ==> const char&
//
// The argument T must depend on some template parameters.
#define GMOCK_REFERENCE_TO_CONST(T) \
GMOCK_ADD_REFERENCE(const GMOCK_REMOVE_REFERENCE(T))
#define GMOCK_REFERENCE_TO_CONST_(T) \
GMOCK_ADD_REFERENCE_(const GMOCK_REMOVE_REFERENCE_(T))
// PointeeOf<Pointer>::type is the type of a value pointed to by a
// Pointer, which can be either a smart pointer or a raw pointer. The

View File

@ -183,18 +183,18 @@ template <bool>
struct CompileAssert {
};
#define GMOCK_COMPILE_ASSERT(expr, msg) \
#define GMOCK_COMPILE_ASSERT_(expr, msg) \
typedef ::testing::internal::CompileAssert<(bool(expr))> \
msg[bool(expr) ? 1 : -1]
// Implementation details of GMOCK_COMPILE_ASSERT:
// Implementation details of GMOCK_COMPILE_ASSERT_:
//
// - GMOCK_COMPILE_ASSERT works by defining an array type that has -1
// - GMOCK_COMPILE_ASSERT_ works by defining an array type that has -1
// elements (and thus is invalid) when the expression is false.
//
// - The simpler definition
//
// #define GMOCK_COMPILE_ASSERT(expr, msg) typedef char msg[(expr) ? 1 : -1]
// #define GMOCK_COMPILE_ASSERT_(expr, msg) typedef char msg[(expr) ? 1 : -1]
//
// does not work, as gcc supports variable-length arrays whose sizes
// are determined at run-time (this is gcc's extension and not part
@ -202,8 +202,8 @@ struct CompileAssert {
// following code with the simple definition:
//
// int foo;
// GMOCK_COMPILE_ASSERT(foo, msg); // not supposed to compile as foo is
// // not a compile-time constant.
// GMOCK_COMPILE_ASSERT_(foo, msg); // not supposed to compile as foo is
// // not a compile-time constant.
//
// - By using the type CompileAssert<(bool(expr))>, we ensures that
// expr is a compile-time constant. (Template arguments must be
@ -216,7 +216,7 @@ struct CompileAssert {
//
// instead, these compilers will refuse to compile
//
// GMOCK_COMPILE_ASSERT(5 > 0, some_message);
// GMOCK_COMPILE_ASSERT_(5 > 0, some_message);
//
// (They seem to think the ">" in "5 > 0" marks the end of the
// template argument list.)
@ -293,22 +293,23 @@ class GMockCheckProvider {
} // namespace internal
} // namespace testing
// Macro for referencing flags.
// Macro for referencing flags. This is public as we want the user to
// use this syntax to reference Google Mock flags.
#define GMOCK_FLAG(name) FLAGS_gmock_##name
// Macros for declaring flags.
#define GMOCK_DECLARE_bool(name) extern bool GMOCK_FLAG(name)
#define GMOCK_DECLARE_int32(name) \
#define GMOCK_DECLARE_bool_(name) extern bool GMOCK_FLAG(name)
#define GMOCK_DECLARE_int32_(name) \
extern ::testing::internal::Int32 GMOCK_FLAG(name)
#define GMOCK_DECLARE_string(name) \
#define GMOCK_DECLARE_string_(name) \
extern ::testing::internal::String GMOCK_FLAG(name)
// Macros for defining flags.
#define GMOCK_DEFINE_bool(name, default_val, doc) \
#define GMOCK_DEFINE_bool_(name, default_val, doc) \
bool GMOCK_FLAG(name) = (default_val)
#define GMOCK_DEFINE_int32(name, default_val, doc) \
#define GMOCK_DEFINE_int32_(name, default_val, doc) \
::testing::internal::Int32 GMOCK_FLAG(name) = (default_val)
#define GMOCK_DEFINE_string(name, default_val, doc) \
#define GMOCK_DEFINE_string_(name, default_val, doc) \
::testing::internal::String GMOCK_FLAG(name) = (default_val)
#endif // GMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_

View File

@ -34,12 +34,12 @@
namespace testing {
GMOCK_DEFINE_string(verbose, internal::kWarningVerbosity,
"Controls how verbose Google Mock's output is."
" Valid values:\n"
" info - prints all messages.\n"
" warning - prints warnings and errors.\n"
" error - prints errors only.");
GMOCK_DEFINE_string_(verbose, internal::kWarningVerbosity,
"Controls how verbose Google Mock's output is."
" Valid values:\n"
" info - prints all messages.\n"
" warning - prints warnings and errors.\n"
" error - prints errors only.");
namespace internal {

View File

@ -103,11 +103,11 @@ TEST(RemoveReferenceTest, RemovesReference) {
CompileAssertTypesEqual<const char, RemoveReference<const char&>::type>();
}
// Tests GMOCK_REMOVE_REFERENCE.
// Tests GMOCK_REMOVE_REFERENCE_.
template <typename T1, typename T2>
void TestGMockRemoveReference() {
CompileAssertTypesEqual<T1, GMOCK_REMOVE_REFERENCE(T2)>();
CompileAssertTypesEqual<T1, GMOCK_REMOVE_REFERENCE_(T2)>();
}
TEST(RemoveReferenceTest, MacroVersion) {
@ -127,11 +127,11 @@ TEST(RemoveConstTest, RemovesConst) {
CompileAssertTypesEqual<int, RemoveConst<const int>::type>();
}
// Tests GMOCK_REMOVE_CONST.
// Tests GMOCK_REMOVE_CONST_.
template <typename T1, typename T2>
void TestGMockRemoveConst() {
CompileAssertTypesEqual<T1, GMOCK_REMOVE_CONST(T2)>();
CompileAssertTypesEqual<T1, GMOCK_REMOVE_CONST_(T2)>();
}
TEST(RemoveConstTest, MacroVersion) {
@ -152,11 +152,11 @@ TEST(AddReferenceTest, AddsReference) {
CompileAssertTypesEqual<const char&, AddReference<const char>::type>();
}
// Tests GMOCK_ADD_REFERENCE.
// Tests GMOCK_ADD_REFERENCE_.
template <typename T1, typename T2>
void TestGMockAddReference() {
CompileAssertTypesEqual<T1, GMOCK_ADD_REFERENCE(T2)>();
CompileAssertTypesEqual<T1, GMOCK_ADD_REFERENCE_(T2)>();
}
TEST(AddReferenceTest, MacroVersion) {
@ -164,11 +164,11 @@ TEST(AddReferenceTest, MacroVersion) {
TestGMockAddReference<const char&, const char&>();
}
// Tests GMOCK_REFERENCE_TO_CONST.
// Tests GMOCK_REFERENCE_TO_CONST_.
template <typename T1, typename T2>
void TestGMockReferenceToConst() {
CompileAssertTypesEqual<T1, GMOCK_REFERENCE_TO_CONST(T2)>();
CompileAssertTypesEqual<T1, GMOCK_REFERENCE_TO_CONST_(T2)>();
}
TEST(GMockReferenceToConstTest, Works) {
@ -207,8 +207,9 @@ class Derived : public Base {};
// Tests that ImplicitlyConvertible<T1, T2>::value is a compile-time constant.
TEST(ImplicitlyConvertibleTest, ValueIsCompileTimeConstant) {
GMOCK_COMPILE_ASSERT((ImplicitlyConvertible<int, int>::value), const_true);
GMOCK_COMPILE_ASSERT((!ImplicitlyConvertible<void*, int*>::value), const_false);
GMOCK_COMPILE_ASSERT_((ImplicitlyConvertible<int, int>::value), const_true);
GMOCK_COMPILE_ASSERT_((!ImplicitlyConvertible<void*, int*>::value),
const_false);
}
// Tests that ImplicitlyConvertible<T1, T2>::value is true when T1 can
@ -233,8 +234,8 @@ TEST(ImplicitlyConvertibleTest, ValueIsFalseWhenNotConvertible) {
// Tests that IsAProtocolMessage<T>::value is a compile-time constant.
TEST(IsAProtocolMessageTest, ValueIsCompileTimeConstant) {
GMOCK_COMPILE_ASSERT(IsAProtocolMessage<ProtocolMessage>::value, const_true);
GMOCK_COMPILE_ASSERT(!IsAProtocolMessage<int>::value, const_false);
GMOCK_COMPILE_ASSERT_(IsAProtocolMessage<ProtocolMessage>::value, const_true);
GMOCK_COMPILE_ASSERT_(!IsAProtocolMessage<int>::value, const_false);
}
// Tests that IsAProtocolMessage<T>::value is true when T is