Merge pull request #1558 from gennadiycivil/master

RE-Doing the merge, this time with gcc on mac in the PR
This commit is contained in:
Gennadiy Civil 2018-04-11 10:22:10 -04:00 committed by GitHub
commit d5988e7dd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 388 additions and 85 deletions

View File

@ -1,4 +1,6 @@
// This file was GENERATED by a script. DO NOT EDIT BY HAND!!! // This file was GENERATED by command:
// pump.py gmock-generated-actions.h.pump
// DO NOT EDIT BY HAND!!!
// Copyright 2007, Google Inc. // Copyright 2007, Google Inc.
// All rights reserved. // All rights reserved.
@ -45,8 +47,8 @@ namespace testing {
namespace internal { namespace internal {
// InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary // InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary
// function or method with the unpacked values, where F is a function // function, method, or callback with the unpacked values, where F is
// type that takes N arguments. // a function type that takes N arguments.
template <typename Result, typename ArgumentTuple> template <typename Result, typename ArgumentTuple>
class InvokeHelper; class InvokeHelper;
@ -64,6 +66,12 @@ class InvokeHelper<R, ::testing::tuple<> > {
const ::testing::tuple<>&) { const ::testing::tuple<>&) {
return (obj_ptr->*method_ptr)(); return (obj_ptr->*method_ptr)();
} }
template <typename CallbackType>
static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<>&) {
return callback->Run();
}
}; };
template <typename R, typename A1> template <typename R, typename A1>
@ -80,6 +88,12 @@ class InvokeHelper<R, ::testing::tuple<A1> > {
const ::testing::tuple<A1>& args) { const ::testing::tuple<A1>& args) {
return (obj_ptr->*method_ptr)(get<0>(args)); return (obj_ptr->*method_ptr)(get<0>(args));
} }
template <typename CallbackType>
static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<A1>& args) {
return callback->Run(get<0>(args));
}
}; };
template <typename R, typename A1, typename A2> template <typename R, typename A1, typename A2>
@ -96,6 +110,12 @@ class InvokeHelper<R, ::testing::tuple<A1, A2> > {
const ::testing::tuple<A1, A2>& args) { const ::testing::tuple<A1, A2>& args) {
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args)); return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args));
} }
template <typename CallbackType>
static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<A1, A2>& args) {
return callback->Run(get<0>(args), get<1>(args));
}
}; };
template <typename R, typename A1, typename A2, typename A3> template <typename R, typename A1, typename A2, typename A3>
@ -113,6 +133,12 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3> > {
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
get<2>(args)); get<2>(args));
} }
template <typename CallbackType>
static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<A1, A2, A3>& args) {
return callback->Run(get<0>(args), get<1>(args), get<2>(args));
}
}; };
template <typename R, typename A1, typename A2, typename A3, typename A4> template <typename R, typename A1, typename A2, typename A3, typename A4>
@ -132,6 +158,13 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4> > {
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
get<2>(args), get<3>(args)); get<2>(args), get<3>(args));
} }
template <typename CallbackType>
static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<A1, A2, A3, A4>& args) {
return callback->Run(get<0>(args), get<1>(args), get<2>(args),
get<3>(args));
}
}; };
template <typename R, typename A1, typename A2, typename A3, typename A4, template <typename R, typename A1, typename A2, typename A3, typename A4,
@ -152,6 +185,13 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5> > {
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
get<2>(args), get<3>(args), get<4>(args)); get<2>(args), get<3>(args), get<4>(args));
} }
template <typename CallbackType>
static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<A1, A2, A3, A4, A5>& args) {
return callback->Run(get<0>(args), get<1>(args), get<2>(args),
get<3>(args), get<4>(args));
}
}; };
template <typename R, typename A1, typename A2, typename A3, typename A4, template <typename R, typename A1, typename A2, typename A3, typename A4,
@ -172,6 +212,9 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6> > {
return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args),
get<2>(args), get<3>(args), get<4>(args), get<5>(args)); get<2>(args), get<3>(args), get<4>(args), get<5>(args));
} }
// There is no InvokeCallback() for 6-tuples, as google3 callbacks
// support 5 arguments at most.
}; };
template <typename R, typename A1, typename A2, typename A3, typename A4, template <typename R, typename A1, typename A2, typename A3, typename A4,
@ -194,6 +237,9 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7> > {
get<2>(args), get<3>(args), get<4>(args), get<5>(args), get<2>(args), get<3>(args), get<4>(args), get<5>(args),
get<6>(args)); get<6>(args));
} }
// There is no InvokeCallback() for 7-tuples, as google3 callbacks
// support 5 arguments at most.
}; };
template <typename R, typename A1, typename A2, typename A3, typename A4, template <typename R, typename A1, typename A2, typename A3, typename A4,
@ -217,6 +263,9 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8> > {
get<2>(args), get<3>(args), get<4>(args), get<5>(args), get<2>(args), get<3>(args), get<4>(args), get<5>(args),
get<6>(args), get<7>(args)); get<6>(args), get<7>(args));
} }
// There is no InvokeCallback() for 8-tuples, as google3 callbacks
// support 5 arguments at most.
}; };
template <typename R, typename A1, typename A2, typename A3, typename A4, template <typename R, typename A1, typename A2, typename A3, typename A4,
@ -240,6 +289,9 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9> > {
get<2>(args), get<3>(args), get<4>(args), get<5>(args), get<2>(args), get<3>(args), get<4>(args), get<5>(args),
get<6>(args), get<7>(args), get<8>(args)); get<6>(args), get<7>(args), get<8>(args));
} }
// There is no InvokeCallback() for 9-tuples, as google3 callbacks
// support 5 arguments at most.
}; };
template <typename R, typename A1, typename A2, typename A3, typename A4, template <typename R, typename A1, typename A2, typename A3, typename A4,
@ -265,6 +317,34 @@ class InvokeHelper<R, ::testing::tuple<A1, A2, A3, A4, A5, A6, A7, A8, A9,
get<2>(args), get<3>(args), get<4>(args), get<5>(args), get<2>(args), get<3>(args), get<4>(args), get<5>(args),
get<6>(args), get<7>(args), get<8>(args), get<9>(args)); get<6>(args), get<7>(args), get<8>(args), get<9>(args));
} }
// There is no InvokeCallback() for 10-tuples, as google3 callbacks
// support 5 arguments at most.
};
// Implements the Invoke(callback) action.
template <typename CallbackType>
class InvokeCallbackAction {
public:
// The c'tor takes ownership of the callback.
explicit InvokeCallbackAction(CallbackType* callback)
: callback_(callback) {
callback->CheckIsRepeatable(); // Makes sure the callback is permanent.
}
// This type conversion operator template allows Invoke(callback) to
// be used wherever the callback's type is compatible with that of
// the mock function, i.e. if the mock function's arguments can be
// implicitly converted to the callback's arguments and the
// callback's result can be implicitly converted to the mock
// function's result.
template <typename Result, typename ArgumentTuple>
Result Perform(const ArgumentTuple& args) const {
return InvokeHelper<Result, ArgumentTuple>::InvokeCallback(
callback_.get(), args);
}
private:
const linked_ptr<CallbackType> callback_;
}; };
// An INTERNAL macro for extracting the type of a tuple field. It's // An INTERNAL macro for extracting the type of a tuple field. It's
@ -1073,52 +1153,90 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
#define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\ #define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\
() ()
#define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\ #define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\
(p0##_type gmock_p0) : p0(gmock_p0) (p0##_type gmock_p0) : p0(::testing::internal::move(gmock_p0))
#define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\ #define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\
(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), p1(gmock_p1) (p0##_type gmock_p0, \
p1##_type gmock_p1) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1))
#define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\ #define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\
(p0##_type gmock_p0, p1##_type gmock_p1, \ (p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) p2##_type gmock_p2) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2))
#define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\ #define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p3##_type gmock_p3) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3) p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3))
#define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)\ #define GMOCK_INTERNAL_INIT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)\
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), \ p3##_type gmock_p3, \
p2(gmock_p2), p3(gmock_p3), p4(gmock_p4) p4##_type gmock_p4) : p0(::testing::internal::move(gmock_p0)), \
p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4))
#define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)\ #define GMOCK_INTERNAL_INIT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)\
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, \ p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p5##_type gmock_p5) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5))
#define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)\ #define GMOCK_INTERNAL_INIT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)\
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p6##_type gmock_p6) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6))
#define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)\ #define GMOCK_INTERNAL_INIT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)\
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), \ p6##_type gmock_p6, \
p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ p7##_type gmock_p7) : p0(::testing::internal::move(gmock_p0)), \
p7(gmock_p7) p1(::testing::internal::move(gmock_p1)), \
p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7))
#define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ #define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
p7, p8)\ p7, p8)\
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7, \ p6##_type gmock_p6, p7##_type gmock_p7, \
p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p8##_type gmock_p8) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ p1(::testing::internal::move(gmock_p1)), \
p8(gmock_p8) p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)), \
p8(::testing::internal::move(gmock_p8))
#define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \ #define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, \
p7, p8, p9)\ p7, p8, p9)\
(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p9##_type gmock_p9) : p0(::testing::internal::move(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ p1(::testing::internal::move(gmock_p1)), \
p8(gmock_p8), p9(gmock_p9) p2(::testing::internal::move(gmock_p2)), \
p3(::testing::internal::move(gmock_p3)), \
p4(::testing::internal::move(gmock_p4)), \
p5(::testing::internal::move(gmock_p5)), \
p6(::testing::internal::move(gmock_p6)), \
p7(::testing::internal::move(gmock_p7)), \
p8(::testing::internal::move(gmock_p8)), \
p9(::testing::internal::move(gmock_p9))
// Declares the fields for storing the value parameters. // Declares the fields for storing the value parameters.
#define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS() #define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS()
@ -1354,7 +1472,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
template <typename p0##_type>\ template <typename p0##_type>\
class name##ActionP {\ class name##ActionP {\
public:\ public:\
explicit name##ActionP(p0##_type gmock_p0) : p0(gmock_p0) {}\ explicit name##ActionP(p0##_type gmock_p0) : \
p0(::testing::internal::forward<p0##_type>(gmock_p0)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@ -1362,7 +1481,8 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
typedef typename ::testing::internal::Function<F>::Result return_type;\ typedef typename ::testing::internal::Function<F>::Result return_type;\
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ typedef typename ::testing::internal::Function<F>::ArgumentTuple\
args_type;\ args_type;\
explicit gmock_Impl(p0##_type gmock_p0) : p0(gmock_p0) {}\ explicit gmock_Impl(p0##_type gmock_p0) : \
p0(::testing::internal::forward<p0##_type>(gmock_p0)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@ -1404,8 +1524,9 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
template <typename p0##_type, typename p1##_type>\ template <typename p0##_type, typename p1##_type>\
class name##ActionP2 {\ class name##ActionP2 {\
public:\ public:\
name##ActionP2(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ name##ActionP2(p0##_type gmock_p0, \
p1(gmock_p1) {}\ p1##_type gmock_p1) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p1(::testing::internal::forward<p1##_type>(gmock_p1)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@ -1413,8 +1534,9 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
typedef typename ::testing::internal::Function<F>::Result return_type;\ typedef typename ::testing::internal::Function<F>::Result return_type;\
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ typedef typename ::testing::internal::Function<F>::ArgumentTuple\
args_type;\ args_type;\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), \ gmock_Impl(p0##_type gmock_p0, \
p1(gmock_p1) {}\ p1##_type gmock_p1) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p1(::testing::internal::forward<p1##_type>(gmock_p1)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@ -1460,7 +1582,9 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
class name##ActionP3 {\ class name##ActionP3 {\
public:\ public:\
name##ActionP3(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP3(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ p2##_type gmock_p2) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@ -1469,7 +1593,9 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ typedef typename ::testing::internal::Function<F>::ArgumentTuple\
args_type;\ args_type;\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ p2##_type gmock_p2) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@ -1519,8 +1645,11 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
class name##ActionP4 {\ class name##ActionP4 {\
public:\ public:\
name##ActionP4(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP4(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), \ p2##_type gmock_p2, \
p2(gmock_p2), p3(gmock_p3) {}\ p3##_type gmock_p3) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@ -1529,8 +1658,10 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ typedef typename ::testing::internal::Function<F>::ArgumentTuple\
args_type;\ args_type;\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p3##_type gmock_p3) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@ -1587,8 +1718,11 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
public:\ public:\
name##ActionP5(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP5(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, \ p2##_type gmock_p2, p3##_type gmock_p3, \
p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p4##_type gmock_p4) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@ -1597,8 +1731,12 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
typedef typename ::testing::internal::Function<F>::ArgumentTuple\ typedef typename ::testing::internal::Function<F>::ArgumentTuple\
args_type;\ args_type;\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), \ p3##_type gmock_p3, \
p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4) {}\ p4##_type gmock_p4) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@ -1657,8 +1795,12 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
public:\ public:\
name##ActionP6(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP6(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p5##_type gmock_p5) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@ -1668,8 +1810,12 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
args_type;\ args_type;\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \
p3##_type gmock_p3, p4##_type gmock_p4, \ p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p5##_type gmock_p5) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@ -1731,9 +1877,14 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
public:\ public:\
name##ActionP7(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP7(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), \ p5##_type gmock_p5, \
p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), \ p6##_type gmock_p6) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p6(gmock_p6) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@ -1743,8 +1894,13 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
args_type;\ args_type;\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ 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, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p6##_type gmock_p6) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@ -1813,9 +1969,14 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
name##ActionP8(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP8(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5, p6##_type gmock_p6, \ p5##_type gmock_p5, p6##_type gmock_p6, \
p7##_type gmock_p7) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p7##_type gmock_p7) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p7(gmock_p7) {}\ p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
p7(::testing::internal::forward<p7##_type>(gmock_p7)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@ -1825,9 +1986,15 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
args_type;\ args_type;\
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ 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, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7) : p0(gmock_p0), \ p6##_type gmock_p6, \
p1(gmock_p1), p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), \ p7##_type gmock_p7) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p5(gmock_p5), p6(gmock_p6), p7(gmock_p7) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
p7(::testing::internal::forward<p7##_type>(gmock_p7)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@ -1900,9 +2067,15 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
name##ActionP9(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP9(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p8##_type gmock_p8) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7), \ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p8(gmock_p8) {}\ p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
p7(::testing::internal::forward<p7##_type>(gmock_p7)), \
p8(::testing::internal::forward<p8##_type>(gmock_p8)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@ -1913,9 +2086,15 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ 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, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7, \ p6##_type gmock_p6, p7##_type gmock_p7, \
p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p8##_type gmock_p8) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p7(gmock_p7), p8(gmock_p8) {}\ p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
p7(::testing::internal::forward<p7##_type>(gmock_p7)), \
p8(::testing::internal::forward<p8##_type>(gmock_p8)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@ -1992,9 +2171,17 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
name##ActionP10(p0##_type gmock_p0, p1##_type gmock_p1, \ name##ActionP10(p0##_type gmock_p0, p1##_type gmock_p1, \
p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \ p2##_type gmock_p2, p3##_type gmock_p3, p4##_type gmock_p4, \
p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \ p5##_type gmock_p5, p6##_type gmock_p6, p7##_type gmock_p7, \
p8##_type gmock_p8, p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), \ p8##_type gmock_p8, \
p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ p9##_type gmock_p9) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
p7(::testing::internal::forward<p7##_type>(gmock_p7)), \
p8(::testing::internal::forward<p8##_type>(gmock_p8)), \
p9(::testing::internal::forward<p9##_type>(gmock_p9)) {}\
template <typename F>\ template <typename F>\
class gmock_Impl : public ::testing::ActionInterface<F> {\ class gmock_Impl : public ::testing::ActionInterface<F> {\
public:\ public:\
@ -2005,9 +2192,16 @@ DoAll(Action1 a1, Action2 a2, Action3 a3, Action4 a4, Action5 a5, Action6 a6,
gmock_Impl(p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ 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, \ p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \
p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \
p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ p9##_type gmock_p9) : p0(::testing::internal::forward<p0##_type>(gmock_p0)), \
p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), \ p1(::testing::internal::forward<p1##_type>(gmock_p1)), \
p7(gmock_p7), p8(gmock_p8), p9(gmock_p9) {}\ p2(::testing::internal::forward<p2##_type>(gmock_p2)), \
p3(::testing::internal::forward<p3##_type>(gmock_p3)), \
p4(::testing::internal::forward<p4##_type>(gmock_p4)), \
p5(::testing::internal::forward<p5##_type>(gmock_p5)), \
p6(::testing::internal::forward<p6##_type>(gmock_p6)), \
p7(::testing::internal::forward<p7##_type>(gmock_p7)), \
p8(::testing::internal::forward<p8##_type>(gmock_p8)), \
p9(::testing::internal::forward<p9##_type>(gmock_p9)) {}\
virtual return_type Perform(const args_type& args) {\ virtual return_type Perform(const args_type& args) {\
return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\ return ::testing::internal::ActionHelper<return_type, gmock_Impl>::\
Perform(this, args);\ Perform(this, args);\
@ -2369,7 +2563,7 @@ ACTION_TEMPLATE(ReturnNew,
} // namespace testing } // namespace testing
// Include any custom actions added by the local installation. // Include any custom callback actions added by the local installation.
// We must include this header at the end to make sure it can use the // We must include this header at the end to make sure it can use the
// declarations from this file. // declarations from this file.
#include "gmock/internal/custom/gmock-generated-actions.h" #include "gmock/internal/custom/gmock-generated-actions.h"

View File

@ -49,12 +49,13 @@ namespace testing {
namespace internal { namespace internal {
// InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary // InvokeHelper<F> knows how to unpack an N-tuple and invoke an N-ary
// function or method with the unpacked values, where F is a function // function, method, or callback with the unpacked values, where F is
// type that takes N arguments. // a function type that takes N arguments.
template <typename Result, typename ArgumentTuple> template <typename Result, typename ArgumentTuple>
class InvokeHelper; class InvokeHelper;
$var max_callback_arity = 5
$range i 0..n $range i 0..n
$for i [[ $for i [[
$range j 1..i $range j 1..i
@ -76,10 +77,48 @@ class InvokeHelper<R, ::testing::tuple<$as> > {
const ::testing::tuple<$as>&$args) { const ::testing::tuple<$as>&$args) {
return (obj_ptr->*method_ptr)($gets); return (obj_ptr->*method_ptr)($gets);
} }
$if i <= max_callback_arity [[
template <typename CallbackType>
static R InvokeCallback(CallbackType* callback,
const ::testing::tuple<$as>&$args) {
return callback->Run($gets);
}
]] $else [[
// There is no InvokeCallback() for $i-tuples, as google3 callbacks
// support $max_callback_arity arguments at most.
]]
}; };
]] ]]
// Implements the Invoke(callback) action.
template <typename CallbackType>
class InvokeCallbackAction {
public:
// The c'tor takes ownership of the callback.
explicit InvokeCallbackAction(CallbackType* callback)
: callback_(callback) {
callback->CheckIsRepeatable(); // Makes sure the callback is permanent.
}
// This type conversion operator template allows Invoke(callback) to
// be used wherever the callback's type is compatible with that of
// the mock function, i.e. if the mock function's arguments can be
// implicitly converted to the callback's arguments and the
// callback's result can be implicitly converted to the mock
// function's result.
template <typename Result, typename ArgumentTuple>
Result Perform(const ArgumentTuple& args) const {
return InvokeHelper<Result, ArgumentTuple>::InvokeCallback(
callback_.get(), args);
}
private:
const linked_ptr<CallbackType> callback_;
};
// An INTERNAL macro for extracting the type of a tuple field. It's // An INTERNAL macro for extracting the type of a tuple field. It's
// subject to change without notice - DO NOT USE IN USER CODE! // subject to change without notice - DO NOT USE IN USER CODE!
#define GMOCK_FIELD_(Tuple, N) \ #define GMOCK_FIELD_(Tuple, N) \
@ -486,7 +525,7 @@ _VALUE_PARAMS($for j, [[p$j]]) $for j [[, typename p$j##_type]]
$for i [[ $for i [[
$range j 0..i-1 $range j 0..i-1
#define GMOCK_INTERNAL_INIT_AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]])\ #define GMOCK_INTERNAL_INIT_AND_$i[[]]_VALUE_PARAMS($for j, [[p$j]])\
($for j, [[p$j##_type gmock_p$j]])$if i>0 [[ : ]]$for j, [[p$j(gmock_p$j)]] ($for j, [[p$j##_type gmock_p$j]])$if i>0 [[ : ]]$for j, [[p$j(::testing::internal::move(gmock_p$j))]]
]] ]]
@ -619,7 +658,7 @@ $var class_name = [[name##Action[[$if i==0 [[]] $elif i==1 [[P]]
$range j 0..i-1 $range j 0..i-1
$var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]] $var ctor_param_list = [[$for j, [[p$j##_type gmock_p$j]]]]
$var param_types_and_names = [[$for j, [[p$j##_type p$j]]]] $var param_types_and_names = [[$for j, [[p$j##_type p$j]]]]
$var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(gmock_p$j)]]]]]] $var inits = [[$if i==0 [[]] $else [[ : $for j, [[p$j(::testing::internal::forward<p$j##_type>(gmock_p$j))]]]]]]
$var param_field_decls = [[$for j $var param_field_decls = [[$for j
[[ [[

View File

@ -1,6 +1,6 @@
$$ -*- mode: c++; -*- $$ -*- mode: c++; -*-
$$ This is a Pump source file. Please use Pump to convert it to $$ This is a Pump source file. Please use Pump to convert
$$ gmock-generated-actions.h. $$ it to gmock-generated-matchers.h.
$$ $$
$var n = 10 $$ The maximum arity we support. $var n = 10 $$ The maximum arity we support.
$$ }} This line fixes auto-indentation of the following code in Emacs. $$ }} This line fixes auto-indentation of the following code in Emacs.

View File

@ -1,6 +1,6 @@
$$ -*- mode: c++; -*- $$ -*- mode: c++; -*-
$$ This is a Pump source file. Please use Pump to convert it to $$ This is a Pump source file. Please use Pump to convert
$$ gmock-generated-nice-strict.h. $$ it to gmock-generated-nice-strict.h.
$$ $$
$var n = 10 $$ The maximum arity we support. $var n = 10 $$ The maximum arity we support.
// Copyright 2008, Google Inc. // Copyright 2008, Google Inc.

View File

@ -1,5 +1,5 @@
$$ -*- mode: c++; -*- $$ -*- mode: c++; -*-
$$ This is a Pump source file (http://go/pump). Please use Pump to convert $$ This is a Pump source file. Please use Pump to convert
$$ it to callback-actions.h. $$ it to callback-actions.h.
$$ $$
$var max_callback_arity = 5 $var max_callback_arity = 5

View File

@ -48,6 +48,14 @@
namespace testing { namespace testing {
namespace internal { namespace internal {
// Silence MSVC C4100 (unreferenced formal parameter) and
// C4805('==': unsafe mix of type 'const int' and type 'const bool')
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable:4100)
# pragma warning(disable:4805)
#endif
// Joins a vector of strings as if they are fields of a tuple; returns // Joins a vector of strings as if they are fields of a tuple; returns
// the joined string. // the joined string.
GTEST_API_ std::string JoinAsTuple(const Strings& fields); GTEST_API_ std::string JoinAsTuple(const Strings& fields);
@ -510,7 +518,7 @@ struct BooleanConstant {};
// Emit an assertion failure due to incorrect DoDefault() usage. Out-of-lined to // Emit an assertion failure due to incorrect DoDefault() usage. Out-of-lined to
// reduce code size. // reduce code size.
void IllegalDoDefault(const char* file, int line); GTEST_API_ void IllegalDoDefault(const char* file, int line);
#if GTEST_LANG_CXX11 #if GTEST_LANG_CXX11
// Helper types for Apply() below. // Helper types for Apply() below.
@ -539,6 +547,12 @@ auto Apply(F&& f, Tuple&& args)
make_int_pack<std::tuple_size<Tuple>::value>()); make_int_pack<std::tuple_size<Tuple>::value>());
} }
#endif #endif
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // namespace internal } // namespace internal
} // namespace testing } // namespace testing

View File

@ -49,6 +49,15 @@
# include <unistd.h> // NOLINT # include <unistd.h> // NOLINT
#endif #endif
// Silence C4800 (C4800: 'int *const ': forcing value
// to bool 'true' or 'false') for MSVC 14,15
#ifdef _MSC_VER
#if _MSC_VER <= 1900
# pragma warning(push)
# pragma warning(disable:4800)
#endif
#endif
namespace testing { namespace testing {
namespace internal { namespace internal {
@ -866,3 +875,9 @@ InSequence::~InSequence() {
} }
} // namespace testing } // namespace testing
#ifdef _MSC_VER
#if _MSC_VER <= 1900
# pragma warning(pop)
#endif
#endif

View File

@ -33,6 +33,15 @@
// //
// This file tests the built-in actions. // This file tests the built-in actions.
// Silence C4800 (C4800: 'int *const ': forcing value
// to bool 'true' or 'false') for MSVC 14,15
#ifdef _MSC_VER
#if _MSC_VER <= 1900
# pragma warning(push)
# pragma warning(disable:4800)
#endif
#endif
#include "gmock/gmock-actions.h" #include "gmock/gmock-actions.h"
#include <algorithm> #include <algorithm>
#include <iterator> #include <iterator>
@ -1414,3 +1423,10 @@ TEST(MockMethodTest, CanReturnMoveOnlyValue_Invoke) {
#endif // GTEST_HAS_STD_UNIQUE_PTR_ #endif // GTEST_HAS_STD_UNIQUE_PTR_
} // Unnamed namespace } // Unnamed namespace
#ifdef _MSC_VER
#if _MSC_VER == 1900
# pragma warning(pop)
#endif
#endif

View File

@ -374,10 +374,10 @@ class SubstractAction : public ActionInterface<int(int, int)> { // NOLINT
}; };
TEST(WithArgsTest, NonInvokeAction) { TEST(WithArgsTest, NonInvokeAction) {
Action<int(const string&, int, int)> a = // NOLINT Action<int(const std::string&, int, int)> a = // NOLINT
WithArgs<2, 1>(MakeAction(new SubstractAction)); WithArgs<2, 1>(MakeAction(new SubstractAction));
string s("hello"); tuple<std::string, int, int> dummy = make_tuple(std::string("hi"), 2, 10);
EXPECT_EQ(8, a.Perform(tuple<const string&, int, int>(s, 2, 10))); EXPECT_EQ(8, a.Perform(dummy));
} }
// Tests using WithArgs to pass all original arguments in the original order. // Tests using WithArgs to pass all original arguments in the original order.
@ -754,7 +754,8 @@ TEST(ActionPMacroTest, CanReferenceArgumentAndParameterTypes) {
TEST(ActionPMacroTest, WorksInCompatibleMockFunction) { TEST(ActionPMacroTest, WorksInCompatibleMockFunction) {
Action<std::string(const std::string& s)> a1 = Plus("tail"); Action<std::string(const std::string& s)> a1 = Plus("tail");
const std::string re = "re"; const std::string re = "re";
EXPECT_EQ("retail", a1.Perform(tuple<const std::string&>(re))); tuple<const std::string> dummy = make_tuple(re);
EXPECT_EQ("retail", a1.Perform(dummy));
} }
// Tests that we can use ACTION*() to define actions overloaded on the // Tests that we can use ACTION*() to define actions overloaded on the
@ -796,7 +797,8 @@ TEST(ActionPnMacroTest, WorksFor3Parameters) {
Action<std::string(const std::string& s)> a2 = Plus("tail", "-", ">"); Action<std::string(const std::string& s)> a2 = Plus("tail", "-", ">");
const std::string re = "re"; const std::string re = "re";
EXPECT_EQ("retail->", a2.Perform(tuple<const std::string&>(re))); tuple<const std::string> dummy = make_tuple(re);
EXPECT_EQ("retail->", a2.Perform(dummy));
} }
ACTION_P4(Plus, p0, p1, p2, p3) { return arg0 + p0 + p1 + p2 + p3; } ACTION_P4(Plus, p0, p1, p2, p3) { return arg0 + p0 + p1 + p2 + p3; }
@ -1120,7 +1122,7 @@ TEST(ActionTemplateTest, WorksForIntegralTemplateParams) {
EXPECT_FALSE(b); // Verifies that resetter is deleted. EXPECT_FALSE(b); // Verifies that resetter is deleted.
} }
// Tests that ACTION_TEMPLATE works for a template with template parameters. // Tests that ACTION_TEMPLATES works for template template parameters.
ACTION_TEMPLATE(ReturnSmartPointer, ACTION_TEMPLATE(ReturnSmartPointer,
HAS_1_TEMPLATE_PARAMS(template <typename Pointee> class, HAS_1_TEMPLATE_PARAMS(template <typename Pointee> class,
Pointer), Pointer),

View File

@ -39,6 +39,12 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
// Silence C4100 (unreferenced formal parameter)
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable:4100)
#endif
using testing::_; using testing::_;
using testing::AnyNumber; using testing::AnyNumber;
using testing::Ge; using testing::Ge;
@ -298,3 +304,7 @@ int main(int argc, char **argv) {
TestCatchesLeakedMocksInAdHocTests(); TestCatchesLeakedMocksInAdHocTests();
return RUN_ALL_TESTS(); return RUN_ALL_TESTS();
} }
#ifdef _MSC_VER
# pragma warning(pop)
#endif

View File

@ -82,6 +82,15 @@
namespace testing { namespace testing {
// Silence C4100 (unreferenced formal parameter) and 4805
// unsafe mix of type 'const int' and type 'const bool'
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable:4805)
# pragma warning(disable:4100)
#endif
// Declares the flags. // Declares the flags.
// This flag temporary enables the disabled tests. // This flag temporary enables the disabled tests.
@ -2298,6 +2307,10 @@ bool StaticAssertTypeEq() {
// Tries to determine an appropriate directory for the platform. // Tries to determine an appropriate directory for the platform.
GTEST_API_ std::string TempDir(); GTEST_API_ std::string TempDir();
#ifdef _MSC_VER
# pragma warning(pop)
#endif
} // namespace testing } // namespace testing
// Use this function in main() to run all tests. It returns 0 if all // Use this function in main() to run all tests. It returns 0 if all

View File

@ -1155,7 +1155,7 @@ class NativeArray {
#define GTEST_SUCCESS_(message) \ #define GTEST_SUCCESS_(message) \
GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess) GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess)
// Suppresses MSVC warnings 4072 (unreachable code) for the code following // Suppress MSVC warning 4702 (unreachable code) for the code following
// statement if it returns or throws (or doesn't return or throw in some // statement if it returns or throws (or doesn't return or throw in some
// situations). // situations).
#define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \ #define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \