| gmock-generated-actions.h | | gmock-generated-actions.h | |
| | | | |
| skipping to change at line 285 | | skipping to change at line 285 | |
| MethodPtr method_ptr, | | MethodPtr method_ptr, | |
| const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7,
A8, | | const ::std::tr1::tuple<A1, A2, A3, A4, A5, A6, A7,
A8, | |
| A9, A10>& args) { | | A9, A10>& args) { | |
| using ::std::tr1::get; | | using ::std::tr1::get; | |
| return (obj_ptr->*method_ptr)(get<0>(args), get<1>(args), get<2>(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<6>(args), get<7>(args
), | | get<3>(args), get<4>(args), get<5>(args), get<6>(args), get<7>(args
), | |
| get<8>(args), get<9>(args)); | | get<8>(args), get<9>(args)); | |
| } | | } | |
| }; | | }; | |
| | | | |
|
| // Implements the Invoke(f) action. The template argument | | | |
| // FunctionImpl is the implementation type of f, which can be either a | | | |
| // function pointer or a functor. Invoke(f) can be used as an | | | |
| // Action<F> as long as f's type is compatible with F (i.e. f can be | | | |
| // assigned to a tr1::function<F>). | | | |
| template <typename FunctionImpl> | | | |
| class InvokeAction { | | | |
| public: | | | |
| // The c'tor makes a copy of function_impl (either a function | | | |
| // pointer or a functor). | | | |
| explicit InvokeAction(FunctionImpl function_impl) | | | |
| : function_impl_(function_impl) {} | | | |
| | | | |
| template <typename Result, typename ArgumentTuple> | | | |
| Result Perform(const ArgumentTuple& args) { | | | |
| return InvokeHelper<Result, ArgumentTuple>::Invoke(function_impl_, args | | | |
| ); | | | |
| } | | | |
| private: | | | |
| FunctionImpl function_impl_; | | | |
| }; | | | |
| | | | |
| // Implements the Invoke(object_ptr, &Class::Method) action. | | | |
| template <class Class, typename MethodPtr> | | | |
| class InvokeMethodAction { | | | |
| public: | | | |
| InvokeMethodAction(Class* obj_ptr, MethodPtr method_ptr) | | | |
| : obj_ptr_(obj_ptr), method_ptr_(method_ptr) {} | | | |
| | | | |
| template <typename Result, typename ArgumentTuple> | | | |
| Result Perform(const ArgumentTuple& args) const { | | | |
| return InvokeHelper<Result, ArgumentTuple>::InvokeMethod( | | | |
| obj_ptr_, method_ptr_, args); | | | |
| } | | | |
| private: | | | |
| Class* const obj_ptr_; | | | |
| const MethodPtr method_ptr_; | | | |
| }; | | | |
| | | | |
| // A ReferenceWrapper<T> object represents a reference to type T, | | | |
| // which can be either const or not. It can be explicitly converted | | | |
| // from, and implicitly converted to, a T&. Unlike a reference, | | | |
| // ReferenceWrapper<T> can be copied and can survive template type | | | |
| // inference. This is used to support by-reference arguments in the | | | |
| // InvokeArgument<N>(...) action. The idea was from "reference | | | |
| // wrappers" in tr1, which we don't have in our source tree yet. | | | |
| template <typename T> | | | |
| class ReferenceWrapper { | | | |
| public: | | | |
| // Constructs a ReferenceWrapper<T> object from a T&. | | | |
| explicit ReferenceWrapper(T& l_value) : pointer_(&l_value) {} // NOLINT | | | |
| | | | |
| // Allows a ReferenceWrapper<T> object to be implicitly converted to | | | |
| // a T&. | | | |
| operator T&() const { return *pointer_; } | | | |
| private: | | | |
| T* pointer_; | | | |
| }; | | | |
| | | | |
| // CallableHelper has static methods for invoking "callables", | | // CallableHelper has static methods for invoking "callables", | |
| // i.e. function pointers and functors. It uses overloading to | | // i.e. function pointers and functors. It uses overloading to | |
| // provide a uniform interface for invoking different kinds of | | // provide a uniform interface for invoking different kinds of | |
| // callables. In particular, you can use: | | // callables. In particular, you can use: | |
| // | | // | |
| // CallableHelper<R>::Call(callable, a1, a2, ..., an) | | // CallableHelper<R>::Call(callable, a1, a2, ..., an) | |
| // | | // | |
| // to invoke an n-ary callable, where R is its return type. If an | | // to invoke an n-ary callable, where R is its return type. If an | |
| // argument, say a2, needs to be passed by reference, you should write | | // argument, say a2, needs to be passed by reference, you should write | |
| // ByRef(a2) instead of a2 in the above expression. | | // ByRef(a2) instead of a2 in the above expression. | |
| | | | |
| skipping to change at line 445 | | skipping to change at line 387 | |
| template <typename Function, typename A1, typename A2, typename A3, | | template <typename Function, typename A1, typename A2, typename A3, | |
| typename A4, typename A5, typename A6, typename A7, typename A8, | | typename A4, typename A5, typename A6, typename A7, typename A8, | |
| typename A9, typename A10> | | typename A9, typename A10> | |
| static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6
, | | static R Call(Function function, A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6
, | |
| A7 a7, A8 a8, A9 a9, A10 a10) { | | A7 a7, A8 a8, A9 a9, A10 a10) { | |
| return function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); | | return function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); | |
| } | | } | |
| | | | |
| }; // class CallableHelper | | }; // class CallableHelper | |
| | | | |
|
| // Invokes a nullary callable argument. | | | |
| template <size_t N> | | | |
| class InvokeArgumentAction0 { | | | |
| public: | | | |
| template <typename Result, typename ArgumentTuple> | | | |
| static Result Perform(const ArgumentTuple& args) { | | | |
| return CallableHelper<Result>::Call(::std::tr1::get<N>(args)); | | | |
| } | | | |
| }; | | | |
| | | | |
| // Invokes a unary callable argument with the given argument. | | | |
| template <size_t N, typename A1> | | | |
| class InvokeArgumentAction1 { | | | |
| public: | | | |
| // We deliberately pass a1 by value instead of const reference here | | | |
| // in case it is a C-string literal. | | | |
| // | | | |
| // Since this function is defined inline, the compiler can get rid | | | |
| // of the copying of the arguments. Therefore the performance won't | | | |
| // be hurt. | | | |
| explicit InvokeArgumentAction1(A1 a1) : arg1_(a1) {} | | | |
| | | | |
| template <typename Result, typename ArgumentTuple> | | | |
| Result Perform(const ArgumentTuple& args) { | | | |
| return CallableHelper<Result>::Call(::std::tr1::get<N>(args), arg1_); | | | |
| } | | | |
| private: | | | |
| const A1 arg1_; | | | |
| }; | | | |
| | | | |
| // Invokes a binary callable argument with the given arguments. | | | |
| template <size_t N, typename A1, typename A2> | | | |
| class InvokeArgumentAction2 { | | | |
| public: | | | |
| InvokeArgumentAction2(A1 a1, A2 a2) : | | | |
| arg1_(a1), arg2_(a2) {} | | | |
| | | | |
| template <typename Result, typename ArgumentTuple> | | | |
| Result Perform(const ArgumentTuple& args) { | | | |
| return CallableHelper<Result>::Call(::std::tr1::get<N>(args), arg1_, ar | | | |
| g2_); | | | |
| } | | | |
| private: | | | |
| const A1 arg1_; | | | |
| const A2 arg2_; | | | |
| }; | | | |
| | | | |
| // Invokes a ternary callable argument with the given arguments. | | | |
| template <size_t N, typename A1, typename A2, typename A3> | | | |
| class InvokeArgumentAction3 { | | | |
| public: | | | |
| InvokeArgumentAction3(A1 a1, A2 a2, A3 a3) : | | | |
| arg1_(a1), arg2_(a2), arg3_(a3) {} | | | |
| | | | |
| template <typename Result, typename ArgumentTuple> | | | |
| Result Perform(const ArgumentTuple& args) { | | | |
| return CallableHelper<Result>::Call(::std::tr1::get<N>(args), arg1_, ar | | | |
| g2_, | | | |
| arg3_); | | | |
| } | | | |
| private: | | | |
| const A1 arg1_; | | | |
| const A2 arg2_; | | | |
| const A3 arg3_; | | | |
| }; | | | |
| | | | |
| // Invokes a 4-ary callable argument with the given arguments. | | | |
| template <size_t N, typename A1, typename A2, typename A3, typename A4> | | | |
| class InvokeArgumentAction4 { | | | |
| public: | | | |
| InvokeArgumentAction4(A1 a1, A2 a2, A3 a3, A4 a4) : | | | |
| arg1_(a1), arg2_(a2), arg3_(a3), arg4_(a4) {} | | | |
| | | | |
| template <typename Result, typename ArgumentTuple> | | | |
| Result Perform(const ArgumentTuple& args) { | | | |
| return CallableHelper<Result>::Call(::std::tr1::get<N>(args), arg1_, ar | | | |
| g2_, | | | |
| arg3_, arg4_); | | | |
| } | | | |
| private: | | | |
| const A1 arg1_; | | | |
| const A2 arg2_; | | | |
| const A3 arg3_; | | | |
| const A4 arg4_; | | | |
| }; | | | |
| | | | |
| // Invokes a 5-ary callable argument with the given arguments. | | | |
| template <size_t N, typename A1, typename A2, typename A3, typename A4, | | | |
| typename A5> | | | |
| class InvokeArgumentAction5 { | | | |
| public: | | | |
| InvokeArgumentAction5(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) : | | | |
| arg1_(a1), arg2_(a2), arg3_(a3), arg4_(a4), arg5_(a5) {} | | | |
| | | | |
| template <typename Result, typename ArgumentTuple> | | | |
| Result Perform(const ArgumentTuple& args) { | | | |
| // We extract the callable to a variable before invoking it, in | | | |
| // case it is a functor passed by value and its operator() is not | | | |
| // const. | | | |
| typename ::std::tr1::tuple_element<N, ArgumentTuple>::type function = | | | |
| ::std::tr1::get<N>(args); | | | |
| return function(arg1_, arg2_, arg3_, arg4_, arg5_); | | | |
| } | | | |
| private: | | | |
| const A1 arg1_; | | | |
| const A2 arg2_; | | | |
| const A3 arg3_; | | | |
| const A4 arg4_; | | | |
| const A5 arg5_; | | | |
| }; | | | |
| | | | |
| // Invokes a 6-ary callable argument with the given arguments. | | | |
| template <size_t N, typename A1, typename A2, typename A3, typename A4, | | | |
| typename A5, typename A6> | | | |
| class InvokeArgumentAction6 { | | | |
| public: | | | |
| InvokeArgumentAction6(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) : | | | |
| arg1_(a1), arg2_(a2), arg3_(a3), arg4_(a4), arg5_(a5), arg6_(a6) {} | | | |
| | | | |
| template <typename Result, typename ArgumentTuple> | | | |
| Result Perform(const ArgumentTuple& args) { | | | |
| // We extract the callable to a variable before invoking it, in | | | |
| // case it is a functor passed by value and its operator() is not | | | |
| // const. | | | |
| typename ::std::tr1::tuple_element<N, ArgumentTuple>::type function = | | | |
| ::std::tr1::get<N>(args); | | | |
| return function(arg1_, arg2_, arg3_, arg4_, arg5_, arg6_); | | | |
| } | | | |
| private: | | | |
| const A1 arg1_; | | | |
| const A2 arg2_; | | | |
| const A3 arg3_; | | | |
| const A4 arg4_; | | | |
| const A5 arg5_; | | | |
| const A6 arg6_; | | | |
| }; | | | |
| | | | |
| // Invokes a 7-ary callable argument with the given arguments. | | | |
| template <size_t N, typename A1, typename A2, typename A3, typename A4, | | | |
| typename A5, typename A6, typename A7> | | | |
| class InvokeArgumentAction7 { | | | |
| public: | | | |
| InvokeArgumentAction7(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) : | | | |
| arg1_(a1), arg2_(a2), arg3_(a3), arg4_(a4), arg5_(a5), arg6_(a6), | | | |
| arg7_(a7) {} | | | |
| | | | |
| template <typename Result, typename ArgumentTuple> | | | |
| Result Perform(const ArgumentTuple& args) { | | | |
| // We extract the callable to a variable before invoking it, in | | | |
| // case it is a functor passed by value and its operator() is not | | | |
| // const. | | | |
| typename ::std::tr1::tuple_element<N, ArgumentTuple>::type function = | | | |
| ::std::tr1::get<N>(args); | | | |
| return function(arg1_, arg2_, arg3_, arg4_, arg5_, arg6_, arg7_); | | | |
| } | | | |
| private: | | | |
| const A1 arg1_; | | | |
| const A2 arg2_; | | | |
| const A3 arg3_; | | | |
| const A4 arg4_; | | | |
| const A5 arg5_; | | | |
| const A6 arg6_; | | | |
| const A7 arg7_; | | | |
| }; | | | |
| | | | |
| // Invokes a 8-ary callable argument with the given arguments. | | | |
| template <size_t N, typename A1, typename A2, typename A3, typename A4, | | | |
| typename A5, typename A6, typename A7, typename A8> | | | |
| class InvokeArgumentAction8 { | | | |
| public: | | | |
| InvokeArgumentAction8(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, | | | |
| A8 a8) : | | | |
| arg1_(a1), arg2_(a2), arg3_(a3), arg4_(a4), arg5_(a5), arg6_(a6), | | | |
| arg7_(a7), arg8_(a8) {} | | | |
| | | | |
| template <typename Result, typename ArgumentTuple> | | | |
| Result Perform(const ArgumentTuple& args) { | | | |
| // We extract the callable to a variable before invoking it, in | | | |
| // case it is a functor passed by value and its operator() is not | | | |
| // const. | | | |
| typename ::std::tr1::tuple_element<N, ArgumentTuple>::type function = | | | |
| ::std::tr1::get<N>(args); | | | |
| return function(arg1_, arg2_, arg3_, arg4_, arg5_, arg6_, arg7_, arg8_) | | | |
| ; | | | |
| } | | | |
| private: | | | |
| const A1 arg1_; | | | |
| const A2 arg2_; | | | |
| const A3 arg3_; | | | |
| const A4 arg4_; | | | |
| const A5 arg5_; | | | |
| const A6 arg6_; | | | |
| const A7 arg7_; | | | |
| const A8 arg8_; | | | |
| }; | | | |
| | | | |
| // Invokes a 9-ary callable argument with the given arguments. | | | |
| template <size_t N, typename A1, typename A2, typename A3, typename A4, | | | |
| typename A5, typename A6, typename A7, typename A8, typename A9> | | | |
| class InvokeArgumentAction9 { | | | |
| public: | | | |
| InvokeArgumentAction9(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 | | | |
| a8, | | | |
| A9 a9) : | | | |
| arg1_(a1), arg2_(a2), arg3_(a3), arg4_(a4), arg5_(a5), arg6_(a6), | | | |
| arg7_(a7), arg8_(a8), arg9_(a9) {} | | | |
| | | | |
| template <typename Result, typename ArgumentTuple> | | | |
| Result Perform(const ArgumentTuple& args) { | | | |
| // We extract the callable to a variable before invoking it, in | | | |
| // case it is a functor passed by value and its operator() is not | | | |
| // const. | | | |
| typename ::std::tr1::tuple_element<N, ArgumentTuple>::type function = | | | |
| ::std::tr1::get<N>(args); | | | |
| return function(arg1_, arg2_, arg3_, arg4_, arg5_, arg6_, arg7_, arg8_, | | | |
| arg9_); | | | |
| } | | | |
| private: | | | |
| const A1 arg1_; | | | |
| const A2 arg2_; | | | |
| const A3 arg3_; | | | |
| const A4 arg4_; | | | |
| const A5 arg5_; | | | |
| const A6 arg6_; | | | |
| const A7 arg7_; | | | |
| const A8 arg8_; | | | |
| const A9 arg9_; | | | |
| }; | | | |
| | | | |
| // Invokes a 10-ary callable argument with the given arguments. | | | |
| template <size_t N, typename A1, typename A2, typename A3, typename A4, | | | |
| typename A5, typename A6, typename A7, typename A8, typename A9, | | | |
| typename A10> | | | |
| class InvokeArgumentAction10 { | | | |
| public: | | | |
| InvokeArgumentAction10(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, | | | |
| A8 a8, A9 a9, A10 a10) : | | | |
| arg1_(a1), arg2_(a2), arg3_(a3), arg4_(a4), arg5_(a5), arg6_(a6), | | | |
| arg7_(a7), arg8_(a8), arg9_(a9), arg10_(a10) {} | | | |
| | | | |
| template <typename Result, typename ArgumentTuple> | | | |
| Result Perform(const ArgumentTuple& args) { | | | |
| // We extract the callable to a variable before invoking it, in | | | |
| // case it is a functor passed by value and its operator() is not | | | |
| // const. | | | |
| typename ::std::tr1::tuple_element<N, ArgumentTuple>::type function = | | | |
| ::std::tr1::get<N>(args); | | | |
| return function(arg1_, arg2_, arg3_, arg4_, arg5_, arg6_, arg7_, arg8_, | | | |
| arg9_, arg10_); | | | |
| } | | | |
| private: | | | |
| const A1 arg1_; | | | |
| const A2 arg2_; | | | |
| const A3 arg3_; | | | |
| const A4 arg4_; | | | |
| const A5 arg5_; | | | |
| const A6 arg6_; | | | |
| const A7 arg7_; | | | |
| const A8 arg8_; | | | |
| const A9 arg9_; | | | |
| const A10 arg10_; | | | |
| }; | | | |
| | | | |
| // 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) \ | |
| typename ::std::tr1::tuple_element<N, Tuple>::type | | typename ::std::tr1::tuple_element<N, Tuple>::type | |
| | | | |
| // SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::type is the | | // SelectArgs<Result, ArgumentTuple, k1, k2, ..., k_n>::type is the | |
| // type of an n-ary function whose i-th (1-based) argument type is the | | // type of an n-ary function whose i-th (1-based) argument type is the | |
| // k{i}-th (0-based) field of ArgumentTuple, which must be a tuple | | // k{i}-th (0-based) field of ArgumentTuple, which must be a tuple | |
| // type, and whose return type is Result. For example, | | // type, and whose return type is Result. For example, | |
| // SelectArgs<int, ::std::tr1::tuple<bool, char, double, long>, 0, 3>::ty
pe | | // SelectArgs<int, ::std::tr1::tuple<bool, char, double, long>, 0, 3>::ty
pe | |
| | | | |
| skipping to change at line 751 | | skipping to change at line 435 | |
| get<k8>(args), get<k9>(args), get<k10>(args)); | | get<k8>(args), get<k9>(args), get<k10>(args)); | |
| } | | } | |
| }; | | }; | |
| | | | |
| template <typename Result, typename ArgumentTuple> | | template <typename Result, typename ArgumentTuple> | |
| class SelectArgs<Result, ArgumentTuple, | | class SelectArgs<Result, ArgumentTuple, | |
| -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> { | | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> { | |
| public: | | public: | |
| typedef Result type(); | | typedef Result type(); | |
| typedef typename Function<type>::ArgumentTuple SelectedArgs; | | typedef typename Function<type>::ArgumentTuple SelectedArgs; | |
|
| static SelectedArgs Select(const ArgumentTuple& args) { | | static SelectedArgs Select(const ArgumentTuple& /* args */) { | |
| using ::std::tr1::get; | | using ::std::tr1::get; | |
| return SelectedArgs(); | | return SelectedArgs(); | |
| } | | } | |
| }; | | }; | |
| | | | |
| template <typename Result, typename ArgumentTuple, int k1> | | template <typename Result, typename ArgumentTuple, int k1> | |
| class SelectArgs<Result, ArgumentTuple, | | class SelectArgs<Result, ArgumentTuple, | |
| k1, -1, -1, -1, -1, -1, -1, -1, -1, -1> { | | k1, -1, -1, -1, -1, -1, -1, -1, -1, -1> { | |
| public: | | public: | |
| typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1)); | | typedef Result type(GMOCK_FIELD_(ArgumentTuple, k1)); | |
| | | | |
| skipping to change at line 936 | | skipping to change at line 620 | |
| private: | | private: | |
| typedef typename SelectArgs<Result, ArgumentTuple, | | typedef typename SelectArgs<Result, ArgumentTuple, | |
| k1, k2, k3, k4, k5, k6, k7, k8, k9, k10>::type InnerFunctionType; | | k1, k2, k3, k4, k5, k6, k7, k8, k9, k10>::type InnerFunctionType; | |
| | | | |
| Action<InnerFunctionType> action_; | | Action<InnerFunctionType> action_; | |
| }; | | }; | |
| | | | |
| const InnerAction action_; | | const InnerAction action_; | |
| }; | | }; | |
| | | | |
|
| // Does two actions sequentially. Used for implementing the DoAll(a1, | | | |
| // a2, ...) action. | | | |
| template <typename Action1, typename Action2> | | | |
| class DoBothAction { | | | |
| public: | | | |
| DoBothAction(Action1 action1, Action2 action2) | | | |
| : action1_(action1), action2_(action2) {} | | | |
| | | | |
| // This template type conversion operator allows DoAll(a1, ..., a_n) | | | |
| // to be used in ANY function of compatible type. | | | |
| template <typename F> | | | |
| operator Action<F>() const { | | | |
| return Action<F>(new Impl<F>(action1_, action2_)); | | | |
| } | | | |
| | | | |
| private: | | | |
| // Implements the DoAll(...) action for a particular function type F. | | | |
| template <typename F> | | | |
| class Impl : public ActionInterface<F> { | | | |
| public: | | | |
| typedef typename Function<F>::Result Result; | | | |
| typedef typename Function<F>::ArgumentTuple ArgumentTuple; | | | |
| typedef typename Function<F>::MakeResultVoid VoidResult; | | | |
| | | | |
| Impl(const Action<VoidResult>& action1, const Action<F>& action2) | | | |
| : action1_(action1), action2_(action2) {} | | | |
| | | | |
| virtual Result Perform(const ArgumentTuple& args) { | | | |
| action1_.Perform(args); | | | |
| return action2_.Perform(args); | | | |
| } | | | |
| | | | |
| private: | | | |
| const Action<VoidResult> action1_; | | | |
| const Action<F> action2_; | | | |
| }; | | | |
| | | | |
| Action1 action1_; | | | |
| Action2 action2_; | | | |
| }; | | | |
| | | | |
| // A macro from the ACTION* family (defined later in this file) | | // A macro from the ACTION* family (defined later in this file) | |
| // defines an action that can be used in a mock function. Typically, | | // defines an action that can be used in a mock function. Typically, | |
| // these actions only care about a subset of the arguments of the mock | | // these actions only care about a subset of the arguments of the mock | |
| // function. For example, if such an action only uses the second | | // function. For example, if such an action only uses the second | |
| // argument, it can be used in any mock function that takes >= 2 | | // argument, it can be used in any mock function that takes >= 2 | |
| // arguments where the type of the second argument is compatible. | | // arguments where the type of the second argument is compatible. | |
| // | | // | |
| // Therefore, the action implementation must be prepared to take more | | // Therefore, the action implementation must be prepared to take more | |
| // arguments than it needs. The ExcessiveArg type is used to | | // arguments than it needs. The ExcessiveArg type is used to | |
| // represent those excessive arguments. In order to keep the compiler | | // represent those excessive arguments. In order to keep the compiler | |
| | | | |
| skipping to change at line 1112 | | skipping to change at line 755 | |
| A9>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args), | | A9>(args, get<0>(args), get<1>(args), get<2>(args), get<3>(args), | |
| get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args
), | | get<4>(args), get<5>(args), get<6>(args), get<7>(args), get<8>(args
), | |
| get<9>(args)); | | get<9>(args)); | |
| } | | } | |
| }; | | }; | |
| | | | |
| } // namespace internal | | } // namespace internal | |
| | | | |
| // Various overloads for Invoke(). | | // Various overloads for Invoke(). | |
| | | | |
|
| // Creates an action that invokes 'function_impl' with the mock | | | |
| // function's arguments. | | | |
| template <typename FunctionImpl> | | | |
| PolymorphicAction<internal::InvokeAction<FunctionImpl> > Invoke( | | | |
| FunctionImpl function_impl) { | | | |
| return MakePolymorphicAction( | | | |
| internal::InvokeAction<FunctionImpl>(function_impl)); | | | |
| } | | | |
| | | | |
| // Creates an action that invokes the given method on the given object | | | |
| // with the mock function's arguments. | | | |
| template <class Class, typename MethodPtr> | | | |
| PolymorphicAction<internal::InvokeMethodAction<Class, MethodPtr> > Invoke( | | | |
| Class* obj_ptr, MethodPtr method_ptr) { | | | |
| return MakePolymorphicAction( | | | |
| internal::InvokeMethodAction<Class, MethodPtr>(obj_ptr, method_ptr)); | | | |
| } | | | |
| | | | |
| // Creates a reference wrapper for the given L-value. If necessary, | | | |
| // you can explicitly specify the type of the reference. For example, | | | |
| // suppose 'derived' is an object of type Derived, ByRef(derived) | | | |
| // would wrap a Derived&. If you want to wrap a const Base& instead, | | | |
| // where Base is a base class of Derived, just write: | | | |
| // | | | |
| // ByRef<const Base>(derived) | | | |
| template <typename T> | | | |
| inline internal::ReferenceWrapper<T> ByRef(T& l_value) { // NOLINT | | | |
| return internal::ReferenceWrapper<T>(l_value); | | | |
| } | | | |
| | | | |
| // Various overloads for InvokeArgument<N>(). | | | |
| // | | | |
| // The InvokeArgument<N>(a1, a2, ..., a_k) action invokes the N-th | | | |
| // (0-based) argument, which must be a k-ary callable, of the mock | | | |
| // function, with arguments a1, a2, ..., a_k. | | | |
| // | | | |
| // Notes: | | | |
| // | | | |
| // 1. The arguments are passed by value by default. If you need to | | | |
| // pass an argument by reference, wrap it inside ByRef(). For | | | |
| // example, | | | |
| // | | | |
| // InvokeArgument<1>(5, string("Hello"), ByRef(foo)) | | | |
| // | | | |
| // passes 5 and string("Hello") by value, and passes foo by | | | |
| // reference. | | | |
| // | | | |
| // 2. If the callable takes an argument by reference but ByRef() is | | | |
| // not used, it will receive the reference to a copy of the value, | | | |
| // instead of the original value. For example, when the 0-th | | | |
| // argument of the mock function takes a const string&, the action | | | |
| // | | | |
| // InvokeArgument<0>(string("Hello")) | | | |
| // | | | |
| // makes a copy of the temporary string("Hello") object and passes a | | | |
| // reference of the copy, instead of the original temporary object, | | | |
| // to the callable. This makes it easy for a user to define an | | | |
| // InvokeArgument action from temporary values and have it performed | | | |
| // later. | | | |
| template <size_t N> | | | |
| inline PolymorphicAction<internal::InvokeArgumentAction0<N> > InvokeArgumen | | | |
| t() { | | | |
| return MakePolymorphicAction(internal::InvokeArgumentAction0<N>()); | | | |
| } | | | |
| | | | |
| // We deliberately pass a1 by value instead of const reference here in | | | |
| // case it is a C-string literal. If we had declared the parameter as | | | |
| // 'const A1& a1' and write InvokeArgument<0>("Hi"), the compiler | | | |
| // would've thought A1 is 'char[3]', which causes trouble as the | | | |
| // implementation needs to copy a value of type A1. By declaring the | | | |
| // parameter as 'A1 a1', the compiler will correctly infer that A1 is | | | |
| // 'const char*' when it sees InvokeArgument<0>("Hi"). | | | |
| // | | | |
| // Since this function is defined inline, the compiler can get rid of | | | |
| // the copying of the arguments. Therefore the performance won't be | | | |
| // hurt. | | | |
| template <size_t N, typename A1> | | | |
| inline PolymorphicAction<internal::InvokeArgumentAction1<N, A1> > | | | |
| InvokeArgument(A1 a1) { | | | |
| return MakePolymorphicAction(internal::InvokeArgumentAction1<N, A1>(a1)); | | | |
| } | | | |
| | | | |
| template <size_t N, typename A1, typename A2> | | | |
| inline PolymorphicAction<internal::InvokeArgumentAction2<N, A1, A2> > | | | |
| InvokeArgument(A1 a1, A2 a2) { | | | |
| return MakePolymorphicAction( | | | |
| internal::InvokeArgumentAction2<N, A1, A2>(a1, a2)); | | | |
| } | | | |
| | | | |
| template <size_t N, typename A1, typename A2, typename A3> | | | |
| inline PolymorphicAction<internal::InvokeArgumentAction3<N, A1, A2, A3> > | | | |
| InvokeArgument(A1 a1, A2 a2, A3 a3) { | | | |
| return MakePolymorphicAction( | | | |
| internal::InvokeArgumentAction3<N, A1, A2, A3>(a1, a2, a3)); | | | |
| } | | | |
| | | | |
| template <size_t N, typename A1, typename A2, typename A3, typename A4> | | | |
| inline PolymorphicAction<internal::InvokeArgumentAction4<N, A1, A2, A3, A4> | | | |
| > | | | |
| InvokeArgument(A1 a1, A2 a2, A3 a3, A4 a4) { | | | |
| return MakePolymorphicAction( | | | |
| internal::InvokeArgumentAction4<N, A1, A2, A3, A4>(a1, a2, a3, a4)); | | | |
| } | | | |
| | | | |
| template <size_t N, typename A1, typename A2, typename A3, typename A4, | | | |
| typename A5> | | | |
| inline PolymorphicAction<internal::InvokeArgumentAction5<N, A1, A2, A3, A4, | | | |
| A5> > | | | |
| InvokeArgument(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5) { | | | |
| return MakePolymorphicAction( | | | |
| internal::InvokeArgumentAction5<N, A1, A2, A3, A4, A5>(a1, a2, a3, a4 | | | |
| , | | | |
| a5)); | | | |
| } | | | |
| | | | |
| template <size_t N, typename A1, typename A2, typename A3, typename A4, | | | |
| typename A5, typename A6> | | | |
| inline PolymorphicAction<internal::InvokeArgumentAction6<N, A1, A2, A3, A4, | | | |
| A5, | | | |
| A6> > | | | |
| InvokeArgument(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6) { | | | |
| return MakePolymorphicAction( | | | |
| internal::InvokeArgumentAction6<N, A1, A2, A3, A4, A5, A6>(a1, a2, a3 | | | |
| , | | | |
| a4, a5, a6)); | | | |
| } | | | |
| | | | |
| template <size_t N, typename A1, typename A2, typename A3, typename A4, | | | |
| typename A5, typename A6, typename A7> | | | |
| inline PolymorphicAction<internal::InvokeArgumentAction7<N, A1, A2, A3, A4, | | | |
| A5, | | | |
| A6, A7> > | | | |
| InvokeArgument(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7) { | | | |
| return MakePolymorphicAction( | | | |
| internal::InvokeArgumentAction7<N, A1, A2, A3, A4, A5, A6, A7>(a1, a2 | | | |
| , | | | |
| a3, a4, a5, a6, a7)); | | | |
| } | | | |
| | | | |
| template <size_t N, typename A1, typename A2, typename A3, typename A4, | | | |
| typename A5, typename A6, typename A7, typename A8> | | | |
| inline PolymorphicAction<internal::InvokeArgumentAction8<N, A1, A2, A3, A4, | | | |
| A5, | | | |
| A6, A7, A8> > | | | |
| InvokeArgument(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8) { | | | |
| return MakePolymorphicAction( | | | |
| internal::InvokeArgumentAction8<N, A1, A2, A3, A4, A5, A6, A7, A8>(a1 | | | |
| , | | | |
| a2, a3, a4, a5, a6, a7, a8)); | | | |
| } | | | |
| | | | |
| template <size_t N, typename A1, typename A2, typename A3, typename A4, | | | |
| typename A5, typename A6, typename A7, typename A8, typename A9> | | | |
| inline PolymorphicAction<internal::InvokeArgumentAction9<N, A1, A2, A3, A4, | | | |
| A5, | | | |
| A6, A7, A8, A9> > | | | |
| InvokeArgument(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a | | | |
| 9) { | | | |
| return MakePolymorphicAction( | | | |
| internal::InvokeArgumentAction9<N, A1, A2, A3, A4, A5, A6, A7, A8, | | | |
| A9>(a1, a2, a3, a4, a5, a6, a7, a8, a9)); | | | |
| } | | | |
| | | | |
| template <size_t N, typename A1, typename A2, typename A3, typename A4, | | | |
| typename A5, typename A6, typename A7, typename A8, typename A9, | | | |
| typename A10> | | | |
| inline PolymorphicAction<internal::InvokeArgumentAction10<N, A1, A2, A3, A4 | | | |
| , | | | |
| A5, A6, A7, A8, A9, A10> > | | | |
| InvokeArgument(A1 a1, A2 a2, A3 a3, A4 a4, A5 a5, A6 a6, A7 a7, A8 a8, A9 a | | | |
| 9, | | | |
| A10 a10) { | | | |
| return MakePolymorphicAction( | | | |
| internal::InvokeArgumentAction10<N, A1, A2, A3, A4, A5, A6, A7, A8, A | | | |
| 9, | | | |
| A10>(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)); | | | |
| } | | | |
| | | | |
| // WithoutArgs(inner_action) can be used in a mock function with a | | | |
| // non-empty argument list to perform inner_action, which takes no | | | |
| // argument. In other words, it adapts an action accepting no | | | |
| // argument to one that accepts (and ignores) arguments. | | | |
| template <typename InnerAction> | | | |
| inline internal::WithArgsAction<InnerAction> | | | |
| WithoutArgs(const InnerAction& action) { | | | |
| return internal::WithArgsAction<InnerAction>(action); | | | |
| } | | | |
| | | | |
| // WithArg<k>(an_action) creates an action that passes the k-th | | | |
| // (0-based) argument of the mock function to an_action and performs | | | |
| // it. It adapts an action accepting one argument to one that accepts | | | |
| // multiple arguments. For convenience, we also provide | | | |
| // WithArgs<k>(an_action) (defined below) as a synonym. | | | |
| template <int k, typename InnerAction> | | | |
| inline internal::WithArgsAction<InnerAction, k> | | | |
| WithArg(const InnerAction& action) { | | | |
| return internal::WithArgsAction<InnerAction, k>(action); | | | |
| } | | | |
| | | | |
| // WithArgs<N1, N2, ..., Nk>(an_action) creates an action that passes | | // WithArgs<N1, N2, ..., Nk>(an_action) creates an action that passes | |
| // the selected arguments of the mock function to an_action and | | // the selected arguments of the mock function to an_action and | |
| // performs it. It serves as an adaptor between actions with | | // performs it. It serves as an adaptor between actions with | |
| // different argument lists. C++ doesn't support default arguments for | | // different argument lists. C++ doesn't support default arguments for | |
| // function templates, so we have to overload it. | | // function templates, so we have to overload it. | |
| template <int k1, typename InnerAction> | | template <int k1, typename InnerAction> | |
| inline internal::WithArgsAction<InnerAction, k1> | | inline internal::WithArgsAction<InnerAction, k1> | |
| WithArgs(const InnerAction& action) { | | WithArgs(const InnerAction& action) { | |
| return internal::WithArgsAction<InnerAction, k1>(action); | | return internal::WithArgsAction<InnerAction, k1>(action); | |
| } | | } | |
| | | | |
| skipping to change at line 1559 | | skipping to change at line 1017 | |
| // that C++ doesn't yet allow function-local types to be used to | | // that C++ doesn't yet allow function-local types to be used to | |
| // instantiate templates. The up-coming C++0x standard will fix this. | | // instantiate templates. The up-coming C++0x standard will fix this. | |
| // Once that's done, we'll consider supporting using ACTION*() inside | | // Once that's done, we'll consider supporting using ACTION*() inside | |
| // a function. | | // a function. | |
| // | | // | |
| // MORE INFORMATION: | | // MORE INFORMATION: | |
| // | | // | |
| // To learn more about using these macros, please search for 'ACTION' | | // To learn more about using these macros, please search for 'ACTION' | |
| // on http://code.google.com/p/googlemock/wiki/CookBook. | | // on http://code.google.com/p/googlemock/wiki/CookBook. | |
| | | | |
|
| | | // An internal macro needed for implementing ACTION*(). | |
| | | #define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_\ | |
| | | const args_type& args GTEST_ATTRIBUTE_UNUSED_,\ | |
| | | arg0_type arg0 GTEST_ATTRIBUTE_UNUSED_,\ | |
| | | arg1_type arg1 GTEST_ATTRIBUTE_UNUSED_,\ | |
| | | arg2_type arg2 GTEST_ATTRIBUTE_UNUSED_,\ | |
| | | arg3_type arg3 GTEST_ATTRIBUTE_UNUSED_,\ | |
| | | arg4_type arg4 GTEST_ATTRIBUTE_UNUSED_,\ | |
| | | arg5_type arg5 GTEST_ATTRIBUTE_UNUSED_,\ | |
| | | arg6_type arg6 GTEST_ATTRIBUTE_UNUSED_,\ | |
| | | arg7_type arg7 GTEST_ATTRIBUTE_UNUSED_,\ | |
| | | arg8_type arg8 GTEST_ATTRIBUTE_UNUSED_,\ | |
| | | arg9_type arg9 GTEST_ATTRIBUTE_UNUSED_ | |
| | | | |
| | | // Sometimes you want to give an action explicit template parameters | |
| | | // that cannot be inferred from its value parameters. ACTION() and | |
| | | // ACTION_P*() don't support that. ACTION_TEMPLATE() remedies that | |
| | | // and can be viewed as an extension to ACTION() and ACTION_P*(). | |
| | | // | |
| | | // The syntax: | |
| | | // | |
| | | // ACTION_TEMPLATE(ActionName, | |
| | | // HAS_m_TEMPLATE_PARAMS(kind1, name1, ..., kind_m, name_ | |
| | | m), | |
| | | // AND_n_VALUE_PARAMS(p1, ..., p_n)) { statements; } | |
| | | // | |
| | | // defines an action template that takes m explicit template | |
| | | // parameters and n value parameters. name_i is the name of the i-th | |
| | | // template parameter, and kind_i specifies whether it's a typename, | |
| | | // an integral constant, or a template. p_i is the name of the i-th | |
| | | // value parameter. | |
| | | // | |
| | | // Example: | |
| | | // | |
| | | // // DuplicateArg<k, T>(output) converts the k-th argument of the mock | |
| | | // // function to type T and copies it to *output. | |
| | | // ACTION_TEMPLATE(DuplicateArg, | |
| | | // HAS_2_TEMPLATE_PARAMS(int, k, typename, T), | |
| | | // AND_1_VALUE_PARAMS(output)) { | |
| | | // *output = T(std::tr1::get<k>(args)); | |
| | | // } | |
| | | // ... | |
| | | // int n; | |
| | | // EXPECT_CALL(mock, Foo(_, _)) | |
| | | // .WillOnce(DuplicateArg<1, unsigned char>(&n)); | |
| | | // | |
| | | // To create an instance of an action template, write: | |
| | | // | |
| | | // ActionName<t1, ..., t_m>(v1, ..., v_n) | |
| | | // | |
| | | // where the ts are the template arguments and the vs are the value | |
| | | // arguments. The value argument types are inferred by the compiler. | |
| | | // If you want to explicitly specify the value argument types, you can | |
| | | // provide additional template arguments: | |
| | | // | |
| | | // ActionName<t1, ..., t_m, u1, ..., u_k>(v1, ..., v_n) | |
| | | // | |
| | | // where u_i is the desired type of v_i. | |
| | | // | |
| | | // ACTION_TEMPLATE and ACTION/ACTION_P* can be overloaded on the | |
| | | // number of value parameters, but not on the number of template | |
| | | // parameters. Without the restriction, the meaning of the following | |
| | | // is unclear: | |
| | | // | |
| | | // OverloadedAction<int, bool>(x); | |
| | | // | |
| | | // Are we using a single-template-parameter action where 'bool' refers | |
| | | // to the type of x, or are we using a two-template-parameter action | |
| | | // where the compiler is asked to infer the type of x? | |
| | | // | |
| | | // Implementation notes: | |
| | | // | |
| | | // GMOCK_INTERNAL_*_HAS_m_TEMPLATE_PARAMS and | |
| | | // GMOCK_INTERNAL_*_AND_n_VALUE_PARAMS are internal macros for | |
| | | // implementing ACTION_TEMPLATE. The main trick we use is to create | |
| | | // new macro invocations when expanding a macro. For example, we have | |
| | | // | |
| | | // #define ACTION_TEMPLATE(name, template_params, value_params) | |
| | | // ... GMOCK_INTERNAL_DECL_##template_params ... | |
| | | // | |
| | | // which causes ACTION_TEMPLATE(..., HAS_1_TEMPLATE_PARAMS(typename, T), .. | |
| | | .) | |
| | | // to expand to | |
| | | // | |
| | | // ... GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(typename, T) ... | |
| | | // | |
| | | // Since GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS is a macro, the | |
| | | // preprocessor will continue to expand it to | |
| | | // | |
| | | // ... typename T ... | |
| | | // | |
| | | // This technique conforms to the C++ standard and is portable. It | |
| | | // allows us to implement action templates using O(N) code, where N is | |
| | | // the maximum number of template/value parameters supported. Without | |
| | | // using it, we'd have to devote O(N^2) amount of code to implement all | |
| | | // combinations of m and n. | |
| | | | |
| | | // Declares the template parameters. | |
| | | #define GMOCK_INTERNAL_DECL_HAS_1_TEMPLATE_PARAMS(kind0, name0) kind0 name0 | |
| | | #define GMOCK_INTERNAL_DECL_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \ | |
| | | name1) kind0 name0, kind1 name1 | |
| | | #define GMOCK_INTERNAL_DECL_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name | |
| | | 1, \ | |
| | | kind2, name2) kind0 name0, kind1 name1, kind2 name2 | |
| | | #define GMOCK_INTERNAL_DECL_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name | |
| | | 1, \ | |
| | | kind2, name2, kind3, name3) kind0 name0, kind1 name1, kind2 name2, \ | |
| | | kind3 name3 | |
| | | #define GMOCK_INTERNAL_DECL_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name | |
| | | 1, \ | |
| | | kind2, name2, kind3, name3, kind4, name4) kind0 name0, kind1 name1, \ | |
| | | kind2 name2, kind3 name3, kind4 name4 | |
| | | #define GMOCK_INTERNAL_DECL_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name | |
| | | 1, \ | |
| | | kind2, name2, kind3, name3, kind4, name4, kind5, name5) kind0 name0, \ | |
| | | kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5 | |
| | | #define GMOCK_INTERNAL_DECL_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name | |
| | | 1, \ | |
| | | kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ | |
| | | name6) kind0 name0, kind1 name1, kind2 name2, kind3 name3, kind4 name4, | |
| | | \ | |
| | | kind5 name5, kind6 name6 | |
| | | #define GMOCK_INTERNAL_DECL_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name | |
| | | 1, \ | |
| | | kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ | |
| | | kind7, name7) kind0 name0, kind1 name1, kind2 name2, kind3 name3, \ | |
| | | kind4 name4, kind5 name5, kind6 name6, kind7 name7 | |
| | | #define GMOCK_INTERNAL_DECL_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name | |
| | | 1, \ | |
| | | kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ | |
| | | kind7, name7, kind8, name8) kind0 name0, kind1 name1, kind2 name2, \ | |
| | | kind3 name3, kind4 name4, kind5 name5, kind6 name6, kind7 name7, \ | |
| | | kind8 name8 | |
| | | #define GMOCK_INTERNAL_DECL_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \ | |
| | | name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ | |
| | | name6, kind7, name7, kind8, name8, kind9, name9) kind0 name0, \ | |
| | | kind1 name1, kind2 name2, kind3 name3, kind4 name4, kind5 name5, \ | |
| | | kind6 name6, kind7 name7, kind8 name8, kind9 name9 | |
| | | | |
| | | // Lists the template parameters. | |
| | | #define GMOCK_INTERNAL_LIST_HAS_1_TEMPLATE_PARAMS(kind0, name0) name0 | |
| | | #define GMOCK_INTERNAL_LIST_HAS_2_TEMPLATE_PARAMS(kind0, name0, kind1, \ | |
| | | name1) name0, name1 | |
| | | #define GMOCK_INTERNAL_LIST_HAS_3_TEMPLATE_PARAMS(kind0, name0, kind1, name | |
| | | 1, \ | |
| | | kind2, name2) name0, name1, name2 | |
| | | #define GMOCK_INTERNAL_LIST_HAS_4_TEMPLATE_PARAMS(kind0, name0, kind1, name | |
| | | 1, \ | |
| | | kind2, name2, kind3, name3) name0, name1, name2, name3 | |
| | | #define GMOCK_INTERNAL_LIST_HAS_5_TEMPLATE_PARAMS(kind0, name0, kind1, name | |
| | | 1, \ | |
| | | kind2, name2, kind3, name3, kind4, name4) name0, name1, name2, name3, \ | |
| | | name4 | |
| | | #define GMOCK_INTERNAL_LIST_HAS_6_TEMPLATE_PARAMS(kind0, name0, kind1, name | |
| | | 1, \ | |
| | | kind2, name2, kind3, name3, kind4, name4, kind5, name5) name0, name1, \ | |
| | | name2, name3, name4, name5 | |
| | | #define GMOCK_INTERNAL_LIST_HAS_7_TEMPLATE_PARAMS(kind0, name0, kind1, name | |
| | | 1, \ | |
| | | kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ | |
| | | name6) name0, name1, name2, name3, name4, name5, name6 | |
| | | #define GMOCK_INTERNAL_LIST_HAS_8_TEMPLATE_PARAMS(kind0, name0, kind1, name | |
| | | 1, \ | |
| | | kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ | |
| | | kind7, name7) name0, name1, name2, name3, name4, name5, name6, name7 | |
| | | #define GMOCK_INTERNAL_LIST_HAS_9_TEMPLATE_PARAMS(kind0, name0, kind1, name | |
| | | 1, \ | |
| | | kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, name6, \ | |
| | | kind7, name7, kind8, name8) name0, name1, name2, name3, name4, name5, \ | |
| | | name6, name7, name8 | |
| | | #define GMOCK_INTERNAL_LIST_HAS_10_TEMPLATE_PARAMS(kind0, name0, kind1, \ | |
| | | name1, kind2, name2, kind3, name3, kind4, name4, kind5, name5, kind6, \ | |
| | | name6, kind7, name7, kind8, name8, kind9, name9) name0, name1, name2, \ | |
| | | name3, name4, name5, name6, name7, name8, name9 | |
| | | | |
| | | // Declares the types of value parameters. | |
| | | #define GMOCK_INTERNAL_DECL_TYPE_AND_0_VALUE_PARAMS() | |
| | | #define GMOCK_INTERNAL_DECL_TYPE_AND_1_VALUE_PARAMS(p0) , typename p0##_typ | |
| | | e | |
| | | #define GMOCK_INTERNAL_DECL_TYPE_AND_2_VALUE_PARAMS(p0, p1) , \ | |
| | | typename p0##_type, typename p1##_type | |
| | | #define GMOCK_INTERNAL_DECL_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , \ | |
| | | typename p0##_type, typename p1##_type, typename p2##_type | |
| | | #define GMOCK_INTERNAL_DECL_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \ | |
| | | typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| | | typename p3##_type | |
| | | #define GMOCK_INTERNAL_DECL_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \ | |
| | | typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| | | typename p3##_type, typename p4##_type | |
| | | #define GMOCK_INTERNAL_DECL_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) | |
| | | , \ | |
| | | typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| | | typename p3##_type, typename p4##_type, typename p5##_type | |
| | | #define GMOCK_INTERNAL_DECL_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, | |
| | | \ | |
| | | p6) , typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| | | typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| | | typename p6##_type | |
| | | #define GMOCK_INTERNAL_DECL_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, | |
| | | \ | |
| | | p6, p7) , typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| | | typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| | | typename p6##_type, typename p7##_type | |
| | | #define GMOCK_INTERNAL_DECL_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, | |
| | | \ | |
| | | p6, p7, p8) , typename p0##_type, typename p1##_type, typename p2##_typ | |
| | | e, \ | |
| | | typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| | | typename p6##_type, typename p7##_type, typename p8##_type | |
| | | #define GMOCK_INTERNAL_DECL_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5 | |
| | | , \ | |
| | | p6, p7, p8, p9) , typename p0##_type, typename p1##_type, \ | |
| | | typename p2##_type, typename p3##_type, typename p4##_type, \ | |
| | | typename p5##_type, typename p6##_type, typename p7##_type, \ | |
| | | typename p8##_type, typename p9##_type | |
| | | | |
| | | // Initializes the value parameters. | |
| | | #define GMOCK_INTERNAL_INIT_AND_0_VALUE_PARAMS()\ | |
| | | () | |
| | | #define GMOCK_INTERNAL_INIT_AND_1_VALUE_PARAMS(p0)\ | |
| | | (p0##_type gmock_p0) : p0(gmock_p0) | |
| | | #define GMOCK_INTERNAL_INIT_AND_2_VALUE_PARAMS(p0, p1)\ | |
| | | (p0##_type gmock_p0, p1##_type gmock_p1) : p0(gmock_p0), p1(gmock_p1) | |
| | | #define GMOCK_INTERNAL_INIT_AND_3_VALUE_PARAMS(p0, p1, p2)\ | |
| | | (p0##_type gmock_p0, p1##_type gmock_p1, \ | |
| | | p2##_type gmock_p2) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2) | |
| | | #define GMOCK_INTERNAL_INIT_AND_4_VALUE_PARAMS(p0, p1, p2, p3)\ | |
| | | (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(gmock_p3) | |
| | | #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, \ | |
| | | p3##_type gmock_p3, p4##_type gmock_p4) : p0(gmock_p0), p1(gmock_p1 | |
| | | ), \ | |
| | | p2(gmock_p2), p3(gmock_p3), p4(gmock_p4) | |
| | | #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, \ | |
| | | p3##_type gmock_p3, p4##_type gmock_p4, \ | |
| | | p5##_type gmock_p5) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ | |
| | | p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) | |
| | | #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, \ | |
| | | 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), \ | |
| | | p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6) | |
| | | #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, \ | |
| | | 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 | |
| | | ), \ | |
| | | p2(gmock_p2), p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6 | |
| | | ), \ | |
| | | p7(gmock_p7) | |
| | | #define GMOCK_INTERNAL_INIT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, | |
| | | \ | |
| | | p7, p8)\ | |
| | | (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ | |
| | | p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ | |
| | | p6##_type gmock_p6, p7##_type gmock_p7, \ | |
| | | p8##_type gmock_p8) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ | |
| | | p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7 | |
| | | ), \ | |
| | | p8(gmock_p8) | |
| | | #define GMOCK_INTERNAL_INIT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, | |
| | | \ | |
| | | p7, p8, p9)\ | |
| | | (p0##_type gmock_p0, p1##_type gmock_p1, p2##_type gmock_p2, \ | |
| | | p3##_type gmock_p3, p4##_type gmock_p4, p5##_type gmock_p5, \ | |
| | | p6##_type gmock_p6, p7##_type gmock_p7, p8##_type gmock_p8, \ | |
| | | p9##_type gmock_p9) : p0(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ | |
| | | p3(gmock_p3), p4(gmock_p4), p5(gmock_p5), p6(gmock_p6), p7(gmock_p7 | |
| | | ), \ | |
| | | p8(gmock_p8), p9(gmock_p9) | |
| | | | |
| | | // Declares the fields for storing the value parameters. | |
| | | #define GMOCK_INTERNAL_DEFN_AND_0_VALUE_PARAMS() | |
| | | #define GMOCK_INTERNAL_DEFN_AND_1_VALUE_PARAMS(p0) p0##_type p0; | |
| | | #define GMOCK_INTERNAL_DEFN_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0; \ | |
| | | p1##_type p1; | |
| | | #define GMOCK_INTERNAL_DEFN_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0; \ | |
| | | p1##_type p1; p2##_type p2; | |
| | | #define GMOCK_INTERNAL_DEFN_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0 | |
| | | ; \ | |
| | | p1##_type p1; p2##_type p2; p3##_type p3; | |
| | | #define GMOCK_INTERNAL_DEFN_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \ | |
| | | p4) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p | |
| | | 4; | |
| | | #define GMOCK_INTERNAL_DEFN_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \ | |
| | | p5) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p | |
| | | 4; \ | |
| | | p5##_type p5; | |
| | | #define GMOCK_INTERNAL_DEFN_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ | |
| | | p6) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p | |
| | | 4; \ | |
| | | p5##_type p5; p6##_type p6; | |
| | | #define GMOCK_INTERNAL_DEFN_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, | |
| | | \ | |
| | | p7) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; p4##_type p | |
| | | 4; \ | |
| | | p5##_type p5; p6##_type p6; p7##_type p7; | |
| | | #define GMOCK_INTERNAL_DEFN_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, | |
| | | \ | |
| | | p7, p8) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \ | |
| | | p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; | |
| | | #define GMOCK_INTERNAL_DEFN_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, | |
| | | \ | |
| | | p7, p8, p9) p0##_type p0; p1##_type p1; p2##_type p2; p3##_type p3; \ | |
| | | p4##_type p4; p5##_type p5; p6##_type p6; p7##_type p7; p8##_type p8; \ | |
| | | p9##_type p9; | |
| | | | |
| | | // Lists the value parameters. | |
| | | #define GMOCK_INTERNAL_LIST_AND_0_VALUE_PARAMS() | |
| | | #define GMOCK_INTERNAL_LIST_AND_1_VALUE_PARAMS(p0) p0 | |
| | | #define GMOCK_INTERNAL_LIST_AND_2_VALUE_PARAMS(p0, p1) p0, p1 | |
| | | #define GMOCK_INTERNAL_LIST_AND_3_VALUE_PARAMS(p0, p1, p2) p0, p1, p2 | |
| | | #define GMOCK_INTERNAL_LIST_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0, p1, p2, | |
| | | p3 | |
| | | #define GMOCK_INTERNAL_LIST_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) p0, p1, | |
| | | \ | |
| | | p2, p3, p4 | |
| | | #define GMOCK_INTERNAL_LIST_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) p0, | |
| | | \ | |
| | | p1, p2, p3, p4, p5 | |
| | | #define GMOCK_INTERNAL_LIST_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ | |
| | | p6) p0, p1, p2, p3, p4, p5, p6 | |
| | | #define GMOCK_INTERNAL_LIST_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, | |
| | | \ | |
| | | p7) p0, p1, p2, p3, p4, p5, p6, p7 | |
| | | #define GMOCK_INTERNAL_LIST_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, | |
| | | \ | |
| | | p7, p8) p0, p1, p2, p3, p4, p5, p6, p7, p8 | |
| | | #define GMOCK_INTERNAL_LIST_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, | |
| | | \ | |
| | | p7, p8, p9) p0, p1, p2, p3, p4, p5, p6, p7, p8, p9 | |
| | | | |
| | | // Lists the value parameter types. | |
| | | #define GMOCK_INTERNAL_LIST_TYPE_AND_0_VALUE_PARAMS() | |
| | | #define GMOCK_INTERNAL_LIST_TYPE_AND_1_VALUE_PARAMS(p0) , p0##_type | |
| | | #define GMOCK_INTERNAL_LIST_TYPE_AND_2_VALUE_PARAMS(p0, p1) , p0##_type, \ | |
| | | p1##_type | |
| | | #define GMOCK_INTERNAL_LIST_TYPE_AND_3_VALUE_PARAMS(p0, p1, p2) , p0##_type | |
| | | , \ | |
| | | p1##_type, p2##_type | |
| | | #define GMOCK_INTERNAL_LIST_TYPE_AND_4_VALUE_PARAMS(p0, p1, p2, p3) , \ | |
| | | p0##_type, p1##_type, p2##_type, p3##_type | |
| | | #define GMOCK_INTERNAL_LIST_TYPE_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) , \ | |
| | | p0##_type, p1##_type, p2##_type, p3##_type, p4##_type | |
| | | #define GMOCK_INTERNAL_LIST_TYPE_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) | |
| | | , \ | |
| | | p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type | |
| | | #define GMOCK_INTERNAL_LIST_TYPE_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, | |
| | | \ | |
| | | p6) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, p5##_type, | |
| | | \ | |
| | | p6##_type | |
| | | #define GMOCK_INTERNAL_LIST_TYPE_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, | |
| | | \ | |
| | | p6, p7) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ | |
| | | p5##_type, p6##_type, p7##_type | |
| | | #define GMOCK_INTERNAL_LIST_TYPE_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, | |
| | | \ | |
| | | p6, p7, p8) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type, \ | |
| | | p5##_type, p6##_type, p7##_type, p8##_type | |
| | | #define GMOCK_INTERNAL_LIST_TYPE_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5 | |
| | | , \ | |
| | | p6, p7, p8, p9) , p0##_type, p1##_type, p2##_type, p3##_type, p4##_type | |
| | | , \ | |
| | | p5##_type, p6##_type, p7##_type, p8##_type, p9##_type | |
| | | | |
| | | // Declares the value parameters. | |
| | | #define GMOCK_INTERNAL_DECL_AND_0_VALUE_PARAMS() | |
| | | #define GMOCK_INTERNAL_DECL_AND_1_VALUE_PARAMS(p0) p0##_type p0 | |
| | | #define GMOCK_INTERNAL_DECL_AND_2_VALUE_PARAMS(p0, p1) p0##_type p0, \ | |
| | | p1##_type p1 | |
| | | #define GMOCK_INTERNAL_DECL_AND_3_VALUE_PARAMS(p0, p1, p2) p0##_type p0, \ | |
| | | p1##_type p1, p2##_type p2 | |
| | | #define GMOCK_INTERNAL_DECL_AND_4_VALUE_PARAMS(p0, p1, p2, p3) p0##_type p0 | |
| | | , \ | |
| | | p1##_type p1, p2##_type p2, p3##_type p3 | |
| | | #define GMOCK_INTERNAL_DECL_AND_5_VALUE_PARAMS(p0, p1, p2, p3, \ | |
| | | p4) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p | |
| | | 4 | |
| | | #define GMOCK_INTERNAL_DECL_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, \ | |
| | | p5) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p | |
| | | 4, \ | |
| | | p5##_type p5 | |
| | | #define GMOCK_INTERNAL_DECL_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, \ | |
| | | p6) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p | |
| | | 4, \ | |
| | | p5##_type p5, p6##_type p6 | |
| | | #define GMOCK_INTERNAL_DECL_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, | |
| | | \ | |
| | | p7) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, p4##_type p | |
| | | 4, \ | |
| | | p5##_type p5, p6##_type p6, p7##_type p7 | |
| | | #define GMOCK_INTERNAL_DECL_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, | |
| | | \ | |
| | | p7, p8) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ | |
| | | p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8 | |
| | | #define GMOCK_INTERNAL_DECL_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, | |
| | | \ | |
| | | p7, p8, p9) p0##_type p0, p1##_type p1, p2##_type p2, p3##_type p3, \ | |
| | | p4##_type p4, p5##_type p5, p6##_type p6, p7##_type p7, p8##_type p8, \ | |
| | | p9##_type p9 | |
| | | | |
| | | // The suffix of the class template implementing the action template. | |
| | | #define GMOCK_INTERNAL_COUNT_AND_0_VALUE_PARAMS() | |
| | | #define GMOCK_INTERNAL_COUNT_AND_1_VALUE_PARAMS(p0) P | |
| | | #define GMOCK_INTERNAL_COUNT_AND_2_VALUE_PARAMS(p0, p1) P2 | |
| | | #define GMOCK_INTERNAL_COUNT_AND_3_VALUE_PARAMS(p0, p1, p2) P3 | |
| | | #define GMOCK_INTERNAL_COUNT_AND_4_VALUE_PARAMS(p0, p1, p2, p3) P4 | |
| | | #define GMOCK_INTERNAL_COUNT_AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4) P5 | |
| | | #define GMOCK_INTERNAL_COUNT_AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5) P6 | |
| | | #define GMOCK_INTERNAL_COUNT_AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6) | |
| | | P7 | |
| | | #define GMOCK_INTERNAL_COUNT_AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, | |
| | | \ | |
| | | p7) P8 | |
| | | #define GMOCK_INTERNAL_COUNT_AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, | |
| | | \ | |
| | | p7, p8) P9 | |
| | | #define GMOCK_INTERNAL_COUNT_AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6 | |
| | | , \ | |
| | | p7, p8, p9) P10 | |
| | | | |
| | | // The name of the class template implementing the action template. | |
| | | #define GMOCK_ACTION_CLASS_(name, value_params)\ | |
| | | GMOCK_CONCAT_TOKEN_(name##Action, GMOCK_INTERNAL_COUNT_##value_params) | |
| | | | |
| | | #define ACTION_TEMPLATE(name, template_params, value_params)\ | |
| | | template <GMOCK_INTERNAL_DECL_##template_params\ | |
| | | GMOCK_INTERNAL_DECL_TYPE_##value_params>\ | |
| | | class GMOCK_ACTION_CLASS_(name, value_params) {\ | |
| | | public:\ | |
| | | GMOCK_ACTION_CLASS_(name, value_params)\ | |
| | | GMOCK_INTERNAL_INIT_##value_params {}\ | |
| | | template <typename F>\ | |
| | | class gmock_Impl : public ::testing::ActionInterface<F> {\ | |
| | | public:\ | |
| | | typedef F function_type;\ | |
| | | typedef typename ::testing::internal::Function<F>::Result return_type | |
| | | ;\ | |
| | | typedef typename ::testing::internal::Function<F>::ArgumentTuple\ | |
| | | args_type;\ | |
| | | explicit gmock_Impl GMOCK_INTERNAL_INIT_##value_params {}\ | |
| | | virtual return_type Perform(const args_type& args) {\ | |
| | | return ::testing::internal::ActionHelper<return_type, gmock_Impl>:: | |
| | | \ | |
| | | Perform(this, args);\ | |
| | | }\ | |
| | | template <typename arg0_type, typename arg1_type, typename arg2_type, | |
| | | \ | |
| | | typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| | | typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| | | typename arg9_type>\ | |
| | | return_type gmock_PerformImpl(const args_type& args, arg0_type arg0, | |
| | | \ | |
| | | arg1_type arg1, arg2_type arg2, arg3_type arg3, arg4_type arg4, \ | |
| | | arg5_type arg5, arg6_type arg6, arg7_type arg7, arg8_type arg8, \ | |
| | | arg9_type arg9) const;\ | |
| | | GMOCK_INTERNAL_DEFN_##value_params\ | |
| | | };\ | |
| | | template <typename F> operator ::testing::Action<F>() const {\ | |
| | | return ::testing::Action<F>(\ | |
| | | new gmock_Impl<F>(GMOCK_INTERNAL_LIST_##value_params));\ | |
| | | }\ | |
| | | GMOCK_INTERNAL_DEFN_##value_params\ | |
| | | };\ | |
| | | template <GMOCK_INTERNAL_DECL_##template_params\ | |
| | | GMOCK_INTERNAL_DECL_TYPE_##value_params>\ | |
| | | inline GMOCK_ACTION_CLASS_(name, value_params)<\ | |
| | | GMOCK_INTERNAL_LIST_##template_params\ | |
| | | GMOCK_INTERNAL_LIST_TYPE_##value_params> name(\ | |
| | | GMOCK_INTERNAL_DECL_##value_params) {\ | |
| | | return GMOCK_ACTION_CLASS_(name, value_params)<\ | |
| | | GMOCK_INTERNAL_LIST_##template_params\ | |
| | | GMOCK_INTERNAL_LIST_TYPE_##value_params>(\ | |
| | | GMOCK_INTERNAL_LIST_##value_params);\ | |
| | | }\ | |
| | | template <GMOCK_INTERNAL_DECL_##template_params\ | |
| | | GMOCK_INTERNAL_DECL_TYPE_##value_params>\ | |
| | | template <typename F>\ | |
| | | template <typename arg0_type, typename arg1_type, typename arg2_type,\ | |
| | | typename arg3_type, typename arg4_type, typename arg5_type,\ | |
| | | typename arg6_type, typename arg7_type, typename arg8_type,\ | |
| | | typename arg9_type>\ | |
| | | typename ::testing::internal::Function<F>::Result\ | |
| | | GMOCK_ACTION_CLASS_(name, value_params)<\ | |
| | | GMOCK_INTERNAL_LIST_##template_params\ | |
| | | GMOCK_INTERNAL_LIST_TYPE_##value_params>::gmock_Impl<F>::\ | |
| | | gmock_PerformImpl(\ | |
| | | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| | | | |
| #define ACTION(name)\ | | #define ACTION(name)\ | |
| class name##Action {\ | | class name##Action {\ | |
| public:\ | | public:\ | |
| name##Action() {}\ | | name##Action() {}\ | |
| template <typename F>\ | | template <typename F>\ | |
| class gmock_Impl : public ::testing::ActionInterface<F> {\ | | class gmock_Impl : public ::testing::ActionInterface<F> {\ | |
| public:\ | | public:\ | |
| typedef F function_type;\ | | typedef F function_type;\ | |
| 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\ | |
| | | | |
| skipping to change at line 1597 | | skipping to change at line 1479 | |
| };\ | | };\ | |
| inline name##Action name() {\ | | inline name##Action name() {\ | |
| return name##Action();\ | | return name##Action();\ | |
| }\ | | }\ | |
| template <typename F>\ | | template <typename F>\ | |
| template <typename arg0_type, typename arg1_type, typename arg2_type, \ | | template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| typename arg3_type, typename arg4_type, typename arg5_type, \ | | typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| typename arg6_type, typename arg7_type, typename arg8_type, \ | | typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| typename arg9_type>\ | | typename arg9_type>\ | |
| typename ::testing::internal::Function<F>::Result\ | | typename ::testing::internal::Function<F>::Result\ | |
|
| name##Action::\ | | name##Action::gmock_Impl<F>::gmock_PerformImpl(\ | |
| gmock_Impl<F>::gmock_PerformImpl(const args_type& args, \ | | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg | | | |
| 3, \ | | | |
| arg4_type arg4, arg5_type arg5, arg6_type arg6, arg7_type arg | | | |
| 7, \ | | | |
| arg8_type arg8, arg9_type arg9) const | | | |
| | | | |
| #define ACTION_P(name, p0)\ | | #define ACTION_P(name, p0)\ | |
| template <typename p0##_type>\ | | template <typename p0##_type>\ | |
| class name##ActionP {\ | | class name##ActionP {\ | |
| public:\ | | public:\ | |
| name##ActionP(p0##_type gmock_p0) : p0(gmock_p0) {}\ | | name##ActionP(p0##_type gmock_p0) : p0(gmock_p0) {}\ | |
| template <typename F>\ | | template <typename F>\ | |
| class gmock_Impl : public ::testing::ActionInterface<F> {\ | | class gmock_Impl : public ::testing::ActionInterface<F> {\ | |
| public:\ | | public:\ | |
| typedef F function_type;\ | | typedef F function_type;\ | |
| | | | |
| skipping to change at line 1646 | | skipping to change at line 1525 | |
| inline name##ActionP<p0##_type> name(p0##_type p0) {\ | | inline name##ActionP<p0##_type> name(p0##_type p0) {\ | |
| return name##ActionP<p0##_type>(p0);\ | | return name##ActionP<p0##_type>(p0);\ | |
| }\ | | }\ | |
| template <typename p0##_type>\ | | template <typename p0##_type>\ | |
| template <typename F>\ | | template <typename F>\ | |
| template <typename arg0_type, typename arg1_type, typename arg2_type, \ | | template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| typename arg3_type, typename arg4_type, typename arg5_type, \ | | typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| typename arg6_type, typename arg7_type, typename arg8_type, \ | | typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| typename arg9_type>\ | | typename arg9_type>\ | |
| typename ::testing::internal::Function<F>::Result\ | | typename ::testing::internal::Function<F>::Result\ | |
|
| name##ActionP<p0##_type>::\ | | name##ActionP<p0##_type>::gmock_Impl<F>::gmock_PerformImpl(\ | |
| gmock_Impl<F>::gmock_PerformImpl(const args_type& args, \ | | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg | | | |
| 3, \ | | | |
| arg4_type arg4, arg5_type arg5, arg6_type arg6, arg7_type arg | | | |
| 7, \ | | | |
| arg8_type arg8, arg9_type arg9) const | | | |
| | | | |
| #define ACTION_P2(name, p0, p1)\ | | #define ACTION_P2(name, p0, p1)\ | |
| 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##_type gmock_p1) : p0(gmock_p0),
\ | |
| p1(gmock_p1) {}\ | | p1(gmock_p1) {}\ | |
| template <typename F>\ | | template <typename F>\ | |
| class gmock_Impl : public ::testing::ActionInterface<F> {\ | | class gmock_Impl : public ::testing::ActionInterface<F> {\ | |
| public:\ | | public:\ | |
| | | | |
| skipping to change at line 1700 | | skipping to change at line 1576 | |
| p1##_type p1) {\ | | p1##_type p1) {\ | |
| return name##ActionP2<p0##_type, p1##_type>(p0, p1);\ | | return name##ActionP2<p0##_type, p1##_type>(p0, p1);\ | |
| }\ | | }\ | |
| template <typename p0##_type, typename p1##_type>\ | | template <typename p0##_type, typename p1##_type>\ | |
| template <typename F>\ | | template <typename F>\ | |
| template <typename arg0_type, typename arg1_type, typename arg2_type, \ | | template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| typename arg3_type, typename arg4_type, typename arg5_type, \ | | typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| typename arg6_type, typename arg7_type, typename arg8_type, \ | | typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| typename arg9_type>\ | | typename arg9_type>\ | |
| typename ::testing::internal::Function<F>::Result\ | | typename ::testing::internal::Function<F>::Result\ | |
|
| name##ActionP2<p0##_type, p1##_type>::\ | | name##ActionP2<p0##_type, p1##_type>::gmock_Impl<F>::gmock_PerformImp | |
| gmock_Impl<F>::gmock_PerformImpl(const args_type& args, \ | | l(\ | |
| arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg | | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| 3, \ | | | |
| arg4_type arg4, arg5_type arg5, arg6_type arg6, arg7_type arg | | | |
| 7, \ | | | |
| arg8_type arg8, arg9_type arg9) const | | | |
| | | | |
| #define ACTION_P3(name, p0, p1, p2)\ | | #define ACTION_P3(name, p0, p1, p2)\ | |
| template <typename p0##_type, typename p1##_type, typename p2##_type>\ | | template <typename p0##_type, typename p1##_type, typename p2##_type>\ | |
| 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(gmock_p0), p1(gmock_p1), p2(gmock_p2) {}\ | |
| template <typename F>\ | | template <typename F>\ | |
| class gmock_Impl : public ::testing::ActionInterface<F> {\ | | class gmock_Impl : public ::testing::ActionInterface<F> {\ | |
| public:\ | | public:\ | |
| | | | |
| skipping to change at line 1756 | | skipping to change at line 1629 | |
| p1##_type p1, p2##_type p2) {\ | | p1##_type p1, p2##_type p2) {\ | |
| return name##ActionP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\ | | return name##ActionP3<p0##_type, p1##_type, p2##_type>(p0, p1, p2);\ | |
| }\ | | }\ | |
| template <typename p0##_type, typename p1##_type, typename p2##_type>\ | | template <typename p0##_type, typename p1##_type, typename p2##_type>\ | |
| template <typename F>\ | | template <typename F>\ | |
| template <typename arg0_type, typename arg1_type, typename arg2_type, \ | | template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| typename arg3_type, typename arg4_type, typename arg5_type, \ | | typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| typename arg6_type, typename arg7_type, typename arg8_type, \ | | typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| typename arg9_type>\ | | typename arg9_type>\ | |
| typename ::testing::internal::Function<F>::Result\ | | typename ::testing::internal::Function<F>::Result\ | |
|
| name##ActionP3<p0##_type, p1##_type, p2##_type>::\ | | name##ActionP3<p0##_type, p1##_type, \ | |
| gmock_Impl<F>::gmock_PerformImpl(const args_type& args, \ | | p2##_type>::gmock_Impl<F>::gmock_PerformImpl(\ | |
| arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg | | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| 3, \ | | | |
| arg4_type arg4, arg5_type arg5, arg6_type arg6, arg7_type arg | | | |
| 7, \ | | | |
| arg8_type arg8, arg9_type arg9) const | | | |
| | | | |
| #define ACTION_P4(name, p0, p1, p2, p3)\ | | #define ACTION_P4(name, p0, p1, p2, p3)\ | |
| template <typename p0##_type, typename p1##_type, typename p2##_type, \ | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| typename p3##_type>\ | | typename p3##_type>\ | |
| 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, p3##_type gmock_p3) : p0(gmock_p0), p1(gmock_p1
), \ | |
| p2(gmock_p2), p3(gmock_p3) {}\ | | p2(gmock_p2), p3(gmock_p3) {}\ | |
| template <typename F>\ | | template <typename F>\ | |
| | | | |
| skipping to change at line 1821 | | skipping to change at line 1692 | |
| p2, p3);\ | | p2, p3);\ | |
| }\ | | }\ | |
| template <typename p0##_type, typename p1##_type, typename p2##_type, \ | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| typename p3##_type>\ | | typename p3##_type>\ | |
| template <typename F>\ | | template <typename F>\ | |
| template <typename arg0_type, typename arg1_type, typename arg2_type, \ | | template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| typename arg3_type, typename arg4_type, typename arg5_type, \ | | typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| typename arg6_type, typename arg7_type, typename arg8_type, \ | | typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| typename arg9_type>\ | | typename arg9_type>\ | |
| typename ::testing::internal::Function<F>::Result\ | | typename ::testing::internal::Function<F>::Result\ | |
|
| name##ActionP4<p0##_type, p1##_type, p2##_type, p3##_type>::\ | | name##ActionP4<p0##_type, p1##_type, p2##_type, \ | |
| gmock_Impl<F>::gmock_PerformImpl(const args_type& args, \ | | p3##_type>::gmock_Impl<F>::gmock_PerformImpl(\ | |
| arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg | | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| 3, \ | | | |
| arg4_type arg4, arg5_type arg5, arg6_type arg6, arg7_type arg | | | |
| 7, \ | | | |
| arg8_type arg8, arg9_type arg9) const | | | |
| | | | |
| #define ACTION_P5(name, p0, p1, p2, p3, p4)\ | | #define ACTION_P5(name, p0, p1, p2, p3, p4)\ | |
| template <typename p0##_type, typename p1##_type, typename p2##_type, \ | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| typename p3##_type, typename p4##_type>\ | | typename p3##_type, typename p4##_type>\ | |
| class name##ActionP5 {\ | | class name##ActionP5 {\ | |
| 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(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ | |
| p3(gmock_p3), p4(gmock_p4) {}\ | | p3(gmock_p3), p4(gmock_p4) {}\ | |
| | | | |
| skipping to change at line 1889 | | skipping to change at line 1758 | |
| p4##_type>(p0, p1, p2, p3, p4);\ | | p4##_type>(p0, p1, p2, p3, p4);\ | |
| }\ | | }\ | |
| template <typename p0##_type, typename p1##_type, typename p2##_type, \ | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| typename p3##_type, typename p4##_type>\ | | typename p3##_type, typename p4##_type>\ | |
| template <typename F>\ | | template <typename F>\ | |
| template <typename arg0_type, typename arg1_type, typename arg2_type, \ | | template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| typename arg3_type, typename arg4_type, typename arg5_type, \ | | typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| typename arg6_type, typename arg7_type, typename arg8_type, \ | | typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| typename arg9_type>\ | | typename arg9_type>\ | |
| typename ::testing::internal::Function<F>::Result\ | | typename ::testing::internal::Function<F>::Result\ | |
|
| name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type> | | name##ActionP5<p0##_type, p1##_type, p2##_type, p3##_type, \ | |
| ::\ | | p4##_type>::gmock_Impl<F>::gmock_PerformImpl(\ | |
| gmock_Impl<F>::gmock_PerformImpl(const args_type& args, \ | | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg | | | |
| 3, \ | | | |
| arg4_type arg4, arg5_type arg5, arg6_type arg6, arg7_type arg | | | |
| 7, \ | | | |
| arg8_type arg8, arg9_type arg9) const | | | |
| | | | |
| #define ACTION_P6(name, p0, p1, p2, p3, p4, p5)\ | | #define ACTION_P6(name, p0, p1, p2, p3, p4, p5)\ | |
| template <typename p0##_type, typename p1##_type, typename p2##_type, \ | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| typename p3##_type, typename p4##_type, typename p5##_type>\ | | typename p3##_type, typename p4##_type, typename p5##_type>\ | |
| class name##ActionP6 {\ | | class name##ActionP6 {\ | |
| 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(gmock_p0), p1(gmock_p1), p2(gmock_p2), \ | |
| p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\ | | p3(gmock_p3), p4(gmock_p4), p5(gmock_p5) {}\ | |
| | | | |
| skipping to change at line 1961 | | skipping to change at line 1828 | |
| }\ | | }\ | |
| template <typename p0##_type, typename p1##_type, typename p2##_type, \ | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| typename p3##_type, typename p4##_type, typename p5##_type>\ | | typename p3##_type, typename p4##_type, typename p5##_type>\ | |
| template <typename F>\ | | template <typename F>\ | |
| template <typename arg0_type, typename arg1_type, typename arg2_type, \ | | template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| typename arg3_type, typename arg4_type, typename arg5_type, \ | | typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| typename arg6_type, typename arg7_type, typename arg8_type, \ | | typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| typename arg9_type>\ | | typename arg9_type>\ | |
| typename ::testing::internal::Function<F>::Result\ | | typename ::testing::internal::Function<F>::Result\ | |
| name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type,
\ | | name##ActionP6<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type,
\ | |
|
| p5##_type>::\ | | p5##_type>::gmock_Impl<F>::gmock_PerformImpl(\ | |
| gmock_Impl<F>::gmock_PerformImpl(const args_type& args, \ | | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg | | | |
| 3, \ | | | |
| arg4_type arg4, arg5_type arg5, arg6_type arg6, arg7_type arg | | | |
| 7, \ | | | |
| arg8_type arg8, arg9_type arg9) const | | | |
| | | | |
| #define ACTION_P7(name, p0, p1, p2, p3, p4, p5, p6)\ | | #define ACTION_P7(name, p0, p1, p2, p3, p4, p5, p6)\ | |
| template <typename p0##_type, typename p1##_type, typename p2##_type, \ | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| typename p3##_type, typename p4##_type, typename p5##_type, \ | | typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| typename p6##_type>\ | | typename p6##_type>\ | |
| class name##ActionP7 {\ | | class name##ActionP7 {\ | |
| 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, p6##_type gmock_p6) : p0(gmock_p0), p1(gmock_p1
), \ | |
| | | | |
| skipping to change at line 2041 | | skipping to change at line 1905 | |
| template <typename p0##_type, typename p1##_type, typename p2##_type, \ | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| typename p3##_type, typename p4##_type, typename p5##_type, \ | | typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| typename p6##_type>\ | | typename p6##_type>\ | |
| template <typename F>\ | | template <typename F>\ | |
| template <typename arg0_type, typename arg1_type, typename arg2_type, \ | | template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| typename arg3_type, typename arg4_type, typename arg5_type, \ | | typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| typename arg6_type, typename arg7_type, typename arg8_type, \ | | typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| typename arg9_type>\ | | typename arg9_type>\ | |
| typename ::testing::internal::Function<F>::Result\ | | typename ::testing::internal::Function<F>::Result\ | |
| name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type,
\ | | name##ActionP7<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type,
\ | |
|
| p5##_type, p6##_type>::\ | | p5##_type, p6##_type>::gmock_Impl<F>::gmock_PerformImpl(\ | |
| gmock_Impl<F>::gmock_PerformImpl(const args_type& args, \ | | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg | | | |
| 3, \ | | | |
| arg4_type arg4, arg5_type arg5, arg6_type arg6, arg7_type arg | | | |
| 7, \ | | | |
| arg8_type arg8, arg9_type arg9) const | | | |
| | | | |
| #define ACTION_P8(name, p0, p1, p2, p3, p4, p5, p6, p7)\ | | #define ACTION_P8(name, p0, p1, p2, p3, p4, p5, p6, p7)\ | |
| template <typename p0##_type, typename p1##_type, typename p2##_type, \ | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| typename p3##_type, typename p4##_type, typename p5##_type, \ | | typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| typename p6##_type, typename p7##_type>\ | | typename p6##_type, typename p7##_type>\ | |
| class name##ActionP8 {\ | | class name##ActionP8 {\ | |
| public:\ | | public:\ | |
| 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, \ | |
| | | | |
| skipping to change at line 2126 | | skipping to change at line 1987 | |
| template <typename p0##_type, typename p1##_type, typename p2##_type, \ | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| typename p3##_type, typename p4##_type, typename p5##_type, \ | | typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| typename p6##_type, typename p7##_type>\ | | typename p6##_type, typename p7##_type>\ | |
| template <typename F>\ | | template <typename F>\ | |
| template <typename arg0_type, typename arg1_type, typename arg2_type, \ | | template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| typename arg3_type, typename arg4_type, typename arg5_type, \ | | typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| typename arg6_type, typename arg7_type, typename arg8_type, \ | | typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| typename arg9_type>\ | | typename arg9_type>\ | |
| typename ::testing::internal::Function<F>::Result\ | | typename ::testing::internal::Function<F>::Result\ | |
| name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type,
\ | | name##ActionP8<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type,
\ | |
|
| p5##_type, p6##_type, p7##_type>::\ | | p5##_type, p6##_type, \ | |
| gmock_Impl<F>::gmock_PerformImpl(const args_type& args, \ | | p7##_type>::gmock_Impl<F>::gmock_PerformImpl(\ | |
| arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg | | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| 3, \ | | | |
| arg4_type arg4, arg5_type arg5, arg6_type arg6, arg7_type arg | | | |
| 7, \ | | | |
| arg8_type arg8, arg9_type arg9) const | | | |
| | | | |
| #define ACTION_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8)\ | | #define ACTION_P9(name, p0, p1, p2, p3, p4, p5, p6, p7, p8)\ | |
| template <typename p0##_type, typename p1##_type, typename p2##_type, \ | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| typename p3##_type, typename p4##_type, typename p5##_type, \ | | typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| typename p6##_type, typename p7##_type, typename p8##_type>\ | | typename p6##_type, typename p7##_type, typename p8##_type>\ | |
| class name##ActionP9 {\ | | class name##ActionP9 {\ | |
| public:\ | | public:\ | |
| 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, \ | |
| | | | |
| skipping to change at line 2215 | | skipping to change at line 2074 | |
| template <typename p0##_type, typename p1##_type, typename p2##_type, \ | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| typename p3##_type, typename p4##_type, typename p5##_type, \ | | typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| typename p6##_type, typename p7##_type, typename p8##_type>\ | | typename p6##_type, typename p7##_type, typename p8##_type>\ | |
| template <typename F>\ | | template <typename F>\ | |
| template <typename arg0_type, typename arg1_type, typename arg2_type, \ | | template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| typename arg3_type, typename arg4_type, typename arg5_type, \ | | typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| typename arg6_type, typename arg7_type, typename arg8_type, \ | | typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| typename arg9_type>\ | | typename arg9_type>\ | |
| typename ::testing::internal::Function<F>::Result\ | | typename ::testing::internal::Function<F>::Result\ | |
| name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type,
\ | | name##ActionP9<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type,
\ | |
|
| p5##_type, p6##_type, p7##_type, p8##_type>::\ | | p5##_type, p6##_type, p7##_type, \ | |
| gmock_Impl<F>::gmock_PerformImpl(const args_type& args, \ | | p8##_type>::gmock_Impl<F>::gmock_PerformImpl(\ | |
| arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg | | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| 3, \ | | | |
| arg4_type arg4, arg5_type arg5, arg6_type arg6, arg7_type arg | | | |
| 7, \ | | | |
| arg8_type arg8, arg9_type arg9) const | | | |
| | | | |
| #define ACTION_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)\ | | #define ACTION_P10(name, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9)\ | |
| template <typename p0##_type, typename p1##_type, typename p2##_type, \ | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| typename p3##_type, typename p4##_type, typename p5##_type, \ | | typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| typename p6##_type, typename p7##_type, typename p8##_type, \ | | typename p6##_type, typename p7##_type, typename p8##_type, \ | |
| typename p9##_type>\ | | typename p9##_type>\ | |
| class name##ActionP10 {\ | | class name##ActionP10 {\ | |
| public:\ | | public:\ | |
| 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, \ | |
| | | | |
| skipping to change at line 2309 | | skipping to change at line 2166 | |
| typename p3##_type, typename p4##_type, typename p5##_type, \ | | typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| typename p6##_type, typename p7##_type, typename p8##_type, \ | | typename p6##_type, typename p7##_type, typename p8##_type, \ | |
| typename p9##_type>\ | | typename p9##_type>\ | |
| template <typename F>\ | | template <typename F>\ | |
| template <typename arg0_type, typename arg1_type, typename arg2_type, \ | | template <typename arg0_type, typename arg1_type, typename arg2_type, \ | |
| typename arg3_type, typename arg4_type, typename arg5_type, \ | | typename arg3_type, typename arg4_type, typename arg5_type, \ | |
| typename arg6_type, typename arg7_type, typename arg8_type, \ | | typename arg6_type, typename arg7_type, typename arg8_type, \ | |
| typename arg9_type>\ | | typename arg9_type>\ | |
| typename ::testing::internal::Function<F>::Result\ | | typename ::testing::internal::Function<F>::Result\ | |
| name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type
, \ | | name##ActionP10<p0##_type, p1##_type, p2##_type, p3##_type, p4##_type
, \ | |
|
| p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>::\ | | p5##_type, p6##_type, p7##_type, p8##_type, \ | |
| gmock_Impl<F>::gmock_PerformImpl(const args_type& args, \ | | p9##_type>::gmock_Impl<F>::gmock_PerformImpl(\ | |
| arg0_type arg0, arg1_type arg1, arg2_type arg2, arg3_type arg | | GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_) const | |
| 3, \ | | | |
| arg4_type arg4, arg5_type arg5, arg6_type arg6, arg7_type arg | | | |
| 7, \ | | | |
| arg8_type arg8, arg9_type arg9) const | | | |
| | | | |
| // TODO(wan@google.com): move the following to a different .h file | | // TODO(wan@google.com): move the following to a different .h file | |
| // such that we don't have to run 'pump' every time the code is | | // such that we don't have to run 'pump' every time the code is | |
| // updated. | | // updated. | |
| namespace testing { | | namespace testing { | |
| | | | |
|
| namespace internal { | | // Various overloads for InvokeArgument<N>(). | |
| | | // | |
| | | // The InvokeArgument<N>(a1, a2, ..., a_k) action invokes the N-th | |
| | | // (0-based) argument, which must be a k-ary callable, of the mock | |
| | | // function, with arguments a1, a2, ..., a_k. | |
| | | // | |
| | | // Notes: | |
| | | // | |
| | | // 1. The arguments are passed by value by default. If you need to | |
| | | // pass an argument by reference, wrap it inside ByRef(). For | |
| | | // example, | |
| | | // | |
| | | // InvokeArgument<1>(5, string("Hello"), ByRef(foo)) | |
| | | // | |
| | | // passes 5 and string("Hello") by value, and passes foo by | |
| | | // reference. | |
| | | // | |
| | | // 2. If the callable takes an argument by reference but ByRef() is | |
| | | // not used, it will receive the reference to a copy of the value, | |
| | | // instead of the original value. For example, when the 0-th | |
| | | // argument of the mock function takes a const string&, the action | |
| | | // | |
| | | // InvokeArgument<0>(string("Hello")) | |
| | | // | |
| | | // makes a copy of the temporary string("Hello") object and passes a | |
| | | // reference of the copy, instead of the original temporary object, | |
| | | // to the callable. This makes it easy for a user to define an | |
| | | // InvokeArgument action from temporary values and have it performed | |
| | | // later. | |
| | | | |
|
| // Saves argument #0 to where the pointer points. | | ACTION_TEMPLATE(InvokeArgument, | |
| ACTION_P(SaveArg0, pointer) { *pointer = arg0; } | | HAS_1_TEMPLATE_PARAMS(int, k), | |
| | | AND_0_VALUE_PARAMS()) { | |
| | | return internal::CallableHelper<return_type>::Call( | |
| | | ::std::tr1::get<k>(args)); | |
| | | } | |
| | | | |
|
| // Assigns 'value' to the variable referenced by argument #0. | | ACTION_TEMPLATE(InvokeArgument, | |
| ACTION_P(SetArg0Referee, value) { | | HAS_1_TEMPLATE_PARAMS(int, k), | |
| // Ensures that argument #0 is a reference. If you get a compiler | | AND_1_VALUE_PARAMS(p0)) { | |
| // error on the next line, you are using SetArgReferee<k>(value) in | | return internal::CallableHelper<return_type>::Call( | |
| // a mock function whose k-th (0-based) argument is not a reference. | | ::std::tr1::get<k>(args), p0); | |
| GMOCK_COMPILE_ASSERT_(internal::is_reference<arg0_type>::value, | | | |
| SetArgReferee_must_be_used_with_a_reference_argumen | | | |
| t); | | | |
| arg0 = value; | | | |
| } | | } | |
| | | | |
|
| } // namespace internal | | ACTION_TEMPLATE(InvokeArgument, | |
| | | HAS_1_TEMPLATE_PARAMS(int, k), | |
| | | AND_2_VALUE_PARAMS(p0, p1)) { | |
| | | return internal::CallableHelper<return_type>::Call( | |
| | | ::std::tr1::get<k>(args), p0, p1); | |
| | | } | |
| | | | |
|
| // Action SaveArg<k>(pointer) saves the k-th (0-based) argument of the | | ACTION_TEMPLATE(InvokeArgument, | |
| // mock function to *pointer. | | HAS_1_TEMPLATE_PARAMS(int, k), | |
| template <int k, typename Pointer> | | AND_3_VALUE_PARAMS(p0, p1, p2)) { | |
| inline internal::WithArgsAction<internal::SaveArg0ActionP<Pointer>, k> | | return internal::CallableHelper<return_type>::Call( | |
| SaveArg(const Pointer& pointer) { | | ::std::tr1::get<k>(args), p0, p1, p2); | |
| return WithArg<k>(internal::SaveArg0(pointer)); | | | |
| } | | } | |
| | | | |
|
| // Action SetArgReferee<k>(value) assigns 'value' to the variable | | ACTION_TEMPLATE(InvokeArgument, | |
| // referenced by the k-th (0-based) argument of the mock function. | | HAS_1_TEMPLATE_PARAMS(int, k), | |
| template <int k, typename Value> | | AND_4_VALUE_PARAMS(p0, p1, p2, p3)) { | |
| inline internal::WithArgsAction<internal::SetArg0RefereeActionP<Value>, k> | | return internal::CallableHelper<return_type>::Call( | |
| SetArgReferee(const Value& value) { | | ::std::tr1::get<k>(args), p0, p1, p2, p3); | |
| return WithArg<k>(internal::SetArg0Referee(value)); | | | |
| } | | } | |
| | | | |
|
| // Action Throw(exception) can be used in a mock function of any type | | ACTION_TEMPLATE(InvokeArgument, | |
| // to throw the given exception. Any copyable value can be thrown. | | HAS_1_TEMPLATE_PARAMS(int, k), | |
| #if GTEST_HAS_EXCEPTIONS | | AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) { | |
| ACTION_P(Throw, exception) { throw exception; } | | return internal::CallableHelper<return_type>::Call( | |
| #endif // GTEST_HAS_EXCEPTIONS | | ::std::tr1::get<k>(args), p0, p1, p2, p3, p4); | |
| | | } | |
| | | | |
| | | ACTION_TEMPLATE(InvokeArgument, | |
| | | HAS_1_TEMPLATE_PARAMS(int, k), | |
| | | AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) { | |
| | | return internal::CallableHelper<return_type>::Call( | |
| | | ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5); | |
| | | } | |
| | | | |
| | | ACTION_TEMPLATE(InvokeArgument, | |
| | | HAS_1_TEMPLATE_PARAMS(int, k), | |
| | | AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) { | |
| | | return internal::CallableHelper<return_type>::Call( | |
| | | ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6); | |
| | | } | |
| | | | |
| | | ACTION_TEMPLATE(InvokeArgument, | |
| | | HAS_1_TEMPLATE_PARAMS(int, k), | |
| | | AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) { | |
| | | return internal::CallableHelper<return_type>::Call( | |
| | | ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7); | |
| | | } | |
| | | | |
| | | ACTION_TEMPLATE(InvokeArgument, | |
| | | HAS_1_TEMPLATE_PARAMS(int, k), | |
| | | AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) { | |
| | | return internal::CallableHelper<return_type>::Call( | |
| | | ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8); | |
| | | } | |
| | | | |
| | | ACTION_TEMPLATE(InvokeArgument, | |
| | | HAS_1_TEMPLATE_PARAMS(int, k), | |
| | | AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9) | |
| | | ) { | |
| | | return internal::CallableHelper<return_type>::Call( | |
| | | ::std::tr1::get<k>(args), p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); | |
| | | } | |
| | | | |
| | | // Various overloads for ReturnNew<T>(). | |
| | | // | |
| | | // The ReturnNew<T>(a1, a2, ..., a_k) action returns a pointer to a new | |
| | | // instance of type T, constructed on the heap with constructor arguments | |
| | | // a1, a2, ..., and a_k. The caller assumes ownership of the returned value | |
| | | . | |
| | | ACTION_TEMPLATE(ReturnNew, | |
| | | HAS_1_TEMPLATE_PARAMS(typename, T), | |
| | | AND_0_VALUE_PARAMS()) { | |
| | | return new T(); | |
| | | } | |
| | | | |
| | | ACTION_TEMPLATE(ReturnNew, | |
| | | HAS_1_TEMPLATE_PARAMS(typename, T), | |
| | | AND_1_VALUE_PARAMS(p0)) { | |
| | | return new T(p0); | |
| | | } | |
| | | | |
| | | ACTION_TEMPLATE(ReturnNew, | |
| | | HAS_1_TEMPLATE_PARAMS(typename, T), | |
| | | AND_2_VALUE_PARAMS(p0, p1)) { | |
| | | return new T(p0, p1); | |
| | | } | |
| | | | |
| | | ACTION_TEMPLATE(ReturnNew, | |
| | | HAS_1_TEMPLATE_PARAMS(typename, T), | |
| | | AND_3_VALUE_PARAMS(p0, p1, p2)) { | |
| | | return new T(p0, p1, p2); | |
| | | } | |
| | | | |
| | | ACTION_TEMPLATE(ReturnNew, | |
| | | HAS_1_TEMPLATE_PARAMS(typename, T), | |
| | | AND_4_VALUE_PARAMS(p0, p1, p2, p3)) { | |
| | | return new T(p0, p1, p2, p3); | |
| | | } | |
| | | | |
| | | ACTION_TEMPLATE(ReturnNew, | |
| | | HAS_1_TEMPLATE_PARAMS(typename, T), | |
| | | AND_5_VALUE_PARAMS(p0, p1, p2, p3, p4)) { | |
| | | return new T(p0, p1, p2, p3, p4); | |
| | | } | |
| | | | |
| | | ACTION_TEMPLATE(ReturnNew, | |
| | | HAS_1_TEMPLATE_PARAMS(typename, T), | |
| | | AND_6_VALUE_PARAMS(p0, p1, p2, p3, p4, p5)) { | |
| | | return new T(p0, p1, p2, p3, p4, p5); | |
| | | } | |
| | | | |
| | | ACTION_TEMPLATE(ReturnNew, | |
| | | HAS_1_TEMPLATE_PARAMS(typename, T), | |
| | | AND_7_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6)) { | |
| | | return new T(p0, p1, p2, p3, p4, p5, p6); | |
| | | } | |
| | | | |
| | | ACTION_TEMPLATE(ReturnNew, | |
| | | HAS_1_TEMPLATE_PARAMS(typename, T), | |
| | | AND_8_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7)) { | |
| | | return new T(p0, p1, p2, p3, p4, p5, p6, p7); | |
| | | } | |
| | | | |
| | | ACTION_TEMPLATE(ReturnNew, | |
| | | HAS_1_TEMPLATE_PARAMS(typename, T), | |
| | | AND_9_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8)) { | |
| | | return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8); | |
| | | } | |
| | | | |
| | | ACTION_TEMPLATE(ReturnNew, | |
| | | HAS_1_TEMPLATE_PARAMS(typename, T), | |
| | | AND_10_VALUE_PARAMS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9) | |
| | | ) { | |
| | | return new T(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); | |
| | | } | |
| | | | |
| } // namespace testing | | } // namespace testing | |
| | | | |
| #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ | | #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_ACTIONS_H_ | |
| | | | |
End of changes. 24 change blocks. |
| 671 lines changed or deleted | | 695 lines changed or added | |
|
| gmock-generated-function-mockers.h | | gmock-generated-function-mockers.h | |
| | | | |
| skipping to change at line 300 | | skipping to change at line 300 | |
| // The type of argument N of function type F. | | // The type of argument N of function type F. | |
| // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | | // 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. | | // The matcher type for argument N of function type F. | |
| // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | | // 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. | | // The variable for mocking the given method. | |
| // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | | // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | |
|
| #define GMOCK_MOCKER_(Method) GMOCK_CONCAT_TOKEN_(gmock_##Method##_, __LINE | | #define GMOCK_MOCKER_(arity, constness, Method) \ | |
| __) | | GMOCK_CONCAT_TOKEN_(gmock##constness##arity##_##Method##_, __LINE__) | |
| | | | |
| // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | | // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | |
| #define GMOCK_METHOD0_(tn, constness, ct, Method, F) \ | | #define GMOCK_METHOD0_(tn, constness, ct, Method, F) \ | |
| GMOCK_RESULT_(tn, F) ct Method() constness { \ | | GMOCK_RESULT_(tn, F) ct Method() constness { \ | |
| GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \ | | GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \ | |
| tn ::testing::internal::Function<F>::ArgumentTuple>::value == 0, \ | | tn ::testing::internal::Function<F>::ArgumentTuple>::value == 0, \ | |
| this_method_does_not_take_0_arguments); \ | | this_method_does_not_take_0_arguments); \ | |
|
| GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \ | | GMOCK_MOCKER_(0, constness, Method).SetOwnerAndName(this, #Method); \ | |
| return GMOCK_MOCKER_(Method).Invoke(); \ | | return GMOCK_MOCKER_(0, constness, Method).Invoke(); \ | |
| } \ | | } \ | |
| ::testing::MockSpec<F>& \ | | ::testing::MockSpec<F>& \ | |
| gmock_##Method() constness { \ | | gmock_##Method() constness { \ | |
|
| return GMOCK_MOCKER_(Method).RegisterOwner(this).With(); \ | | return GMOCK_MOCKER_(0, constness, Method).RegisterOwner(this).With();
\ | |
| } \ | | } \ | |
|
| mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method) | | mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(0, constness, Method) | |
| | | | |
| // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | | // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | |
| #define GMOCK_METHOD1_(tn, constness, ct, Method, F) \ | | #define GMOCK_METHOD1_(tn, constness, ct, Method, F) \ | |
| GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1) constness {
\ | | GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1) constness {
\ | |
| GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \ | | GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \ | |
| tn ::testing::internal::Function<F>::ArgumentTuple>::value == 1, \ | | tn ::testing::internal::Function<F>::ArgumentTuple>::value == 1, \ | |
| this_method_does_not_take_1_argument); \ | | this_method_does_not_take_1_argument); \ | |
|
| GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \ | | GMOCK_MOCKER_(1, constness, Method).SetOwnerAndName(this, #Method); \ | |
| return GMOCK_MOCKER_(Method).Invoke(gmock_a1); \ | | return GMOCK_MOCKER_(1, constness, Method).Invoke(gmock_a1); \ | |
| } \ | | } \ | |
| ::testing::MockSpec<F>& \ | | ::testing::MockSpec<F>& \ | |
| gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1) constness { \ | | gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1) constness { \ | |
|
| return GMOCK_MOCKER_(Method).RegisterOwner(this).With(gmock_a1); \ | | return GMOCK_MOCKER_(1, constness, \ | |
| | | Method).RegisterOwner(this).With(gmock_a1); \ | |
| } \ | | } \ | |
|
| mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method) | | mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(1, constness, Method) | |
| | | | |
| // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | | // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | |
| #define GMOCK_METHOD2_(tn, constness, ct, Method, F) \ | | #define GMOCK_METHOD2_(tn, constness, ct, Method, F) \ | |
| GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ | | GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ | |
| GMOCK_ARG_(tn, F, 2) gmock_a2) constness {
\ | | GMOCK_ARG_(tn, F, 2) gmock_a2) constness {
\ | |
| GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \ | | GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \ | |
| tn ::testing::internal::Function<F>::ArgumentTuple>::value == 2, \ | | tn ::testing::internal::Function<F>::ArgumentTuple>::value == 2, \ | |
| this_method_does_not_take_2_arguments); \ | | this_method_does_not_take_2_arguments); \ | |
|
| GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \ | | GMOCK_MOCKER_(2, constness, Method).SetOwnerAndName(this, #Method); \ | |
| return GMOCK_MOCKER_(Method).Invoke(gmock_a1, gmock_a2); \ | | return GMOCK_MOCKER_(2, constness, Method).Invoke(gmock_a1, gmock_a2); | |
| | | \ | |
| } \ | | } \ | |
| ::testing::MockSpec<F>& \ | | ::testing::MockSpec<F>& \ | |
| gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ | | gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ | |
| GMOCK_MATCHER_(tn, F, 2) gmock_a2) constness { \ | | GMOCK_MATCHER_(tn, F, 2) gmock_a2) constness { \ | |
|
| return GMOCK_MOCKER_(Method).RegisterOwner(this).With(gmock_a1, gmock_a | | return GMOCK_MOCKER_(2, constness, \ | |
| 2); \ | | Method).RegisterOwner(this).With(gmock_a1, gmock_a2); \ | |
| } \ | | } \ | |
|
| mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method) | | mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(2, constness, Method) | |
| | | | |
| // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | | // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | |
| #define GMOCK_METHOD3_(tn, constness, ct, Method, F) \ | | #define GMOCK_METHOD3_(tn, constness, ct, Method, F) \ | |
| GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ | | GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ | |
| GMOCK_ARG_(tn, F, 2) gmock_a2, \ | | GMOCK_ARG_(tn, F, 2) gmock_a2, \ | |
| GMOCK_ARG_(tn, F, 3) gmock_a3) constness {
\ | | GMOCK_ARG_(tn, F, 3) gmock_a3) constness {
\ | |
| GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \ | | GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \ | |
| tn ::testing::internal::Function<F>::ArgumentTuple>::value == 3, \ | | tn ::testing::internal::Function<F>::ArgumentTuple>::value == 3, \ | |
| this_method_does_not_take_3_arguments); \ | | this_method_does_not_take_3_arguments); \ | |
|
| GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \ | | GMOCK_MOCKER_(3, constness, Method).SetOwnerAndName(this, #Method); \ | |
| return GMOCK_MOCKER_(Method).Invoke(gmock_a1, gmock_a2, gmock_a3); \ | | return GMOCK_MOCKER_(3, constness, Method).Invoke(gmock_a1, gmock_a2, \ | |
| | | gmock_a3); \ | |
| } \ | | } \ | |
| ::testing::MockSpec<F>& \ | | ::testing::MockSpec<F>& \ | |
| gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ | | gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ | |
| GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ | | GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ | |
| GMOCK_MATCHER_(tn, F, 3) gmock_a3) constness { \ | | GMOCK_MATCHER_(tn, F, 3) gmock_a3) constness { \ | |
|
| return GMOCK_MOCKER_(Method).RegisterOwner(this).With(gmock_a1, gmock_a | | return GMOCK_MOCKER_(3, constness, \ | |
| 2, \ | | Method).RegisterOwner(this).With(gmock_a1, gmock_a2, gmock_a3); \ | |
| gmock_a3); \ | | | |
| } \ | | } \ | |
|
| mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method) | | mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(3, constness, Method) | |
| | | | |
| // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | | // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | |
| #define GMOCK_METHOD4_(tn, constness, ct, Method, F) \ | | #define GMOCK_METHOD4_(tn, constness, ct, Method, F) \ | |
| GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ | | GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ | |
| GMOCK_ARG_(tn, F, 2) gmock_a2, \ | | GMOCK_ARG_(tn, F, 2) gmock_a2, \ | |
| GMOCK_ARG_(tn, F, 3) gmock_a3, \ | | GMOCK_ARG_(tn, F, 3) gmock_a3, \ | |
| GMOCK_ARG_(tn, F, 4) gmock_a4) constness {
\ | | GMOCK_ARG_(tn, F, 4) gmock_a4) constness {
\ | |
| GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \ | | GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \ | |
| tn ::testing::internal::Function<F>::ArgumentTuple>::value == 4, \ | | tn ::testing::internal::Function<F>::ArgumentTuple>::value == 4, \ | |
| this_method_does_not_take_4_arguments); \ | | this_method_does_not_take_4_arguments); \ | |
|
| GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \ | | GMOCK_MOCKER_(4, constness, Method).SetOwnerAndName(this, #Method); \ | |
| return GMOCK_MOCKER_(Method).Invoke(gmock_a1, gmock_a2, gmock_a3, \ | | return GMOCK_MOCKER_(4, constness, Method).Invoke(gmock_a1, gmock_a2, \ | |
| gmock_a4); \ | | gmock_a3, gmock_a4); \ | |
| } \ | | } \ | |
| ::testing::MockSpec<F>& \ | | ::testing::MockSpec<F>& \ | |
| gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ | | gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ | |
| GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ | | GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ | |
| GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ | | GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ | |
| GMOCK_MATCHER_(tn, F, 4) gmock_a4) constness { \ | | GMOCK_MATCHER_(tn, F, 4) gmock_a4) constness { \ | |
|
| return GMOCK_MOCKER_(Method).RegisterOwner(this).With(gmock_a1, gmock_a | | return GMOCK_MOCKER_(4, constness, \ | |
| 2, \ | | Method).RegisterOwner(this).With(gmock_a1, gmock_a2, gmock_a3, \ | |
| gmock_a3, gmock_a4); \ | | gmock_a4); \ | |
| } \ | | } \ | |
|
| mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method) | | mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(4, constness, Method) | |
| | | | |
| // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | | // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | |
| #define GMOCK_METHOD5_(tn, constness, ct, Method, F) \ | | #define GMOCK_METHOD5_(tn, constness, ct, Method, F) \ | |
| GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ | | GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ | |
| GMOCK_ARG_(tn, F, 2) gmock_a2, \ | | GMOCK_ARG_(tn, F, 2) gmock_a2, \ | |
| GMOCK_ARG_(tn, F, 3) gmock_a3, \ | | GMOCK_ARG_(tn, F, 3) gmock_a3, \ | |
| GMOCK_ARG_(tn, F, 4) gmock_a4, \ | | GMOCK_ARG_(tn, F, 4) gmock_a4, \ | |
| GMOCK_ARG_(tn, F, 5) gmock_a5) constness {
\ | | GMOCK_ARG_(tn, F, 5) gmock_a5) constness {
\ | |
| GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \ | | GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \ | |
| tn ::testing::internal::Function<F>::ArgumentTuple>::value == 5, \ | | tn ::testing::internal::Function<F>::ArgumentTuple>::value == 5, \ | |
| this_method_does_not_take_5_arguments); \ | | this_method_does_not_take_5_arguments); \ | |
|
| GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \ | | GMOCK_MOCKER_(5, constness, Method).SetOwnerAndName(this, #Method); \ | |
| return GMOCK_MOCKER_(Method).Invoke(gmock_a1, gmock_a2, gmock_a3, \ | | return GMOCK_MOCKER_(5, constness, Method).Invoke(gmock_a1, gmock_a2, \ | |
| gmock_a4, gmock_a5); \ | | gmock_a3, gmock_a4, gmock_a5); \ | |
| } \ | | } \ | |
| ::testing::MockSpec<F>& \ | | ::testing::MockSpec<F>& \ | |
| gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ | | gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ | |
| GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ | | GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ | |
| GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ | | GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ | |
| GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ | | GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ | |
| GMOCK_MATCHER_(tn, F, 5) gmock_a5) constness { \ | | GMOCK_MATCHER_(tn, F, 5) gmock_a5) constness { \ | |
|
| return GMOCK_MOCKER_(Method).RegisterOwner(this).With(gmock_a1, gmock_a | | return GMOCK_MOCKER_(5, constness, \ | |
| 2, \ | | Method).RegisterOwner(this).With(gmock_a1, gmock_a2, gmock_a3, \ | |
| gmock_a3, gmock_a4, gmock_a5); \ | | gmock_a4, gmock_a5); \ | |
| } \ | | } \ | |
|
| mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method) | | mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(5, constness, Method) | |
| | | | |
| // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | | // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | |
| #define GMOCK_METHOD6_(tn, constness, ct, Method, F) \ | | #define GMOCK_METHOD6_(tn, constness, ct, Method, F) \ | |
| GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ | | GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ | |
| GMOCK_ARG_(tn, F, 2) gmock_a2, \ | | GMOCK_ARG_(tn, F, 2) gmock_a2, \ | |
| GMOCK_ARG_(tn, F, 3) gmock_a3, \ | | GMOCK_ARG_(tn, F, 3) gmock_a3, \ | |
| GMOCK_ARG_(tn, F, 4) gmock_a4, \ | | GMOCK_ARG_(tn, F, 4) gmock_a4, \ | |
| GMOCK_ARG_(tn, F, 5) gmock_a5, \ | | GMOCK_ARG_(tn, F, 5) gmock_a5, \ | |
| GMOCK_ARG_(tn, F, 6) gmock_a6) constness {
\ | | GMOCK_ARG_(tn, F, 6) gmock_a6) constness {
\ | |
| GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \ | | GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \ | |
| tn ::testing::internal::Function<F>::ArgumentTuple>::value == 6, \ | | tn ::testing::internal::Function<F>::ArgumentTuple>::value == 6, \ | |
| this_method_does_not_take_6_arguments); \ | | this_method_does_not_take_6_arguments); \ | |
|
| GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \ | | GMOCK_MOCKER_(6, constness, Method).SetOwnerAndName(this, #Method); \ | |
| return GMOCK_MOCKER_(Method).Invoke(gmock_a1, gmock_a2, gmock_a3, \ | | return GMOCK_MOCKER_(6, constness, Method).Invoke(gmock_a1, gmock_a2, \ | |
| gmock_a4, gmock_a5, gmock_a6); \ | | gmock_a3, gmock_a4, gmock_a5, gmock_a6); \ | |
| } \ | | } \ | |
| ::testing::MockSpec<F>& \ | | ::testing::MockSpec<F>& \ | |
| gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ | | gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ | |
| GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ | | GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ | |
| GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ | | GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ | |
| GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ | | GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ | |
| GMOCK_MATCHER_(tn, F, 5) gmock_a5, \ | | GMOCK_MATCHER_(tn, F, 5) gmock_a5, \ | |
| GMOCK_MATCHER_(tn, F, 6) gmock_a6) constness { \ | | GMOCK_MATCHER_(tn, F, 6) gmock_a6) constness { \ | |
|
| return GMOCK_MOCKER_(Method).RegisterOwner(this).With(gmock_a1, gmock_a | | return GMOCK_MOCKER_(6, constness, \ | |
| 2, \ | | Method).RegisterOwner(this).With(gmock_a1, gmock_a2, gmock_a3, \ | |
| gmock_a3, gmock_a4, gmock_a5, gmock_a6); \ | | gmock_a4, gmock_a5, gmock_a6); \ | |
| } \ | | } \ | |
|
| mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method) | | mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(6, constness, Method) | |
| | | | |
| // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | | // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | |
| #define GMOCK_METHOD7_(tn, constness, ct, Method, F) \ | | #define GMOCK_METHOD7_(tn, constness, ct, Method, F) \ | |
| GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ | | GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ | |
| GMOCK_ARG_(tn, F, 2) gmock_a2, \ | | GMOCK_ARG_(tn, F, 2) gmock_a2, \ | |
| GMOCK_ARG_(tn, F, 3) gmock_a3, \ | | GMOCK_ARG_(tn, F, 3) gmock_a3, \ | |
| GMOCK_ARG_(tn, F, 4) gmock_a4, \ | | GMOCK_ARG_(tn, F, 4) gmock_a4, \ | |
| GMOCK_ARG_(tn, F, 5) gmock_a5, \ | | GMOCK_ARG_(tn, F, 5) gmock_a5, \ | |
| GMOCK_ARG_(tn, F, 6) gmock_a6, \ | | GMOCK_ARG_(tn, F, 6) gmock_a6, \ | |
| GMOCK_ARG_(tn, F, 7) gmock_a7) constness {
\ | | GMOCK_ARG_(tn, F, 7) gmock_a7) constness {
\ | |
| GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \ | | GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \ | |
| tn ::testing::internal::Function<F>::ArgumentTuple>::value == 7, \ | | tn ::testing::internal::Function<F>::ArgumentTuple>::value == 7, \ | |
| this_method_does_not_take_7_arguments); \ | | this_method_does_not_take_7_arguments); \ | |
|
| GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \ | | GMOCK_MOCKER_(7, constness, Method).SetOwnerAndName(this, #Method); \ | |
| return GMOCK_MOCKER_(Method).Invoke(gmock_a1, gmock_a2, gmock_a3, \ | | return GMOCK_MOCKER_(7, constness, Method).Invoke(gmock_a1, gmock_a2, \ | |
| gmock_a4, gmock_a5, gmock_a6, gmock_a7); \ | | gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \ | |
| } \ | | } \ | |
| ::testing::MockSpec<F>& \ | | ::testing::MockSpec<F>& \ | |
| gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ | | gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ | |
| GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ | | GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ | |
| GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ | | GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ | |
| GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ | | GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ | |
| GMOCK_MATCHER_(tn, F, 5) gmock_a5, \ | | GMOCK_MATCHER_(tn, F, 5) gmock_a5, \ | |
| GMOCK_MATCHER_(tn, F, 6) gmock_a6, \ | | GMOCK_MATCHER_(tn, F, 6) gmock_a6, \ | |
| GMOCK_MATCHER_(tn, F, 7) gmock_a7) constness { \ | | GMOCK_MATCHER_(tn, F, 7) gmock_a7) constness { \ | |
|
| return GMOCK_MOCKER_(Method).RegisterOwner(this).With(gmock_a1, gmock_a | | return GMOCK_MOCKER_(7, constness, \ | |
| 2, \ | | Method).RegisterOwner(this).With(gmock_a1, gmock_a2, gmock_a3, \ | |
| gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7); \ | | gmock_a4, gmock_a5, gmock_a6, gmock_a7); \ | |
| } \ | | } \ | |
|
| mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method) | | mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(7, constness, Method) | |
| | | | |
| // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | | // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | |
| #define GMOCK_METHOD8_(tn, constness, ct, Method, F) \ | | #define GMOCK_METHOD8_(tn, constness, ct, Method, F) \ | |
| GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ | | GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ | |
| GMOCK_ARG_(tn, F, 2) gmock_a2, \ | | GMOCK_ARG_(tn, F, 2) gmock_a2, \ | |
| GMOCK_ARG_(tn, F, 3) gmock_a3, \ | | GMOCK_ARG_(tn, F, 3) gmock_a3, \ | |
| GMOCK_ARG_(tn, F, 4) gmock_a4, \ | | GMOCK_ARG_(tn, F, 4) gmock_a4, \ | |
| GMOCK_ARG_(tn, F, 5) gmock_a5, \ | | GMOCK_ARG_(tn, F, 5) gmock_a5, \ | |
| GMOCK_ARG_(tn, F, 6) gmock_a6, \ | | GMOCK_ARG_(tn, F, 6) gmock_a6, \ | |
| GMOCK_ARG_(tn, F, 7) gmock_a7, \ | | GMOCK_ARG_(tn, F, 7) gmock_a7, \ | |
| GMOCK_ARG_(tn, F, 8) gmock_a8) constness {
\ | | GMOCK_ARG_(tn, F, 8) gmock_a8) constness {
\ | |
| GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \ | | GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \ | |
| tn ::testing::internal::Function<F>::ArgumentTuple>::value == 8, \ | | tn ::testing::internal::Function<F>::ArgumentTuple>::value == 8, \ | |
| this_method_does_not_take_8_arguments); \ | | this_method_does_not_take_8_arguments); \ | |
|
| GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \ | | GMOCK_MOCKER_(8, constness, Method).SetOwnerAndName(this, #Method); \ | |
| return GMOCK_MOCKER_(Method).Invoke(gmock_a1, gmock_a2, gmock_a3, \ | | return GMOCK_MOCKER_(8, constness, Method).Invoke(gmock_a1, gmock_a2, \ | |
| gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \ | | gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \ | |
| } \ | | } \ | |
| ::testing::MockSpec<F>& \ | | ::testing::MockSpec<F>& \ | |
| gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ | | gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ | |
| GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ | | GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ | |
| GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ | | GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ | |
| GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ | | GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ | |
| GMOCK_MATCHER_(tn, F, 5) gmock_a5, \ | | GMOCK_MATCHER_(tn, F, 5) gmock_a5, \ | |
| GMOCK_MATCHER_(tn, F, 6) gmock_a6, \ | | GMOCK_MATCHER_(tn, F, 6) gmock_a6, \ | |
| GMOCK_MATCHER_(tn, F, 7) gmock_a7, \ | | GMOCK_MATCHER_(tn, F, 7) gmock_a7, \ | |
| GMOCK_MATCHER_(tn, F, 8) gmock_a8) constness { \ | | GMOCK_MATCHER_(tn, F, 8) gmock_a8) constness { \ | |
|
| return GMOCK_MOCKER_(Method).RegisterOwner(this).With(gmock_a1, gmock_a | | return GMOCK_MOCKER_(8, constness, \ | |
| 2, \ | | Method).RegisterOwner(this).With(gmock_a1, gmock_a2, gmock_a3, \ | |
| gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \ | | gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8); \ | |
| } \ | | } \ | |
|
| mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method) | | mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(8, constness, Method) | |
| | | | |
| // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | | // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | |
| #define GMOCK_METHOD9_(tn, constness, ct, Method, F) \ | | #define GMOCK_METHOD9_(tn, constness, ct, Method, F) \ | |
| GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ | | GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ | |
| GMOCK_ARG_(tn, F, 2) gmock_a2, \ | | GMOCK_ARG_(tn, F, 2) gmock_a2, \ | |
| GMOCK_ARG_(tn, F, 3) gmock_a3, \ | | GMOCK_ARG_(tn, F, 3) gmock_a3, \ | |
| GMOCK_ARG_(tn, F, 4) gmock_a4, \ | | GMOCK_ARG_(tn, F, 4) gmock_a4, \ | |
| GMOCK_ARG_(tn, F, 5) gmock_a5, \ | | GMOCK_ARG_(tn, F, 5) gmock_a5, \ | |
| GMOCK_ARG_(tn, F, 6) gmock_a6, \ | | GMOCK_ARG_(tn, F, 6) gmock_a6, \ | |
| GMOCK_ARG_(tn, F, 7) gmock_a7, \ | | GMOCK_ARG_(tn, F, 7) gmock_a7, \ | |
| GMOCK_ARG_(tn, F, 8) gmock_a8, \ | | GMOCK_ARG_(tn, F, 8) gmock_a8, \ | |
| GMOCK_ARG_(tn, F, 9) gmock_a9) constness {
\ | | GMOCK_ARG_(tn, F, 9) gmock_a9) constness {
\ | |
| GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \ | | GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \ | |
| tn ::testing::internal::Function<F>::ArgumentTuple>::value == 9, \ | | tn ::testing::internal::Function<F>::ArgumentTuple>::value == 9, \ | |
| this_method_does_not_take_9_arguments); \ | | this_method_does_not_take_9_arguments); \ | |
|
| GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \ | | GMOCK_MOCKER_(9, constness, Method).SetOwnerAndName(this, #Method); \ | |
| return GMOCK_MOCKER_(Method).Invoke(gmock_a1, gmock_a2, gmock_a3, \ | | return GMOCK_MOCKER_(9, constness, Method).Invoke(gmock_a1, gmock_a2, \ | |
| gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9); \ | | gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \ | |
| | | gmock_a9); \ | |
| } \ | | } \ | |
| ::testing::MockSpec<F>& \ | | ::testing::MockSpec<F>& \ | |
| gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ | | gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ | |
| GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ | | GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ | |
| GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ | | GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ | |
| GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ | | GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ | |
| GMOCK_MATCHER_(tn, F, 5) gmock_a5, \ | | GMOCK_MATCHER_(tn, F, 5) gmock_a5, \ | |
| GMOCK_MATCHER_(tn, F, 6) gmock_a6, \ | | GMOCK_MATCHER_(tn, F, 6) gmock_a6, \ | |
| GMOCK_MATCHER_(tn, F, 7) gmock_a7, \ | | GMOCK_MATCHER_(tn, F, 7) gmock_a7, \ | |
| GMOCK_MATCHER_(tn, F, 8) gmock_a8, \ | | GMOCK_MATCHER_(tn, F, 8) gmock_a8, \ | |
| GMOCK_MATCHER_(tn, F, 9) gmock_a9) constness { \ | | GMOCK_MATCHER_(tn, F, 9) gmock_a9) constness { \ | |
|
| return GMOCK_MOCKER_(Method).RegisterOwner(this).With(gmock_a1, gmock_a | | return GMOCK_MOCKER_(9, constness, \ | |
| 2, \ | | Method).RegisterOwner(this).With(gmock_a1, gmock_a2, gmock_a3, \ | |
| gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, \ | | gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9); \ | |
| gmock_a9); \ | | | |
| } \ | | } \ | |
|
| mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method) | | mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(9, constness, Method) | |
| | | | |
| // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | | // INTERNAL IMPLEMENTATION - DON'T USE IN USER CODE!!! | |
| #define GMOCK_METHOD10_(tn, constness, ct, Method, F) \ | | #define GMOCK_METHOD10_(tn, constness, ct, Method, F) \ | |
| GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ | | GMOCK_RESULT_(tn, F) ct Method(GMOCK_ARG_(tn, F, 1) gmock_a1, \ | |
| GMOCK_ARG_(tn, F, 2) gmock_a2, \ | | GMOCK_ARG_(tn, F, 2) gmock_a2, \ | |
| GMOCK_ARG_(tn, F, 3) gmock_a3, \ | | GMOCK_ARG_(tn, F, 3) gmock_a3, \ | |
| GMOCK_ARG_(tn, F, 4) gmock_a4, \ | | GMOCK_ARG_(tn, F, 4) gmock_a4, \ | |
| GMOCK_ARG_(tn, F, 5) gmock_a5, \ | | GMOCK_ARG_(tn, F, 5) gmock_a5, \ | |
| GMOCK_ARG_(tn, F, 6) gmock_a6, \ | | GMOCK_ARG_(tn, F, 6) gmock_a6, \ | |
| GMOCK_ARG_(tn, F, 7) gmock_a7, \ | | GMOCK_ARG_(tn, F, 7) gmock_a7, \ | |
| GMOCK_ARG_(tn, F, 8) gmock_a8, \ | | GMOCK_ARG_(tn, F, 8) gmock_a8, \ | |
| GMOCK_ARG_(tn, F, 9) gmock_a9, \ | | GMOCK_ARG_(tn, F, 9) gmock_a9, \ | |
| GMOCK_ARG_(tn, F, 10) gmock_a10) constness
{ \ | | GMOCK_ARG_(tn, F, 10) gmock_a10) constness
{ \ | |
| GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \ | | GMOCK_COMPILE_ASSERT_(::std::tr1::tuple_size< \ | |
| tn ::testing::internal::Function<F>::ArgumentTuple>::value == 10, \ | | tn ::testing::internal::Function<F>::ArgumentTuple>::value == 10, \ | |
| this_method_does_not_take_10_arguments); \ | | this_method_does_not_take_10_arguments); \ | |
|
| GMOCK_MOCKER_(Method).SetOwnerAndName(this, #Method); \ | | GMOCK_MOCKER_(10, constness, Method).SetOwnerAndName(this, #Method); \ | |
| return GMOCK_MOCKER_(Method).Invoke(gmock_a1, gmock_a2, gmock_a3, \ | | return GMOCK_MOCKER_(10, constness, Method).Invoke(gmock_a1, gmock_a2, | |
| gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \ | | \ | |
| | | gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a | |
| | | 9, \ | |
| gmock_a10); \ | | gmock_a10); \ | |
| } \ | | } \ | |
| ::testing::MockSpec<F>& \ | | ::testing::MockSpec<F>& \ | |
| gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ | | gmock_##Method(GMOCK_MATCHER_(tn, F, 1) gmock_a1, \ | |
| GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ | | GMOCK_MATCHER_(tn, F, 2) gmock_a2, \ | |
| GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ | | GMOCK_MATCHER_(tn, F, 3) gmock_a3, \ | |
| GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ | | GMOCK_MATCHER_(tn, F, 4) gmock_a4, \ | |
| GMOCK_MATCHER_(tn, F, 5) gmock_a5, \ | | GMOCK_MATCHER_(tn, F, 5) gmock_a5, \ | |
| GMOCK_MATCHER_(tn, F, 6) gmock_a6, \ | | GMOCK_MATCHER_(tn, F, 6) gmock_a6, \ | |
| GMOCK_MATCHER_(tn, F, 7) gmock_a7, \ | | GMOCK_MATCHER_(tn, F, 7) gmock_a7, \ | |
| GMOCK_MATCHER_(tn, F, 8) gmock_a8, \ | | GMOCK_MATCHER_(tn, F, 8) gmock_a8, \ | |
| GMOCK_MATCHER_(tn, F, 9) gmock_a9, \ | | GMOCK_MATCHER_(tn, F, 9) gmock_a9, \ | |
| GMOCK_MATCHER_(tn, F, 10) gmock_a10) constness { \ | | GMOCK_MATCHER_(tn, F, 10) gmock_a10) constness { \ | |
|
| return GMOCK_MOCKER_(Method).RegisterOwner(this).With(gmock_a1, gmock_a | | return GMOCK_MOCKER_(10, constness, \ | |
| 2, \ | | Method).RegisterOwner(this).With(gmock_a1, gmock_a2, gmock_a3, \ | |
| gmock_a3, gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a | | gmock_a4, gmock_a5, gmock_a6, gmock_a7, gmock_a8, gmock_a9, \ | |
| 9, \ | | | |
| gmock_a10); \ | | gmock_a10); \ | |
| } \ | | } \ | |
|
| mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(Method) | | mutable ::testing::FunctionMocker<F> GMOCK_MOCKER_(10, constness, Method) | |
| | | | |
| #define MOCK_METHOD0(m, F) GMOCK_METHOD0_(, , , m, F) | | #define MOCK_METHOD0(m, F) GMOCK_METHOD0_(, , , m, F) | |
| #define MOCK_METHOD1(m, F) GMOCK_METHOD1_(, , , m, F) | | #define MOCK_METHOD1(m, F) GMOCK_METHOD1_(, , , m, F) | |
| #define MOCK_METHOD2(m, F) GMOCK_METHOD2_(, , , m, F) | | #define MOCK_METHOD2(m, F) GMOCK_METHOD2_(, , , m, F) | |
| #define MOCK_METHOD3(m, F) GMOCK_METHOD3_(, , , m, F) | | #define MOCK_METHOD3(m, F) GMOCK_METHOD3_(, , , m, F) | |
| #define MOCK_METHOD4(m, F) GMOCK_METHOD4_(, , , m, F) | | #define MOCK_METHOD4(m, F) GMOCK_METHOD4_(, , , m, F) | |
| #define MOCK_METHOD5(m, F) GMOCK_METHOD5_(, , , m, F) | | #define MOCK_METHOD5(m, F) GMOCK_METHOD5_(, , , m, F) | |
| #define MOCK_METHOD6(m, F) GMOCK_METHOD6_(, , , m, F) | | #define MOCK_METHOD6(m, F) GMOCK_METHOD6_(, , , m, F) | |
| #define MOCK_METHOD7(m, F) GMOCK_METHOD7_(, , , m, F) | | #define MOCK_METHOD7(m, F) GMOCK_METHOD7_(, , , m, F) | |
| #define MOCK_METHOD8(m, F) GMOCK_METHOD8_(, , , m, F) | | #define MOCK_METHOD8(m, F) GMOCK_METHOD8_(, , , m, F) | |
| | | | |
| skipping to change at line 704 | | skipping to change at line 715 | |
| GMOCK_METHOD6_(typename, const, ct, m, F) | | GMOCK_METHOD6_(typename, const, ct, m, F) | |
| #define MOCK_CONST_METHOD7_T_WITH_CALLTYPE(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) \ | | #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) \ | | #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) \ | | #define MOCK_CONST_METHOD10_T_WITH_CALLTYPE(ct, m, F) \ | |
| GMOCK_METHOD10_(typename, const, ct, m, F) | | GMOCK_METHOD10_(typename, const, ct, m, F) | |
| | | | |
|
| | | // A MockFunction<F> class has one mock method whose type is F. It is | |
| | | // useful when you just want your test code to emit some messages and | |
| | | // have Google Mock verify the right messages are sent (and perhaps at | |
| | | // the right times). For example, if you are exercising code: | |
| | | // | |
| | | // Foo(1); | |
| | | // Foo(2); | |
| | | // Foo(3); | |
| | | // | |
| | | // and want to verify that Foo(1) and Foo(3) both invoke | |
| | | // mock.Bar("a"), but Foo(2) doesn't invoke anything, you can write: | |
| | | // | |
| | | // TEST(FooTest, InvokesBarCorrectly) { | |
| | | // MyMock mock; | |
| | | // MockFunction<void(string check_point_name)> check; | |
| | | // { | |
| | | // InSequence s; | |
| | | // | |
| | | // EXPECT_CALL(mock, Bar("a")); | |
| | | // EXPECT_CALL(check, Call("1")); | |
| | | // EXPECT_CALL(check, Call("2")); | |
| | | // EXPECT_CALL(mock, Bar("a")); | |
| | | // } | |
| | | // Foo(1); | |
| | | // check.Call("1"); | |
| | | // Foo(2); | |
| | | // check.Call("2"); | |
| | | // Foo(3); | |
| | | // } | |
| | | // | |
| | | // The expectation spec says that the first Bar("a") must happen | |
| | | // before check point "1", the second Bar("a") must happen after check | |
| | | // point "2", and nothing should happen between the two check | |
| | | // points. The explicit check points make it easy to tell which | |
| | | // Bar("a") is called by which call to Foo(). | |
| | | template <typename F> | |
| | | class MockFunction; | |
| | | | |
| | | template <typename R> | |
| | | class MockFunction<R()> { | |
| | | public: | |
| | | MOCK_METHOD0_T(Call, R()); | |
| | | }; | |
| | | | |
| | | template <typename R, typename A0> | |
| | | class MockFunction<R(A0)> { | |
| | | public: | |
| | | MOCK_METHOD1_T(Call, R(A0)); | |
| | | }; | |
| | | | |
| | | template <typename R, typename A0, typename A1> | |
| | | class MockFunction<R(A0, A1)> { | |
| | | public: | |
| | | MOCK_METHOD2_T(Call, R(A0, A1)); | |
| | | }; | |
| | | | |
| | | template <typename R, typename A0, typename A1, typename A2> | |
| | | class MockFunction<R(A0, A1, A2)> { | |
| | | public: | |
| | | MOCK_METHOD3_T(Call, R(A0, A1, A2)); | |
| | | }; | |
| | | | |
| | | template <typename R, typename A0, typename A1, typename A2, typename A3> | |
| | | class MockFunction<R(A0, A1, A2, A3)> { | |
| | | public: | |
| | | MOCK_METHOD4_T(Call, R(A0, A1, A2, A3)); | |
| | | }; | |
| | | | |
| | | template <typename R, typename A0, typename A1, typename A2, typename A3, | |
| | | typename A4> | |
| | | class MockFunction<R(A0, A1, A2, A3, A4)> { | |
| | | public: | |
| | | MOCK_METHOD5_T(Call, R(A0, A1, A2, A3, A4)); | |
| | | }; | |
| | | | |
| | | template <typename R, typename A0, typename A1, typename A2, typename A3, | |
| | | typename A4, typename A5> | |
| | | class MockFunction<R(A0, A1, A2, A3, A4, A5)> { | |
| | | public: | |
| | | MOCK_METHOD6_T(Call, R(A0, A1, A2, A3, A4, A5)); | |
| | | }; | |
| | | | |
| | | template <typename R, typename A0, typename A1, typename A2, typename A3, | |
| | | typename A4, typename A5, typename A6> | |
| | | class MockFunction<R(A0, A1, A2, A3, A4, A5, A6)> { | |
| | | public: | |
| | | MOCK_METHOD7_T(Call, R(A0, A1, A2, A3, A4, A5, A6)); | |
| | | }; | |
| | | | |
| | | template <typename R, typename A0, typename A1, typename A2, typename A3, | |
| | | typename A4, typename A5, typename A6, typename A7> | |
| | | class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7)> { | |
| | | public: | |
| | | MOCK_METHOD8_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7)); | |
| | | }; | |
| | | | |
| | | template <typename R, typename A0, typename A1, typename A2, typename A3, | |
| | | typename A4, typename A5, typename A6, typename A7, typename A8> | |
| | | class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8)> { | |
| | | public: | |
| | | MOCK_METHOD9_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8)); | |
| | | }; | |
| | | | |
| | | template <typename R, typename A0, typename A1, typename A2, typename A3, | |
| | | typename A4, typename A5, typename A6, typename A7, typename A8, | |
| | | typename A9> | |
| | | class MockFunction<R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)> { | |
| | | public: | |
| | | MOCK_METHOD10_T(Call, R(A0, A1, A2, A3, A4, A5, A6, A7, A8, A9)); | |
| | | }; | |
| | | | |
| } // namespace testing | | } // namespace testing | |
| | | | |
| #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ | | #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_FUNCTION_MOCKERS_H_ | |
| | | | |
End of changes. 35 change blocks. |
| 72 lines changed or deleted | | 186 lines changed or added | |
|
| gmock-generated-matchers.h | | gmock-generated-matchers.h | |
| | | | |
| skipping to change at line 48 | | skipping to change at line 48 | |
| | | | |
| #include <sstream> | | #include <sstream> | |
| #include <string> | | #include <string> | |
| #include <vector> | | #include <vector> | |
| #include <gmock/gmock-matchers.h> | | #include <gmock/gmock-matchers.h> | |
| #include <gmock/gmock-printers.h> | | #include <gmock/gmock-printers.h> | |
| | | | |
| namespace testing { | | namespace testing { | |
| namespace internal { | | namespace internal { | |
| | | | |
|
| // Implements ElementsAre() and ElementsAreArray(). | | // The type of the i-th (0-based) field of Tuple. | |
| template <typename Container> | | #define GMOCK_FIELD_TYPE_(Tuple, i) \ | |
| class ElementsAreMatcherImpl : public MatcherInterface<Container> { | | typename ::std::tr1::tuple_element<i, Tuple>::type | |
| | | | |
| | | // TupleFields<Tuple, k0, ..., kn> is for selecting fields from a | |
| | | // tuple of type Tuple. It has two members: | |
| | | // | |
| | | // type: a tuple type whose i-th field is the ki-th field of Tuple. | |
| | | // GetSelectedFields(t): returns fields k0, ..., and kn of t as a tuple. | |
| | | // | |
| | | // For example, in class TupleFields<tuple<bool, char, int>, 2, 0>, we have | |
| | | : | |
| | | // | |
| | | // type is tuple<int, bool>, and | |
| | | // GetSelectedFields(make_tuple(true, 'a', 42)) is (42, true). | |
| | | | |
| | | template <class Tuple, int k0 = -1, int k1 = -1, int k2 = -1, int k3 = -1, | |
| | | int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1, | |
| | | int k9 = -1> | |
| | | class TupleFields; | |
| | | | |
| | | // This generic version is used when there are 10 selectors. | |
| | | template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int | |
| | | k6, | |
| | | int k7, int k8, int k9> | |
| | | class TupleFields { | |
| public: | | public: | |
|
| typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) RawContai | | typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), | |
| ner; | | GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), | |
| typedef typename RawContainer::value_type Element; | | GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4), | |
| | | GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6), | |
| | | GMOCK_FIELD_TYPE_(Tuple, k7), GMOCK_FIELD_TYPE_(Tuple, k8), | |
| | | GMOCK_FIELD_TYPE_(Tuple, k9)> type; | |
| | | static type GetSelectedFields(const Tuple& t) { | |
| | | using ::std::tr1::get; | |
| | | return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t), | |
| | | get<k5>(t), get<k6>(t), get<k7>(t), get<k8>(t), get<k9>(t)); | |
| | | } | |
| | | }; | |
| | | | |
|
| // Constructs the matcher from a sequence of element values or | | // The following specialization is used for 0 ~ 9 selectors. | |
| // element matchers. | | | |
| template <typename InputIter> | | template <class Tuple> | |
| ElementsAreMatcherImpl(InputIter first, size_t count) { | | class TupleFields<Tuple, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1> { | |
| matchers_.reserve(count); | | public: | |
| InputIter it = first; | | typedef ::std::tr1::tuple<> type; | |
| for (size_t i = 0; i != count; ++i, ++it) { | | static type GetSelectedFields(const Tuple& t) { | |
| matchers_.push_back(MatcherCast<const Element&>(*it)); | | using ::std::tr1::get; | |
| } | | return type(); | |
| } | | } | |
|
| | | }; | |
| | | | |
|
| // Returns true iff 'container' matches. | | template <class Tuple, int k0> | |
| virtual bool Matches(Container container) const { | | class TupleFields<Tuple, k0, -1, -1, -1, -1, -1, -1, -1, -1, -1> { | |
| if (container.size() != count()) | | public: | |
| return false; | | typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0)> type; | |
| | | static type GetSelectedFields(const Tuple& t) { | |
| | | using ::std::tr1::get; | |
| | | return type(get<k0>(t)); | |
| | | } | |
| | | }; | |
| | | | |
|
| typename RawContainer::const_iterator container_iter = container.begin( | | template <class Tuple, int k0, int k1> | |
| ); | | class TupleFields<Tuple, k0, k1, -1, -1, -1, -1, -1, -1, -1, -1> { | |
| for (size_t i = 0; i != count(); ++container_iter, ++i) { | | public: | |
| if (!matchers_[i].Matches(*container_iter)) | | typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), | |
| return false; | | GMOCK_FIELD_TYPE_(Tuple, k1)> type; | |
| } | | static type GetSelectedFields(const Tuple& t) { | |
| | | using ::std::tr1::get; | |
| | | return type(get<k0>(t), get<k1>(t)); | |
| | | } | |
| | | }; | |
| | | | |
|
| return true; | | template <class Tuple, int k0, int k1, int k2> | |
| | | class TupleFields<Tuple, k0, k1, k2, -1, -1, -1, -1, -1, -1, -1> { | |
| | | public: | |
| | | typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), | |
| | | GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2)> type; | |
| | | static type GetSelectedFields(const Tuple& t) { | |
| | | using ::std::tr1::get; | |
| | | return type(get<k0>(t), get<k1>(t), get<k2>(t)); | |
| } | | } | |
|
| | | }; | |
| | | | |
|
| // Describes what this matcher does. | | template <class Tuple, int k0, int k1, int k2, int k3> | |
| virtual void DescribeTo(::std::ostream* os) const { | | class TupleFields<Tuple, k0, k1, k2, k3, -1, -1, -1, -1, -1, -1> { | |
| if (count() == 0) { | | public: | |
| *os << "is empty"; | | typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), | |
| } else if (count() == 1) { | | GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), | |
| *os << "has 1 element that "; | | GMOCK_FIELD_TYPE_(Tuple, k3)> type; | |
| matchers_[0].DescribeTo(os); | | static type GetSelectedFields(const Tuple& t) { | |
| } else { | | using ::std::tr1::get; | |
| *os << "has " << Elements(count()) << " where\n"; | | return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t)); | |
| for (size_t i = 0; i != count(); ++i) { | | | |
| *os << "element " << i << " "; | | | |
| matchers_[i].DescribeTo(os); | | | |
| if (i + 1 < count()) { | | | |
| *os << ",\n"; | | | |
| } | | | |
| } | | | |
| } | | | |
| } | | } | |
|
| | | }; | |
| | | | |
|
| // Describes what the negation of this matcher does. | | template <class Tuple, int k0, int k1, int k2, int k3, int k4> | |
| virtual void DescribeNegationTo(::std::ostream* os) const { | | class TupleFields<Tuple, k0, k1, k2, k3, k4, -1, -1, -1, -1, -1> { | |
| if (count() == 0) { | | public: | |
| *os << "is not empty"; | | typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), | |
| return; | | GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), | |
| } | | GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4)> type; | |
| | | static type GetSelectedFields(const Tuple& t) { | |
| | | using ::std::tr1::get; | |
| | | return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t)) | |
| | | ; | |
| | | } | |
| | | }; | |
| | | | |
|
| *os << "does not have " << Elements(count()) << ", or\n"; | | template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5> | |
| for (size_t i = 0; i != count(); ++i) { | | class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, -1, -1, -1, -1> { | |
| *os << "element " << i << " "; | | public: | |
| matchers_[i].DescribeNegationTo(os); | | typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), | |
| if (i + 1 < count()) { | | GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), | |
| *os << ", or\n"; | | GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4), | |
| } | | GMOCK_FIELD_TYPE_(Tuple, k5)> type; | |
| } | | static type GetSelectedFields(const Tuple& t) { | |
| | | using ::std::tr1::get; | |
| | | return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t), | |
| | | get<k5>(t)); | |
| } | | } | |
|
| | | }; | |
| | | | |
|
| // Explains why 'container' matches, or doesn't match, this matcher. | | template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int | |
| virtual void ExplainMatchResultTo(Container container, | | k6> | |
| ::std::ostream* os) const { | | class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, -1, -1, -1> { | |
| if (Matches(container)) { | | public: | |
| // We need to explain why *each* element matches (the obvious | | typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), | |
| // ones can be skipped). | | GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), | |
| | | GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4), | |
| | | GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6)> type; | |
| | | static type GetSelectedFields(const Tuple& t) { | |
| | | using ::std::tr1::get; | |
| | | return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t), | |
| | | get<k5>(t), get<k6>(t)); | |
| | | } | |
| | | }; | |
| | | | |
|
| bool reason_printed = false; | | template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int | |
| typename RawContainer::const_iterator container_iter = container.begi | | k6, | |
| n(); | | int k7> | |
| for (size_t i = 0; i != count(); ++container_iter, ++i) { | | class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, k7, -1, -1> { | |
| ::std::stringstream ss; | | public: | |
| matchers_[i].ExplainMatchResultTo(*container_iter, &ss); | | typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), | |
| | | GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), | |
| | | GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4), | |
| | | GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6), | |
| | | GMOCK_FIELD_TYPE_(Tuple, k7)> type; | |
| | | static type GetSelectedFields(const Tuple& t) { | |
| | | using ::std::tr1::get; | |
| | | return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t), | |
| | | get<k5>(t), get<k6>(t), get<k7>(t)); | |
| | | } | |
| | | }; | |
| | | | |
|
| const string s = ss.str(); | | template <class Tuple, int k0, int k1, int k2, int k3, int k4, int k5, int | |
| if (!s.empty()) { | | k6, | |
| if (reason_printed) { | | int k7, int k8> | |
| *os << ",\n"; | | class TupleFields<Tuple, k0, k1, k2, k3, k4, k5, k6, k7, k8, -1> { | |
| } | | public: | |
| *os << "element " << i << " " << s; | | typedef ::std::tr1::tuple<GMOCK_FIELD_TYPE_(Tuple, k0), | |
| reason_printed = true; | | GMOCK_FIELD_TYPE_(Tuple, k1), GMOCK_FIELD_TYPE_(Tuple, k2), | |
| } | | GMOCK_FIELD_TYPE_(Tuple, k3), GMOCK_FIELD_TYPE_(Tuple, k4), | |
| } | | GMOCK_FIELD_TYPE_(Tuple, k5), GMOCK_FIELD_TYPE_(Tuple, k6), | |
| } else { | | GMOCK_FIELD_TYPE_(Tuple, k7), GMOCK_FIELD_TYPE_(Tuple, k8)> type; | |
| // We need to explain why the container doesn't match. | | static type GetSelectedFields(const Tuple& t) { | |
| const size_t actual_count = container.size(); | | using ::std::tr1::get; | |
| if (actual_count != count()) { | | return type(get<k0>(t), get<k1>(t), get<k2>(t), get<k3>(t), get<k4>(t), | |
| // The element count doesn't match. If the container is | | get<k5>(t), get<k6>(t), get<k7>(t), get<k8>(t)); | |
| // empty, there's no need to explain anything as Google Mock | | } | |
| // already prints the empty container. Otherwise we just need | | }; | |
| // to show how many elements there actually are. | | | |
| if (actual_count != 0) { | | | |
| *os << "has " << Elements(actual_count); | | | |
| } | | | |
| return; | | | |
| } | | | |
| | | | |
|
| // The container has the right size but at least one element | | #undef GMOCK_FIELD_TYPE_ | |
| // doesn't match expectation. We need to find this element and | | | |
| // explain why it doesn't match. | | | |
| typename RawContainer::const_iterator container_iter = container.begi | | | |
| n(); | | | |
| for (size_t i = 0; i != count(); ++container_iter, ++i) { | | | |
| if (matchers_[i].Matches(*container_iter)) { | | | |
| continue; | | | |
| } | | | |
| | | | |
|
| *os << "element " << i << " doesn't match"; | | // Implements the Args() matcher. | |
| | | template <class ArgsTuple, int k0 = -1, int k1 = -1, int k2 = -1, int k3 = | |
| | | -1, | |
| | | int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, int k8 = -1, | |
| | | int k9 = -1> | |
| | | class ArgsMatcherImpl : public MatcherInterface<ArgsTuple> { | |
| | | public: | |
| | | // ArgsTuple may have top-level const or reference modifiers. | |
| | | typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(ArgsTuple)) RawArgsTu | |
| | | ple; | |
| | | typedef typename internal::TupleFields<RawArgsTuple, k0, k1, k2, k3, k4, | |
| | | k5, | |
| | | k6, k7, k8, k9>::type SelectedArgs; | |
| | | typedef Matcher<const SelectedArgs&> MonomorphicInnerMatcher; | |
| | | | |
|
| ::std::stringstream ss; | | template <typename InnerMatcher> | |
| matchers_[i].ExplainMatchResultTo(*container_iter, &ss); | | explicit ArgsMatcherImpl(const InnerMatcher& inner_matcher) | |
| const string s = ss.str(); | | : inner_matcher_(SafeMatcherCast<const SelectedArgs&>(inner_matcher)) | |
| if (!s.empty()) { | | {} | |
| *os << " (" << s << ")"; | | | |
| } | | virtual bool Matches(ArgsTuple args) const { | |
| return; | | return inner_matcher_.Matches(GetSelectedArgs(args)); | |
| } | | } | |
| } | | | |
| | | virtual void DescribeTo(::std::ostream* os) const { | |
| | | PrintIndices(os); | |
| | | inner_matcher_.DescribeTo(os); | |
| | | } | |
| | | | |
| | | virtual void DescribeNegationTo(::std::ostream* os) const { | |
| | | PrintIndices(os); | |
| | | inner_matcher_.DescribeNegationTo(os); | |
| | | } | |
| | | | |
| | | virtual void ExplainMatchResultTo(ArgsTuple args, | |
| | | ::std::ostream* os) const { | |
| | | inner_matcher_.ExplainMatchResultTo(GetSelectedArgs(args), os); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| static Message Elements(size_t count) { | | static SelectedArgs GetSelectedArgs(ArgsTuple args) { | |
| return Message() << count << (count == 1 ? " element" : " elements"); | | return TupleFields<RawArgsTuple, k0, k1, k2, k3, k4, k5, k6, k7, k8, | |
| | | k9>::GetSelectedFields(args); | |
| } | | } | |
| | | | |
|
| size_t count() const { return matchers_.size(); } | | // Prints the indices of the selected fields. | |
| std::vector<Matcher<const Element&> > matchers_; | | static void PrintIndices(::std::ostream* os) { | |
| }; | | *os << "are a tuple whose fields ("; | |
| | | const int indices[10] = { k0, k1, k2, k3, k4, k5, k6, k7, k8, k9 }; | |
| | | for (int i = 0; i < 10; i++) { | |
| | | if (indices[i] < 0) | |
| | | break; | |
| | | | |
|
| // Implements ElementsAre() of 0-10 arguments. | | if (i >= 1) | |
| | | *os << ", "; | |
| | | | |
|
| class ElementsAreMatcher0 { | | *os << "#" << indices[i]; | |
| public: | | } | |
| ElementsAreMatcher0() {} | | *os << ") "; | |
| | | } | |
| | | | |
|
| template <typename Container> | | const MonomorphicInnerMatcher inner_matcher_; | |
| operator Matcher<Container>() const { | | }; | |
| typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | | | |
| RawContainer; | | | |
| typedef typename RawContainer::value_type Element; | | | |
| | | | |
|
| const Matcher<const Element&>* const matchers = NULL; | | template <class InnerMatcher, int k0 = -1, int k1 = -1, int k2 = -1, | |
| return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 0)); | | int k3 = -1, int k4 = -1, int k5 = -1, int k6 = -1, int k7 = -1, | |
| | | int k8 = -1, int k9 = -1> | |
| | | class ArgsMatcher { | |
| | | public: | |
| | | explicit ArgsMatcher(const InnerMatcher& inner_matcher) | |
| | | : inner_matcher_(inner_matcher) {} | |
| | | | |
| | | template <typename ArgsTuple> | |
| | | operator Matcher<ArgsTuple>() const { | |
| | | return MakeMatcher(new ArgsMatcherImpl<ArgsTuple, k0, k1, k2, k3, k4, k | |
| | | 5, | |
| | | k6, k7, k8, k9>(inner_matcher_)); | |
| } | | } | |
|
| | | | |
| | | const InnerMatcher inner_matcher_; | |
| }; | | }; | |
| | | | |
|
| | | // Implements ElementsAre() of 1-10 arguments. | |
| | | | |
| template <typename T1> | | template <typename T1> | |
| class ElementsAreMatcher1 { | | class ElementsAreMatcher1 { | |
| public: | | public: | |
| explicit ElementsAreMatcher1(const T1& e1) : e1_(e1) {} | | explicit ElementsAreMatcher1(const T1& e1) : e1_(e1) {} | |
| | | | |
| template <typename Container> | | template <typename Container> | |
| operator Matcher<Container>() const { | | operator Matcher<Container>() const { | |
| typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | | typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | |
| RawContainer; | | RawContainer; | |
|
| typedef typename RawContainer::value_type Element; | | typedef typename internal::StlContainerView<RawContainer>::type::value_ | |
| | | type | |
| const Matcher<const Element&> matchers[] = { | | Element; | |
| MatcherCast<const Element&>(e1_), | | | |
| }; | | | |
| | | | |
|
| return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 1)); | | // Nokia's Symbian Compiler has a nasty bug where the object put | |
| | | // in a one-element local array is not destructed when the array | |
| | | // goes out of scope. This leads to obvious badness as we've | |
| | | // added the linked_ptr in it to our other linked_ptrs list. | |
| | | // Hence we implement ElementsAreMatcher1 specially to avoid using | |
| | | // a local array. | |
| | | const Matcher<const Element&> matcher = | |
| | | MatcherCast<const Element&>(e1_); | |
| | | return MakeMatcher(new ElementsAreMatcherImpl<Container>(&matcher, 1)); | |
| } | | } | |
| | | | |
| private: | | private: | |
| const T1& e1_; | | const T1& e1_; | |
| }; | | }; | |
| | | | |
| template <typename T1, typename T2> | | template <typename T1, typename T2> | |
| class ElementsAreMatcher2 { | | class ElementsAreMatcher2 { | |
| public: | | public: | |
| ElementsAreMatcher2(const T1& e1, const T2& e2) : e1_(e1), e2_(e2) {} | | ElementsAreMatcher2(const T1& e1, const T2& e2) : e1_(e1), e2_(e2) {} | |
| | | | |
| template <typename Container> | | template <typename Container> | |
| operator Matcher<Container>() const { | | operator Matcher<Container>() const { | |
| typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | | typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | |
| RawContainer; | | RawContainer; | |
|
| typedef typename RawContainer::value_type Element; | | typedef typename internal::StlContainerView<RawContainer>::type::value_ | |
| | | type | |
| | | Element; | |
| | | | |
| const Matcher<const Element&> matchers[] = { | | const Matcher<const Element&> matchers[] = { | |
| MatcherCast<const Element&>(e1_), | | MatcherCast<const Element&>(e1_), | |
| MatcherCast<const Element&>(e2_), | | MatcherCast<const Element&>(e2_), | |
| }; | | }; | |
| | | | |
| return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 2)); | | return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 2)); | |
| } | | } | |
| | | | |
| private: | | private: | |
| | | | |
| skipping to change at line 256 | | skipping to change at line 357 | |
| template <typename T1, typename T2, typename T3> | | template <typename T1, typename T2, typename T3> | |
| class ElementsAreMatcher3 { | | class ElementsAreMatcher3 { | |
| public: | | public: | |
| ElementsAreMatcher3(const T1& e1, const T2& e2, const T3& e3) : e1_(e1), | | ElementsAreMatcher3(const T1& e1, const T2& e2, const T3& e3) : e1_(e1), | |
| e2_(e2), e3_(e3) {} | | e2_(e2), e3_(e3) {} | |
| | | | |
| template <typename Container> | | template <typename Container> | |
| operator Matcher<Container>() const { | | operator Matcher<Container>() const { | |
| typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | | typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | |
| RawContainer; | | RawContainer; | |
|
| typedef typename RawContainer::value_type Element; | | typedef typename internal::StlContainerView<RawContainer>::type::value_ | |
| | | type | |
| | | Element; | |
| | | | |
| const Matcher<const Element&> matchers[] = { | | const Matcher<const Element&> matchers[] = { | |
| MatcherCast<const Element&>(e1_), | | MatcherCast<const Element&>(e1_), | |
| MatcherCast<const Element&>(e2_), | | MatcherCast<const Element&>(e2_), | |
| MatcherCast<const Element&>(e3_), | | MatcherCast<const Element&>(e3_), | |
| }; | | }; | |
| | | | |
| return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 3)); | | return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 3)); | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 283 | | skipping to change at line 385 | |
| template <typename T1, typename T2, typename T3, typename T4> | | template <typename T1, typename T2, typename T3, typename T4> | |
| class ElementsAreMatcher4 { | | class ElementsAreMatcher4 { | |
| public: | | public: | |
| ElementsAreMatcher4(const T1& e1, const T2& e2, const T3& e3, | | ElementsAreMatcher4(const T1& e1, const T2& e2, const T3& e3, | |
| const T4& e4) : e1_(e1), e2_(e2), e3_(e3), e4_(e4) {} | | const T4& e4) : e1_(e1), e2_(e2), e3_(e3), e4_(e4) {} | |
| | | | |
| template <typename Container> | | template <typename Container> | |
| operator Matcher<Container>() const { | | operator Matcher<Container>() const { | |
| typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | | typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | |
| RawContainer; | | RawContainer; | |
|
| typedef typename RawContainer::value_type Element; | | typedef typename internal::StlContainerView<RawContainer>::type::value_ | |
| | | type | |
| | | Element; | |
| | | | |
| const Matcher<const Element&> matchers[] = { | | const Matcher<const Element&> matchers[] = { | |
| MatcherCast<const Element&>(e1_), | | MatcherCast<const Element&>(e1_), | |
| MatcherCast<const Element&>(e2_), | | MatcherCast<const Element&>(e2_), | |
| MatcherCast<const Element&>(e3_), | | MatcherCast<const Element&>(e3_), | |
| MatcherCast<const Element&>(e4_), | | MatcherCast<const Element&>(e4_), | |
| }; | | }; | |
| | | | |
| return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 4)); | | return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 4)); | |
| } | | } | |
| | | | |
| skipping to change at line 312 | | skipping to change at line 415 | |
| template <typename T1, typename T2, typename T3, typename T4, typename T5> | | template <typename T1, typename T2, typename T3, typename T4, typename T5> | |
| class ElementsAreMatcher5 { | | class ElementsAreMatcher5 { | |
| public: | | public: | |
| ElementsAreMatcher5(const T1& e1, const T2& e2, const T3& e3, const T4& e
4, | | ElementsAreMatcher5(const T1& e1, const T2& e2, const T3& e3, const T4& e
4, | |
| const T5& e5) : e1_(e1), e2_(e2), e3_(e3), e4_(e4), e5_(e5) {} | | const T5& e5) : e1_(e1), e2_(e2), e3_(e3), e4_(e4), e5_(e5) {} | |
| | | | |
| template <typename Container> | | template <typename Container> | |
| operator Matcher<Container>() const { | | operator Matcher<Container>() const { | |
| typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | | typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | |
| RawContainer; | | RawContainer; | |
|
| typedef typename RawContainer::value_type Element; | | typedef typename internal::StlContainerView<RawContainer>::type::value_ | |
| | | type | |
| | | Element; | |
| | | | |
| const Matcher<const Element&> matchers[] = { | | const Matcher<const Element&> matchers[] = { | |
| MatcherCast<const Element&>(e1_), | | MatcherCast<const Element&>(e1_), | |
| MatcherCast<const Element&>(e2_), | | MatcherCast<const Element&>(e2_), | |
| MatcherCast<const Element&>(e3_), | | MatcherCast<const Element&>(e3_), | |
| MatcherCast<const Element&>(e4_), | | MatcherCast<const Element&>(e4_), | |
| MatcherCast<const Element&>(e5_), | | MatcherCast<const Element&>(e5_), | |
| }; | | }; | |
| | | | |
| return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 5)); | | return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 5)); | |
| | | | |
| skipping to change at line 345 | | skipping to change at line 449 | |
| class ElementsAreMatcher6 { | | class ElementsAreMatcher6 { | |
| public: | | public: | |
| ElementsAreMatcher6(const T1& e1, const T2& e2, const T3& e3, const T4& e
4, | | ElementsAreMatcher6(const T1& e1, const T2& e2, const T3& e3, const T4& e
4, | |
| const T5& e5, const T6& e6) : e1_(e1), e2_(e2), e3_(e3), e4_(e4), | | const T5& e5, const T6& e6) : e1_(e1), e2_(e2), e3_(e3), e4_(e4), | |
| e5_(e5), e6_(e6) {} | | e5_(e5), e6_(e6) {} | |
| | | | |
| template <typename Container> | | template <typename Container> | |
| operator Matcher<Container>() const { | | operator Matcher<Container>() const { | |
| typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | | typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | |
| RawContainer; | | RawContainer; | |
|
| typedef typename RawContainer::value_type Element; | | typedef typename internal::StlContainerView<RawContainer>::type::value_ | |
| | | type | |
| | | Element; | |
| | | | |
| const Matcher<const Element&> matchers[] = { | | const Matcher<const Element&> matchers[] = { | |
| MatcherCast<const Element&>(e1_), | | MatcherCast<const Element&>(e1_), | |
| MatcherCast<const Element&>(e2_), | | MatcherCast<const Element&>(e2_), | |
| MatcherCast<const Element&>(e3_), | | MatcherCast<const Element&>(e3_), | |
| MatcherCast<const Element&>(e4_), | | MatcherCast<const Element&>(e4_), | |
| MatcherCast<const Element&>(e5_), | | MatcherCast<const Element&>(e5_), | |
| MatcherCast<const Element&>(e6_), | | MatcherCast<const Element&>(e6_), | |
| }; | | }; | |
| | | | |
| | | | |
| skipping to change at line 380 | | skipping to change at line 485 | |
| class ElementsAreMatcher7 { | | class ElementsAreMatcher7 { | |
| public: | | public: | |
| ElementsAreMatcher7(const T1& e1, const T2& e2, const T3& e3, const T4& e
4, | | ElementsAreMatcher7(const T1& e1, const T2& e2, const T3& e3, const T4& e
4, | |
| const T5& e5, const T6& e6, const T7& e7) : e1_(e1), e2_(e2), e3_(e3)
, | | const T5& e5, const T6& e6, const T7& e7) : e1_(e1), e2_(e2), e3_(e3)
, | |
| e4_(e4), e5_(e5), e6_(e6), e7_(e7) {} | | e4_(e4), e5_(e5), e6_(e6), e7_(e7) {} | |
| | | | |
| template <typename Container> | | template <typename Container> | |
| operator Matcher<Container>() const { | | operator Matcher<Container>() const { | |
| typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | | typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | |
| RawContainer; | | RawContainer; | |
|
| typedef typename RawContainer::value_type Element; | | typedef typename internal::StlContainerView<RawContainer>::type::value_ | |
| | | type | |
| | | Element; | |
| | | | |
| const Matcher<const Element&> matchers[] = { | | const Matcher<const Element&> matchers[] = { | |
| MatcherCast<const Element&>(e1_), | | MatcherCast<const Element&>(e1_), | |
| MatcherCast<const Element&>(e2_), | | MatcherCast<const Element&>(e2_), | |
| MatcherCast<const Element&>(e3_), | | MatcherCast<const Element&>(e3_), | |
| MatcherCast<const Element&>(e4_), | | MatcherCast<const Element&>(e4_), | |
| MatcherCast<const Element&>(e5_), | | MatcherCast<const Element&>(e5_), | |
| MatcherCast<const Element&>(e6_), | | MatcherCast<const Element&>(e6_), | |
| MatcherCast<const Element&>(e7_), | | MatcherCast<const Element&>(e7_), | |
| }; | | }; | |
| | | | |
| skipping to change at line 417 | | skipping to change at line 523 | |
| class ElementsAreMatcher8 { | | class ElementsAreMatcher8 { | |
| public: | | public: | |
| ElementsAreMatcher8(const T1& e1, const T2& e2, const T3& e3, const T4& e
4, | | ElementsAreMatcher8(const T1& e1, const T2& e2, const T3& e3, const T4& e
4, | |
| const T5& e5, const T6& e6, const T7& e7, const T8& e8) : e1_(e1), | | const T5& e5, const T6& e6, const T7& e7, const T8& e8) : e1_(e1), | |
| e2_(e2), e3_(e3), e4_(e4), e5_(e5), e6_(e6), e7_(e7), e8_(e8) {} | | e2_(e2), e3_(e3), e4_(e4), e5_(e5), e6_(e6), e7_(e7), e8_(e8) {} | |
| | | | |
| template <typename Container> | | template <typename Container> | |
| operator Matcher<Container>() const { | | operator Matcher<Container>() const { | |
| typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | | typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | |
| RawContainer; | | RawContainer; | |
|
| typedef typename RawContainer::value_type Element; | | typedef typename internal::StlContainerView<RawContainer>::type::value_ | |
| | | type | |
| | | Element; | |
| | | | |
| const Matcher<const Element&> matchers[] = { | | const Matcher<const Element&> matchers[] = { | |
| MatcherCast<const Element&>(e1_), | | MatcherCast<const Element&>(e1_), | |
| MatcherCast<const Element&>(e2_), | | MatcherCast<const Element&>(e2_), | |
| MatcherCast<const Element&>(e3_), | | MatcherCast<const Element&>(e3_), | |
| MatcherCast<const Element&>(e4_), | | MatcherCast<const Element&>(e4_), | |
| MatcherCast<const Element&>(e5_), | | MatcherCast<const Element&>(e5_), | |
| MatcherCast<const Element&>(e6_), | | MatcherCast<const Element&>(e6_), | |
| MatcherCast<const Element&>(e7_), | | MatcherCast<const Element&>(e7_), | |
| MatcherCast<const Element&>(e8_), | | MatcherCast<const Element&>(e8_), | |
| | | | |
| skipping to change at line 457 | | skipping to change at line 564 | |
| public: | | public: | |
| ElementsAreMatcher9(const T1& e1, const T2& e2, const T3& e3, const T4& e
4, | | ElementsAreMatcher9(const T1& e1, const T2& e2, const T3& e3, const T4& e
4, | |
| const T5& e5, const T6& e6, const T7& e7, const T8& e8, | | const T5& e5, const T6& e6, const T7& e7, const T8& e8, | |
| const T9& e9) : e1_(e1), e2_(e2), e3_(e3), e4_(e4), e5_(e5), e6_(e6), | | const T9& e9) : e1_(e1), e2_(e2), e3_(e3), e4_(e4), e5_(e5), e6_(e6), | |
| e7_(e7), e8_(e8), e9_(e9) {} | | e7_(e7), e8_(e8), e9_(e9) {} | |
| | | | |
| template <typename Container> | | template <typename Container> | |
| operator Matcher<Container>() const { | | operator Matcher<Container>() const { | |
| typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | | typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | |
| RawContainer; | | RawContainer; | |
|
| typedef typename RawContainer::value_type Element; | | typedef typename internal::StlContainerView<RawContainer>::type::value_ | |
| | | type | |
| | | Element; | |
| | | | |
| const Matcher<const Element&> matchers[] = { | | const Matcher<const Element&> matchers[] = { | |
| MatcherCast<const Element&>(e1_), | | MatcherCast<const Element&>(e1_), | |
| MatcherCast<const Element&>(e2_), | | MatcherCast<const Element&>(e2_), | |
| MatcherCast<const Element&>(e3_), | | MatcherCast<const Element&>(e3_), | |
| MatcherCast<const Element&>(e4_), | | MatcherCast<const Element&>(e4_), | |
| MatcherCast<const Element&>(e5_), | | MatcherCast<const Element&>(e5_), | |
| MatcherCast<const Element&>(e6_), | | MatcherCast<const Element&>(e6_), | |
| MatcherCast<const Element&>(e7_), | | MatcherCast<const Element&>(e7_), | |
| MatcherCast<const Element&>(e8_), | | MatcherCast<const Element&>(e8_), | |
| | | | |
| skipping to change at line 499 | | skipping to change at line 607 | |
| public: | | public: | |
| ElementsAreMatcher10(const T1& e1, const T2& e2, const T3& e3, const T4&
e4, | | ElementsAreMatcher10(const T1& e1, const T2& e2, const T3& e3, const T4&
e4, | |
| const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9, | | const T5& e5, const T6& e6, const T7& e7, const T8& e8, const T9& e9, | |
| const T10& e10) : e1_(e1), e2_(e2), e3_(e3), e4_(e4), e5_(e5), e6_(e6
), | | const T10& e10) : e1_(e1), e2_(e2), e3_(e3), e4_(e4), e5_(e5), e6_(e6
), | |
| e7_(e7), e8_(e8), e9_(e9), e10_(e10) {} | | e7_(e7), e8_(e8), e9_(e9), e10_(e10) {} | |
| | | | |
| template <typename Container> | | template <typename Container> | |
| operator Matcher<Container>() const { | | operator Matcher<Container>() const { | |
| typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | | typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | |
| RawContainer; | | RawContainer; | |
|
| typedef typename RawContainer::value_type Element; | | typedef typename internal::StlContainerView<RawContainer>::type::value_ | |
| | | type | |
| | | Element; | |
| | | | |
| const Matcher<const Element&> matchers[] = { | | const Matcher<const Element&> matchers[] = { | |
| MatcherCast<const Element&>(e1_), | | MatcherCast<const Element&>(e1_), | |
| MatcherCast<const Element&>(e2_), | | MatcherCast<const Element&>(e2_), | |
| MatcherCast<const Element&>(e3_), | | MatcherCast<const Element&>(e3_), | |
| MatcherCast<const Element&>(e4_), | | MatcherCast<const Element&>(e4_), | |
| MatcherCast<const Element&>(e5_), | | MatcherCast<const Element&>(e5_), | |
| MatcherCast<const Element&>(e6_), | | MatcherCast<const Element&>(e6_), | |
| MatcherCast<const Element&>(e7_), | | MatcherCast<const Element&>(e7_), | |
| MatcherCast<const Element&>(e8_), | | MatcherCast<const Element&>(e8_), | |
| | | | |
| skipping to change at line 530 | | skipping to change at line 639 | |
| const T3& e3_; | | const T3& e3_; | |
| const T4& e4_; | | const T4& e4_; | |
| const T5& e5_; | | const T5& e5_; | |
| const T6& e6_; | | const T6& e6_; | |
| const T7& e7_; | | const T7& e7_; | |
| const T8& e8_; | | const T8& e8_; | |
| const T9& e9_; | | const T9& e9_; | |
| const T10& e10_; | | const T10& e10_; | |
| }; | | }; | |
| | | | |
|
| // Implements ElementsAreArray(). | | } // namespace internal | |
| template <typename T> | | | |
| class ElementsAreArrayMatcher { | | | |
| public: | | | |
| ElementsAreArrayMatcher(const T* first, size_t count) : | | | |
| first_(first), count_(count) {} | | | |
| | | | |
|
| template <typename Container> | | // Args<N1, N2, ..., Nk>(a_matcher) matches a tuple if the selected | |
| operator Matcher<Container>() const { | | // fields of it matches a_matcher. C++ doesn't support default | |
| typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | | // arguments for function templates, so we have to overload it. | |
| RawContainer; | | template <typename InnerMatcher> | |
| typedef typename RawContainer::value_type Element; | | inline internal::ArgsMatcher<InnerMatcher> | |
| | | Args(const InnerMatcher& matcher) { | |
| | | return internal::ArgsMatcher<InnerMatcher>(matcher); | |
| | | } | |
| | | | |
|
| return MakeMatcher(new ElementsAreMatcherImpl<Container>(first_, count_ | | template <int k1, typename InnerMatcher> | |
| )); | | inline internal::ArgsMatcher<InnerMatcher, k1> | |
| } | | Args(const InnerMatcher& matcher) { | |
| | | return internal::ArgsMatcher<InnerMatcher, k1>(matcher); | |
| | | } | |
| | | | |
|
| private: | | template <int k1, int k2, typename InnerMatcher> | |
| const T* const first_; | | inline internal::ArgsMatcher<InnerMatcher, k1, k2> | |
| const size_t count_; | | Args(const InnerMatcher& matcher) { | |
| }; | | return internal::ArgsMatcher<InnerMatcher, k1, k2>(matcher); | |
| | | } | |
| | | | |
|
| } // namespace internal | | template <int k1, int k2, int k3, typename InnerMatcher> | |
| | | inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3> | |
| | | Args(const InnerMatcher& matcher) { | |
| | | return internal::ArgsMatcher<InnerMatcher, k1, k2, k3>(matcher); | |
| | | } | |
| | | | |
| | | template <int k1, int k2, int k3, int k4, typename InnerMatcher> | |
| | | inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4> | |
| | | Args(const InnerMatcher& matcher) { | |
| | | return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4>(matcher); | |
| | | } | |
| | | | |
| | | template <int k1, int k2, int k3, int k4, int k5, typename InnerMatcher> | |
| | | inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5> | |
| | | Args(const InnerMatcher& matcher) { | |
| | | return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5>(matcher); | |
| | | } | |
| | | | |
| | | template <int k1, int k2, int k3, int k4, int k5, int k6, typename InnerMat | |
| | | cher> | |
| | | inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6> | |
| | | Args(const InnerMatcher& matcher) { | |
| | | return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6>(matche | |
| | | r); | |
| | | } | |
| | | | |
| | | template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, | |
| | | typename InnerMatcher> | |
| | | inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7> | |
| | | Args(const InnerMatcher& matcher) { | |
| | | return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, | |
| | | k7>(matcher); | |
| | | } | |
| | | | |
| | | template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8, | |
| | | typename InnerMatcher> | |
| | | inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8> | |
| | | Args(const InnerMatcher& matcher) { | |
| | | return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, | |
| | | k8>(matcher); | |
| | | } | |
| | | | |
| | | template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8, | |
| | | int k9, typename InnerMatcher> | |
| | | inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8, | |
| | | k9> | |
| | | Args(const InnerMatcher& matcher) { | |
| | | return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8 | |
| | | , | |
| | | k9>(matcher); | |
| | | } | |
| | | | |
| | | template <int k1, int k2, int k3, int k4, int k5, int k6, int k7, int k8, | |
| | | int k9, int k10, typename InnerMatcher> | |
| | | inline internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8, | |
| | | k9, | |
| | | k10> | |
| | | Args(const InnerMatcher& matcher) { | |
| | | return internal::ArgsMatcher<InnerMatcher, k1, k2, k3, k4, k5, k6, k7, k8 | |
| | | , | |
| | | k9, k10>(matcher); | |
| | | } | |
| | | | |
| // ElementsAre(e0, e1, ..., e_n) matches an STL-style container with | | // ElementsAre(e0, e1, ..., e_n) matches an STL-style container with | |
| // (n + 1) elements, where the i-th element in the container must | | // (n + 1) elements, where the i-th element in the container must | |
| // match the i-th argument in the list. Each argument of | | // match the i-th argument in the list. Each argument of | |
| // ElementsAre() can be either a value or a matcher. We support up to | | // ElementsAre() can be either a value or a matcher. We support up to | |
| // 10 arguments. | | // 10 arguments. | |
| // | | // | |
| // NOTE: Since ElementsAre() cares about the order of the elements, it | | // NOTE: Since ElementsAre() cares about the order of the elements, it | |
| // must not be used with containers whose elements's order is | | // must not be used with containers whose elements's order is | |
| // undefined (e.g. hash_map). | | // undefined (e.g. hash_map). | |
| | | | |
| skipping to change at line 832 | | skipping to change at line 998 | |
| // that C++ doesn't yet allow function-local types to be used to | | // that C++ doesn't yet allow function-local types to be used to | |
| // instantiate templates. The up-coming C++0x standard will fix this. | | // instantiate templates. The up-coming C++0x standard will fix this. | |
| // Once that's done, we'll consider supporting using MATCHER*() inside | | // Once that's done, we'll consider supporting using MATCHER*() inside | |
| // a function. | | // a function. | |
| // | | // | |
| // MORE INFORMATION: | | // MORE INFORMATION: | |
| // | | // | |
| // To learn more about using these macros, please search for 'MATCHER' | | // To learn more about using these macros, please search for 'MATCHER' | |
| // on http://code.google.com/p/googlemock/wiki/CookBook. | | // on http://code.google.com/p/googlemock/wiki/CookBook. | |
| | | | |
|
| namespace testing { | | | |
| namespace internal { | | | |
| | | | |
| // Constants denoting interpolations in a matcher description string. | | | |
| const int kTupleInterpolation = -1; // "%(*)s" | | | |
| const int kPercentInterpolation = -2; // "%%" | | | |
| const int kInvalidInterpolation = -3; // "%" followed by invalid text | | | |
| | | | |
| // Records the location and content of an interpolation. | | | |
| struct Interpolation { | | | |
| Interpolation(const char* start, const char* end, int param) | | | |
| : start_pos(start), end_pos(end), param_index(param) {} | | | |
| | | | |
| // Points to the start of the interpolation (the '%' character). | | | |
| const char* start_pos; | | | |
| // Points to the first character after the interpolation. | | | |
| const char* end_pos; | | | |
| // 0-based index of the interpolated matcher parameter; | | | |
| // kTupleInterpolation for "%(*)s"; kPercentInterpolation for "%%". | | | |
| int param_index; | | | |
| }; | | | |
| | | | |
| typedef ::std::vector<Interpolation> Interpolations; | | | |
| | | | |
| // Parses a matcher description string and returns a vector of | | | |
| // interpolations that appear in the string; generates non-fatal | | | |
| // failures iff 'description' is an invalid matcher description. | | | |
| // 'param_names' is a NULL-terminated array of parameter names in the | | | |
| // order they appear in the MATCHER_P*() parameter list. | | | |
| Interpolations ValidateMatcherDescription( | | | |
| const char* param_names[], const char* description); | | | |
| | | | |
| // Returns the actual matcher description, given the matcher name, | | | |
| // user-supplied description template string, interpolations in the | | | |
| // string, and the printed values of the matcher parameters. | | | |
| string FormatMatcherDescription( | | | |
| const char* matcher_name, const char* description, | | | |
| const Interpolations& interp, const Strings& param_values); | | | |
| | | | |
| } // namespace internal | | | |
| } // namespace testing | | | |
| | | | |
| #define MATCHER(name, description)\ | | #define MATCHER(name, description)\ | |
| class name##Matcher {\ | | class name##Matcher {\ | |
| public:\ | | public:\ | |
| template <typename arg_type>\ | | template <typename arg_type>\ | |
| class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ | | class gmock_Impl : public ::testing::MatcherInterface<arg_type> {\ | |
| public:\ | | public:\ | |
| gmock_Impl(const ::testing::internal::Interpolations& gmock_interp)\ | | gmock_Impl(const ::testing::internal::Interpolations& gmock_interp)\ | |
| : gmock_interp_(gmock_interp) {}\ | | : gmock_interp_(gmock_interp) {}\ | |
| virtual bool Matches(arg_type arg) const;\ | | virtual bool Matches(arg_type arg) const;\ | |
| virtual void DescribeTo(::std::ostream* gmock_os) const {\ | | virtual void DescribeTo(::std::ostream* gmock_os) const {\ | |
| | | | |
| skipping to change at line 1576 | | skipping to change at line 1700 | |
| }\ | | }\ | |
| template <typename p0##_type, typename p1##_type, typename p2##_type, \ | | template <typename p0##_type, typename p1##_type, typename p2##_type, \ | |
| typename p3##_type, typename p4##_type, typename p5##_type, \ | | typename p3##_type, typename p4##_type, typename p5##_type, \ | |
| typename p6##_type, typename p7##_type, typename p8##_type, \ | | typename p6##_type, typename p7##_type, typename p8##_type, \ | |
| typename p9##_type>\ | | typename p9##_type>\ | |
| template <typename arg_type>\ | | template <typename arg_type>\ | |
| bool name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \ | | bool name##MatcherP10<p0##_type, p1##_type, p2##_type, p3##_type, \ | |
| p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>::\ | | p4##_type, p5##_type, p6##_type, p7##_type, p8##_type, p9##_type>::\ | |
| gmock_Impl<arg_type>::Matches(arg_type arg) const | | gmock_Impl<arg_type>::Matches(arg_type arg) const | |
| | | | |
|
| namespace testing { | | | |
| namespace internal { | | | |
| | | | |
| // Returns true iff element is in the STL-style container. | | | |
| template <typename Container, typename Element> | | | |
| inline bool Contains(const Container& container, const Element& element) { | | | |
| return ::std::find(container.begin(), container.end(), element) != | | | |
| container.end(); | | | |
| } | | | |
| | | | |
| // Returns true iff element is in the C-style array. | | | |
| template <typename ArrayElement, size_t N, typename Element> | | | |
| inline bool Contains(const ArrayElement (&array)[N], const Element& element | | | |
| ) { | | | |
| return ::std::find(array, array + N, element) != array + N; | | | |
| } | | | |
| | | | |
| } // namespace internal | | | |
| | | | |
| // Matches an STL-style container or a C-style array that contains the give | | | |
| n | | | |
| // element. | | | |
| // | | | |
| // Examples: | | | |
| // ::std::set<int> page_ids; | | | |
| // page_ids.insert(3); | | | |
| // page_ids.insert(1); | | | |
| // EXPECT_THAT(page_ids, Contains(1)); | | | |
| // EXPECT_THAT(page_ids, Contains(3.0)); | | | |
| // EXPECT_THAT(page_ids, Not(Contains(4))); | | | |
| // | | | |
| // ::std::map<int, size_t> page_lengths; | | | |
| // page_lengths[1] = 100; | | | |
| // EXPECT_THAT(map_int, Contains(::std::pair<const int, size_t>(1, 100))) | | | |
| ; | | | |
| // | | | |
| // const char* user_ids[] = { "joe", "mike", "tom" }; | | | |
| // EXPECT_THAT(user_ids, Contains(::std::string("tom"))); | | | |
| MATCHER_P(Contains, element, "") { | | | |
| return internal::Contains(arg, element); | | | |
| } | | | |
| | | | |
| } // namespace testing | | | |
| | | | |
| #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ | | #endif // GMOCK_INCLUDE_GMOCK_GMOCK_GENERATED_MATCHERS_H_ | |
| | | | |
End of changes. 45 change blocks. |
| 246 lines changed or deleted | | 348 lines changed or added | |
|
| gmock-matchers.h | | gmock-matchers.h | |
| | | | |
| skipping to change at line 42 | | skipping to change at line 42 | |
| // Google Mock - a framework for writing C++ mock classes. | | // Google Mock - a framework for writing C++ mock classes. | |
| // | | // | |
| // This file implements some commonly used argument matchers. More | | // This file implements some commonly used argument matchers. More | |
| // matchers can be defined by the user implementing the | | // matchers can be defined by the user implementing the | |
| // MatcherInterface<T> interface if necessary. | | // MatcherInterface<T> interface if necessary. | |
| | | | |
| #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ | | #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ | |
| #define GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ | | #define GMOCK_INCLUDE_GMOCK_GMOCK_MATCHERS_H_ | |
| | | | |
| #include <algorithm> | | #include <algorithm> | |
|
| | | #include <limits> | |
| #include <ostream> // NOLINT | | #include <ostream> // NOLINT | |
| #include <sstream> | | #include <sstream> | |
| #include <string> | | #include <string> | |
| #include <vector> | | #include <vector> | |
| | | | |
| #include <gmock/gmock-printers.h> | | #include <gmock/gmock-printers.h> | |
| #include <gmock/internal/gmock-internal-utils.h> | | #include <gmock/internal/gmock-internal-utils.h> | |
| #include <gmock/internal/gmock-port.h> | | #include <gmock/internal/gmock-port.h> | |
| #include <gtest/gtest.h> | | #include <gtest/gtest.h> | |
| | | | |
| | | | |
| skipping to change at line 93 | | skipping to change at line 94 | |
| // can produce good error messages. | | // can produce good error messages. | |
| virtual void DescribeNegationTo(::std::ostream* os) const { | | virtual void DescribeNegationTo(::std::ostream* os) const { | |
| *os << "not ("; | | *os << "not ("; | |
| DescribeTo(os); | | DescribeTo(os); | |
| *os << ")"; | | *os << ")"; | |
| } | | } | |
| | | | |
| // Explains why x matches, or doesn't match, the matcher. Override | | // Explains why x matches, or doesn't match, the matcher. Override | |
| // this to provide any additional information that helps a user | | // this to provide any additional information that helps a user | |
| // understand the match result. | | // understand the match result. | |
|
| virtual void ExplainMatchResultTo(T x, ::std::ostream* os) const { | | virtual void ExplainMatchResultTo(T /* x */, ::std::ostream* /* os */) co
nst { | |
| // By default, nothing more needs to be explained, as Google Mock | | // By default, nothing more needs to be explained, as Google Mock | |
| // has already printed the value of x when this function is | | // has already printed the value of x when this function is | |
| // called. | | // called. | |
| } | | } | |
| }; | | }; | |
| | | | |
| namespace internal { | | namespace internal { | |
| | | | |
| // An internal class for implementing Matcher<T>, which will derive | | // An internal class for implementing Matcher<T>, which will derive | |
| // from it. We put functionalities common to all Matcher<T> | | // from it. We put functionalities common to all Matcher<T> | |
| | | | |
| skipping to change at line 149 | | skipping to change at line 150 | |
| // than the default constructor. | | // than the default constructor. | |
| // | | // | |
| // If performance becomes a problem, we should see if using | | // If performance becomes a problem, we should see if using | |
| // shared_ptr helps. | | // shared_ptr helps. | |
| ::testing::internal::linked_ptr<const MatcherInterface<T> > impl_; | | ::testing::internal::linked_ptr<const MatcherInterface<T> > impl_; | |
| }; | | }; | |
| | | | |
| // The default implementation of ExplainMatchResultTo() for | | // The default implementation of ExplainMatchResultTo() for | |
| // polymorphic matchers. | | // polymorphic matchers. | |
| template <typename PolymorphicMatcherImpl, typename T> | | template <typename PolymorphicMatcherImpl, typename T> | |
|
| inline void ExplainMatchResultTo(const PolymorphicMatcherImpl& impl, const | | inline void ExplainMatchResultTo(const PolymorphicMatcherImpl& /* impl */, | |
| T& x, | | const T& /* x */, | |
| ::std::ostream* os) { | | ::std::ostream* /* os */) { | |
| // By default, nothing more needs to be said, as Google Mock already | | // By default, nothing more needs to be said, as Google Mock already | |
| // prints the value of x elsewhere. | | // prints the value of x elsewhere. | |
| } | | } | |
| | | | |
| } // namespace internal | | } // namespace internal | |
| | | | |
| // A Matcher<T> is a copyable and IMMUTABLE (except by assignment) | | // A Matcher<T> is a copyable and IMMUTABLE (except by assignment) | |
| // object that can check whether a value of type T matches. The | | // object that can check whether a value of type T matches. The | |
| // implementation of Matcher<T> is just a linked_ptr to const | | // implementation of Matcher<T> is just a linked_ptr to const | |
| // MatcherInterface<T>, so copying is fairly cheap. Don't inherit | | // MatcherInterface<T>, so copying is fairly cheap. Don't inherit | |
| | | | |
| skipping to change at line 173 | | skipping to change at line 175 | |
| class Matcher : public internal::MatcherBase<T> { | | class Matcher : public internal::MatcherBase<T> { | |
| public: | | public: | |
| // Constructs a null matcher. Needed for storing Matcher objects in | | // Constructs a null matcher. Needed for storing Matcher objects in | |
| // STL containers. | | // STL containers. | |
| Matcher() {} | | Matcher() {} | |
| | | | |
| // Constructs a matcher from its implementation. | | // Constructs a matcher from its implementation. | |
| explicit Matcher(const MatcherInterface<T>* impl) | | explicit Matcher(const MatcherInterface<T>* impl) | |
| : internal::MatcherBase<T>(impl) {} | | : internal::MatcherBase<T>(impl) {} | |
| | | | |
|
| // Implicit constructor here allows ipeople to write | | // Implicit constructor here allows people to write | |
| // EXPECT_CALL(foo, Bar(5)) instead of EXPECT_CALL(foo, Bar(Eq(5))) somet
imes | | // EXPECT_CALL(foo, Bar(5)) instead of EXPECT_CALL(foo, Bar(Eq(5))) somet
imes | |
| Matcher(T value); // NOLINT | | Matcher(T value); // NOLINT | |
| }; | | }; | |
| | | | |
| // The following two specializations allow the user to write str | | // The following two specializations allow the user to write str | |
| // instead of Eq(str) and "foo" instead of Eq("foo") when a string | | // instead of Eq(str) and "foo" instead of Eq("foo") when a string | |
| // matcher is expected. | | // matcher is expected. | |
| template <> | | template <> | |
| class Matcher<const internal::string&> | | class Matcher<const internal::string&> | |
| : public internal::MatcherBase<const internal::string&> { | | : public internal::MatcherBase<const internal::string&> { | |
| | | | |
| skipping to change at line 237 | | skipping to change at line 239 | |
| // void ExplainMatchResultTo(const Impl& matcher, const Value& value, | | // void ExplainMatchResultTo(const Impl& matcher, const Value& value, | |
| // ::std::ostream* os); | | // ::std::ostream* os); | |
| // | | // | |
| // in the SAME NAME SPACE where Impl is defined. See the definition | | // in the SAME NAME SPACE where Impl is defined. See the definition | |
| // of NotNull() for a complete example. | | // of NotNull() for a complete example. | |
| template <class Impl> | | template <class Impl> | |
| class PolymorphicMatcher { | | class PolymorphicMatcher { | |
| public: | | public: | |
| explicit PolymorphicMatcher(const Impl& impl) : impl_(impl) {} | | explicit PolymorphicMatcher(const Impl& impl) : impl_(impl) {} | |
| | | | |
|
| | | // Returns a mutable reference to the underlying matcher | |
| | | // implementation object. | |
| | | Impl& mutable_impl() { return impl_; } | |
| | | | |
| | | // Returns an immutable reference to the underlying matcher | |
| | | // implementation object. | |
| | | const Impl& impl() const { return impl_; } | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator Matcher<T>() const { | | operator Matcher<T>() const { | |
| return Matcher<T>(new MonomorphicImpl<T>(impl_)); | | return Matcher<T>(new MonomorphicImpl<T>(impl_)); | |
| } | | } | |
| private: | | private: | |
| template <typename T> | | template <typename T> | |
| class MonomorphicImpl : public MatcherInterface<T> { | | class MonomorphicImpl : public MatcherInterface<T> { | |
| public: | | public: | |
| explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {} | | explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {} | |
| | | | |
| | | | |
| skipping to change at line 274 | | skipping to change at line 284 | |
| // will be picked by the compiler as the better match. | | // will be picked by the compiler as the better match. | |
| // Otherwise the default implementation of it in | | // Otherwise the default implementation of it in | |
| // ::testing::internal will be picked. | | // ::testing::internal will be picked. | |
| // | | // | |
| // This look-up rule lets a writer of a polymorphic matcher | | // This look-up rule lets a writer of a polymorphic matcher | |
| // customize the behavior of ExplainMatchResultTo() when he | | // customize the behavior of ExplainMatchResultTo() when he | |
| // cares to. Nothing needs to be done by the writer if he | | // cares to. Nothing needs to be done by the writer if he | |
| // doesn't need to customize it. | | // doesn't need to customize it. | |
| ExplainMatchResultTo(impl_, x, os); | | ExplainMatchResultTo(impl_, x, os); | |
| } | | } | |
|
| | | | |
| private: | | private: | |
| const Impl impl_; | | const Impl impl_; | |
| }; | | }; | |
| | | | |
|
| const Impl impl_; | | Impl impl_; | |
| }; | | }; | |
| | | | |
| // Creates a matcher from its implementation. This is easier to use | | // Creates a matcher from its implementation. This is easier to use | |
| // than the Matcher<T> constructor as it doesn't require you to | | // than the Matcher<T> constructor as it doesn't require you to | |
| // explicitly write the template argument, e.g. | | // explicitly write the template argument, e.g. | |
| // | | // | |
| // MakeMatcher(foo); | | // MakeMatcher(foo); | |
| // vs | | // vs | |
| // Matcher<const string&>(foo); | | // Matcher<const string&>(foo); | |
| template <typename T> | | template <typename T> | |
| | | | |
| skipping to change at line 312 | | skipping to change at line 323 | |
| return PolymorphicMatcher<Impl>(impl); | | return PolymorphicMatcher<Impl>(impl); | |
| } | | } | |
| | | | |
| // In order to be safe and clear, casting between different matcher | | // In order to be safe and clear, casting between different matcher | |
| // types is done explicitly via MatcherCast<T>(m), which takes a | | // types is done explicitly via MatcherCast<T>(m), which takes a | |
| // matcher m and returns a Matcher<T>. It compiles only when T can be | | // matcher m and returns a Matcher<T>. It compiles only when T can be | |
| // statically converted to the argument type of m. | | // statically converted to the argument type of m. | |
| template <typename T, typename M> | | template <typename T, typename M> | |
| Matcher<T> MatcherCast(M m); | | Matcher<T> MatcherCast(M m); | |
| | | | |
|
| | | // Implements SafeMatcherCast(). | |
| | | // | |
| | | // We use an intermediate class to do the actual safe casting as Nokia's | |
| | | // Symbian compiler cannot decide between | |
| | | // template <T, M> ... (M) and | |
| | | // template <T, U> ... (const Matcher<U>&) | |
| | | // for function templates but can for member function templates. | |
| | | template <typename T> | |
| | | class SafeMatcherCastImpl { | |
| | | public: | |
| | | // This overload handles polymorphic matchers only since monomorphic | |
| | | // matchers are handled by the next one. | |
| | | template <typename M> | |
| | | static inline Matcher<T> Cast(M polymorphic_matcher) { | |
| | | return Matcher<T>(polymorphic_matcher); | |
| | | } | |
| | | | |
| | | // This overload handles monomorphic matchers. | |
| | | // | |
| | | // In general, if type T can be implicitly converted to type U, we can | |
| | | // safely convert a Matcher<U> to a Matcher<T> (i.e. Matcher is | |
| | | // contravariant): just keep a copy of the original Matcher<U>, convert t | |
| | | he | |
| | | // argument from type T to U, and then pass it to the underlying Matcher< | |
| | | U>. | |
| | | // The only exception is when U is a reference and T is not, as the | |
| | | // underlying Matcher<U> may be interested in the argument's address, whi | |
| | | ch | |
| | | // is not preserved in the conversion from T to U. | |
| | | template <typename U> | |
| | | static inline Matcher<T> Cast(const Matcher<U>& matcher) { | |
| | | // Enforce that T can be implicitly converted to U. | |
| | | GMOCK_COMPILE_ASSERT_((internal::ImplicitlyConvertible<T, U>::value), | |
| | | T_must_be_implicitly_convertible_to_U); | |
| | | // Enforce that we are not converting a non-reference type T to a refer | |
| | | ence | |
| | | // type U. | |
| | | GMOCK_COMPILE_ASSERT_( | |
| | | internal::is_reference<T>::value || !internal::is_reference<U>::val | |
| | | ue, | |
| | | cannot_convert_non_referentce_arg_to_reference); | |
| | | // In case both T and U are arithmetic types, enforce that the | |
| | | // conversion is not lossy. | |
| | | typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(T)) RawT; | |
| | | typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(U)) RawU; | |
| | | const bool kTIsOther = GMOCK_KIND_OF_(RawT) == internal::kOther; | |
| | | const bool kUIsOther = GMOCK_KIND_OF_(RawU) == internal::kOther; | |
| | | GMOCK_COMPILE_ASSERT_( | |
| | | kTIsOther || kUIsOther || | |
| | | (internal::LosslessArithmeticConvertible<RawT, RawU>::value), | |
| | | conversion_of_arithmetic_types_must_be_lossless); | |
| | | return MatcherCast<T>(matcher); | |
| | | } | |
| | | }; | |
| | | | |
| | | template <typename T, typename M> | |
| | | inline Matcher<T> SafeMatcherCast(const M& polymorphic_matcher) { | |
| | | return SafeMatcherCastImpl<T>::Cast(polymorphic_matcher); | |
| | | } | |
| | | | |
| // A<T>() returns a matcher that matches any value of type T. | | // A<T>() returns a matcher that matches any value of type T. | |
| template <typename T> | | template <typename T> | |
| Matcher<T> A(); | | Matcher<T> A(); | |
| | | | |
| // Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION | | // Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION | |
| // and MUST NOT BE USED IN USER CODE!!! | | // and MUST NOT BE USED IN USER CODE!!! | |
| namespace internal { | | namespace internal { | |
| | | | |
| // Appends the explanation on the result of matcher.Matches(value) to | | // Appends the explanation on the result of matcher.Matches(value) to | |
| // os iff the explanation is not empty. | | // os iff the explanation is not empty. | |
| | | | |
| skipping to change at line 393 | | skipping to change at line 459 | |
| *os << "\n"; | | *os << "\n"; | |
| } | | } | |
| } | | } | |
| }; | | }; | |
| | | | |
| // The base case. | | // The base case. | |
| template <> | | template <> | |
| class TuplePrefix<0> { | | class TuplePrefix<0> { | |
| public: | | public: | |
| template <typename MatcherTuple, typename ValueTuple> | | template <typename MatcherTuple, typename ValueTuple> | |
|
| static bool Matches(const MatcherTuple& matcher_tuple, | | static bool Matches(const MatcherTuple& /* matcher_tuple */, | |
| const ValueTuple& value_tuple) { | | const ValueTuple& /* value_tuple */) { | |
| return true; | | return true; | |
| } | | } | |
| | | | |
| template <typename MatcherTuple, typename ValueTuple> | | template <typename MatcherTuple, typename ValueTuple> | |
|
| static void DescribeMatchFailuresTo(const MatcherTuple& matchers, | | static void DescribeMatchFailuresTo(const MatcherTuple& /* matchers */, | |
| const ValueTuple& values, | | const ValueTuple& /* values */, | |
| ::std::ostream* os) {} | | ::std::ostream* /* os */) {} | |
| }; | | }; | |
| | | | |
| // TupleMatches(matcher_tuple, value_tuple) returns true iff all | | // TupleMatches(matcher_tuple, value_tuple) returns true iff all | |
| // matchers in matcher_tuple match the corresponding fields in | | // matchers in matcher_tuple match the corresponding fields in | |
| // value_tuple. It is a compiler error if matcher_tuple and | | // value_tuple. It is a compiler error if matcher_tuple and | |
| // value_tuple have different number of fields or incompatible field | | // value_tuple have different number of fields or incompatible field | |
| // types. | | // types. | |
| template <typename MatcherTuple, typename ValueTuple> | | template <typename MatcherTuple, typename ValueTuple> | |
| bool TupleMatches(const MatcherTuple& matcher_tuple, | | bool TupleMatches(const MatcherTuple& matcher_tuple, | |
| const ValueTuple& value_tuple) { | | const ValueTuple& value_tuple) { | |
| | | | |
| skipping to change at line 498 | | skipping to change at line 564 | |
| template <typename T> | | template <typename T> | |
| class MatcherCastImpl<T, Matcher<T> > { | | class MatcherCastImpl<T, Matcher<T> > { | |
| public: | | public: | |
| static Matcher<T> Cast(const Matcher<T>& matcher) { return matcher; } | | static Matcher<T> Cast(const Matcher<T>& matcher) { return matcher; } | |
| }; | | }; | |
| | | | |
| // Implements A<T>(). | | // Implements A<T>(). | |
| template <typename T> | | template <typename T> | |
| class AnyMatcherImpl : public MatcherInterface<T> { | | class AnyMatcherImpl : public MatcherInterface<T> { | |
| public: | | public: | |
|
| virtual bool Matches(T x) const { return true; } | | virtual bool Matches(T /* x */) const { return true; } | |
| virtual void DescribeTo(::std::ostream* os) const { *os << "is anything";
} | | virtual void DescribeTo(::std::ostream* os) const { *os << "is anything";
} | |
| virtual void DescribeNegationTo(::std::ostream* os) const { | | virtual void DescribeNegationTo(::std::ostream* os) const { | |
| // This is mostly for completeness' safe, as it's not very useful | | // This is mostly for completeness' safe, as it's not very useful | |
| // to write Not(A<bool>()). However we cannot completely rule out | | // to write Not(A<bool>()). However we cannot completely rule out | |
| // such a possibility, and it doesn't hurt to be prepared. | | // such a possibility, and it doesn't hurt to be prepared. | |
| *os << "never matches"; | | *os << "never matches"; | |
| } | | } | |
| }; | | }; | |
| | | | |
| // Implements _, a matcher that matches any value of any | | // Implements _, a matcher that matches any value of any | |
| | | | |
| skipping to change at line 570 | | skipping to change at line 636 | |
| // respectively. | | // respectively. | |
| GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Eq, ==, "equal to"); | | GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Eq, ==, "equal to"); | |
| GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Ge, >=, "greater than or equal to"); | | GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Ge, >=, "greater than or equal to"); | |
| GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Gt, >, "greater than"); | | GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Gt, >, "greater than"); | |
| GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Le, <=, "less than or equal to"); | | GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Le, <=, "less than or equal to"); | |
| GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Lt, <, "less than"); | | GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Lt, <, "less than"); | |
| GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Ne, !=, "not equal to"); | | GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Ne, !=, "not equal to"); | |
| | | | |
| #undef GMOCK_IMPLEMENT_COMPARISON_MATCHER_ | | #undef GMOCK_IMPLEMENT_COMPARISON_MATCHER_ | |
| | | | |
|
| | | // Implements the polymorphic IsNull() matcher, which matches any | |
| | | // pointer that is NULL. | |
| | | class IsNullMatcher { | |
| | | public: | |
| | | template <typename T> | |
| | | bool Matches(T* p) const { return p == NULL; } | |
| | | | |
| | | void DescribeTo(::std::ostream* os) const { *os << "is NULL"; } | |
| | | void DescribeNegationTo(::std::ostream* os) const { | |
| | | *os << "is not NULL"; | |
| | | } | |
| | | }; | |
| | | | |
| // Implements the polymorphic NotNull() matcher, which matches any | | // Implements the polymorphic NotNull() matcher, which matches any | |
| // pointer that is not NULL. | | // pointer that is not NULL. | |
| class NotNullMatcher { | | class NotNullMatcher { | |
| public: | | public: | |
| template <typename T> | | template <typename T> | |
| bool Matches(T* p) const { return p != NULL; } | | bool Matches(T* p) const { return p != NULL; } | |
| | | | |
| void DescribeTo(::std::ostream* os) const { *os << "is not NULL"; } | | void DescribeTo(::std::ostream* os) const { *os << "is not NULL"; } | |
| void DescribeNegationTo(::std::ostream* os) const { | | void DescribeNegationTo(::std::ostream* os) const { | |
| *os << "is NULL"; | | *os << "is NULL"; | |
| | | | |
| skipping to change at line 896 | | skipping to change at line 975 | |
| // using one of the ==, <=, <, etc, operators. The two fields being | | // using one of the ==, <=, <, etc, operators. The two fields being | |
| // compared don't have to have the same type. | | // compared don't have to have the same type. | |
| // | | // | |
| // The matcher defined here is polymorphic (for example, Eq() can be | | // The matcher defined here is polymorphic (for example, Eq() can be | |
| // used to match a tuple<int, short>, a tuple<const long&, double>, | | // used to match a tuple<int, short>, a tuple<const long&, double>, | |
| // etc). Therefore we use a template type conversion operator in the | | // etc). Therefore we use a template type conversion operator in the | |
| // implementation. | | // implementation. | |
| // | | // | |
| // We define this as a macro in order to eliminate duplicated source | | // We define this as a macro in order to eliminate duplicated source | |
| // code. | | // code. | |
|
| #define GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(name, op, relation) \ | | #define GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(name, op) \ | |
| class name##2Matcher { \ | | class name##2Matcher { \ | |
| public: \ | | public: \ | |
| template <typename T1, typename T2> \ | | template <typename T1, typename T2> \ | |
| operator Matcher<const ::std::tr1::tuple<T1, T2>&>() const { \ | | operator Matcher<const ::std::tr1::tuple<T1, T2>&>() const { \ | |
| return MakeMatcher(new Impl<T1, T2>); \ | | return MakeMatcher(new Impl<T1, T2>); \ | |
| } \ | | } \ | |
| private: \ | | private: \ | |
| template <typename T1, typename T2> \ | | template <typename T1, typename T2> \ | |
| class Impl : public MatcherInterface<const ::std::tr1::tuple<T1, T2>&>
{ \ | | class Impl : public MatcherInterface<const ::std::tr1::tuple<T1, T2>&>
{ \ | |
| public: \ | | public: \ | |
| virtual bool Matches(const ::std::tr1::tuple<T1, T2>& args) const { \ | | virtual bool Matches(const ::std::tr1::tuple<T1, T2>& args) const { \ | |
| return ::std::tr1::get<0>(args) op ::std::tr1::get<1>(args); \ | | return ::std::tr1::get<0>(args) op ::std::tr1::get<1>(args); \ | |
| } \ | | } \ | |
| virtual void DescribeTo(::std::ostream* os) const { \ | | virtual void DescribeTo(::std::ostream* os) const { \ | |
|
| *os << "argument #0 is " relation " argument #1"; \ | | *os << "are a pair (x, y) where x " #op " y"; \ | |
| } \ | | } \ | |
| virtual void DescribeNegationTo(::std::ostream* os) const { \ | | virtual void DescribeNegationTo(::std::ostream* os) const { \ | |
|
| *os << "argument #0 is not " relation " argument #1"; \ | | *os << "are a pair (x, y) where x " #op " y is false"; \ | |
| } \ | | } \ | |
| }; \ | | }; \ | |
| } | | } | |
| | | | |
| // Implements Eq(), Ge(), Gt(), Le(), Lt(), and Ne() respectively. | | // Implements Eq(), Ge(), Gt(), Le(), Lt(), and Ne() respectively. | |
|
| GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Eq, ==, "equal to"); | | GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Eq, ==); | |
| GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Ge, >=, "greater than or equal to"); | | GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Ge, >=); | |
| GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Gt, >, "greater than"); | | GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Gt, >); | |
| GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Le, <=, "less than or equal to"); | | GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Le, <=); | |
| GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Lt, <, "less than"); | | GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Lt, <); | |
| GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Ne, !=, "not equal to"); | | GMOCK_IMPLEMENT_COMPARISON2_MATCHER_(Ne, !=); | |
| | | | |
| #undef GMOCK_IMPLEMENT_COMPARISON2_MATCHER_ | | #undef GMOCK_IMPLEMENT_COMPARISON2_MATCHER_ | |
| | | | |
|
| | | // Implements the Not(...) matcher for a particular argument type T. | |
| | | // We do not nest it inside the NotMatcher class template, as that | |
| | | // will prevent different instantiations of NotMatcher from sharing | |
| | | // the same NotMatcherImpl<T> class. | |
| | | template <typename T> | |
| | | class NotMatcherImpl : public MatcherInterface<T> { | |
| | | public: | |
| | | explicit NotMatcherImpl(const Matcher<T>& matcher) | |
| | | : matcher_(matcher) {} | |
| | | | |
| | | virtual bool Matches(T x) const { | |
| | | return !matcher_.Matches(x); | |
| | | } | |
| | | | |
| | | virtual void DescribeTo(::std::ostream* os) const { | |
| | | matcher_.DescribeNegationTo(os); | |
| | | } | |
| | | | |
| | | virtual void DescribeNegationTo(::std::ostream* os) const { | |
| | | matcher_.DescribeTo(os); | |
| | | } | |
| | | | |
| | | virtual void ExplainMatchResultTo(T x, ::std::ostream* os) const { | |
| | | matcher_.ExplainMatchResultTo(x, os); | |
| | | } | |
| | | private: | |
| | | const Matcher<T> matcher_; | |
| | | }; | |
| | | | |
| // Implements the Not(m) matcher, which matches a value that doesn't | | // Implements the Not(m) matcher, which matches a value that doesn't | |
| // match matcher m. | | // match matcher m. | |
| template <typename InnerMatcher> | | template <typename InnerMatcher> | |
| class NotMatcher { | | class NotMatcher { | |
| public: | | public: | |
| explicit NotMatcher(InnerMatcher matcher) : matcher_(matcher) {} | | explicit NotMatcher(InnerMatcher matcher) : matcher_(matcher) {} | |
| | | | |
| // This template type conversion operator allows Not(m) to be used | | // This template type conversion operator allows Not(m) to be used | |
| // to match any type m can match. | | // to match any type m can match. | |
| template <typename T> | | template <typename T> | |
| operator Matcher<T>() const { | | operator Matcher<T>() const { | |
|
| return Matcher<T>(new Impl<T>(matcher_)); | | return Matcher<T>(new NotMatcherImpl<T>(SafeMatcherCast<T>(matcher_))); | |
| } | | } | |
| private: | | private: | |
|
| // Implements the Not(...) matcher for a particular argument type T. | | InnerMatcher matcher_; | |
| template <typename T> | | }; | |
| class Impl : public MatcherInterface<T> { | | | |
| public: | | | |
| explicit Impl(const Matcher<T>& matcher) : matcher_(matcher) {} | | | |
| | | | |
|
| virtual bool Matches(T x) const { | | // Implements the AllOf(m1, m2) matcher for a particular argument type | |
| return !matcher_.Matches(x); | | // T. We do not nest it inside the BothOfMatcher class template, as | |
| } | | // that will prevent different instantiations of BothOfMatcher from | |
| | | // sharing the same BothOfMatcherImpl<T> class. | |
| | | template <typename T> | |
| | | class BothOfMatcherImpl : public MatcherInterface<T> { | |
| | | public: | |
| | | BothOfMatcherImpl(const Matcher<T>& matcher1, const Matcher<T>& matcher2) | |
| | | : matcher1_(matcher1), matcher2_(matcher2) {} | |
| | | | |
|
| virtual void DescribeTo(::std::ostream* os) const { | | virtual bool Matches(T x) const { | |
| matcher_.DescribeNegationTo(os); | | return matcher1_.Matches(x) && matcher2_.Matches(x); | |
| } | | } | |
| | | | |
|
| virtual void DescribeNegationTo(::std::ostream* os) const { | | virtual void DescribeTo(::std::ostream* os) const { | |
| matcher_.DescribeTo(os); | | *os << "("; | |
| } | | matcher1_.DescribeTo(os); | |
| | | *os << ") and ("; | |
| | | matcher2_.DescribeTo(os); | |
| | | *os << ")"; | |
| | | } | |
| | | | |
|
| virtual void ExplainMatchResultTo(T x, ::std::ostream* os) const { | | virtual void DescribeNegationTo(::std::ostream* os) const { | |
| matcher_.ExplainMatchResultTo(x, os); | | *os << "not "; | |
| } | | DescribeTo(os); | |
| private: | | } | |
| const Matcher<T> matcher_; | | | |
| }; | | | |
| | | | |
|
| InnerMatcher matcher_; | | virtual void ExplainMatchResultTo(T x, ::std::ostream* os) const { | |
| | | if (Matches(x)) { | |
| | | // When both matcher1_ and matcher2_ match x, we need to | |
| | | // explain why *both* of them match. | |
| | | ::std::stringstream ss1; | |
| | | matcher1_.ExplainMatchResultTo(x, &ss1); | |
| | | const internal::string s1 = ss1.str(); | |
| | | | |
| | | ::std::stringstream ss2; | |
| | | matcher2_.ExplainMatchResultTo(x, &ss2); | |
| | | const internal::string s2 = ss2.str(); | |
| | | | |
| | | if (s1 == "") { | |
| | | *os << s2; | |
| | | } else { | |
| | | *os << s1; | |
| | | if (s2 != "") { | |
| | | *os << "; " << s2; | |
| | | } | |
| | | } | |
| | | } else { | |
| | | // Otherwise we only need to explain why *one* of them fails | |
| | | // to match. | |
| | | if (!matcher1_.Matches(x)) { | |
| | | matcher1_.ExplainMatchResultTo(x, os); | |
| | | } else { | |
| | | matcher2_.ExplainMatchResultTo(x, os); | |
| | | } | |
| | | } | |
| | | } | |
| | | private: | |
| | | const Matcher<T> matcher1_; | |
| | | const Matcher<T> matcher2_; | |
| }; | | }; | |
| | | | |
| // Used for implementing the AllOf(m_1, ..., m_n) matcher, which | | // Used for implementing the AllOf(m_1, ..., m_n) matcher, which | |
| // matches a value that matches all of the matchers m_1, ..., and m_n. | | // matches a value that matches all of the matchers m_1, ..., and m_n. | |
| template <typename Matcher1, typename Matcher2> | | template <typename Matcher1, typename Matcher2> | |
| class BothOfMatcher { | | class BothOfMatcher { | |
| public: | | public: | |
| BothOfMatcher(Matcher1 matcher1, Matcher2 matcher2) | | BothOfMatcher(Matcher1 matcher1, Matcher2 matcher2) | |
| : matcher1_(matcher1), matcher2_(matcher2) {} | | : matcher1_(matcher1), matcher2_(matcher2) {} | |
| | | | |
| // This template type conversion operator allows a | | // This template type conversion operator allows a | |
| // BothOfMatcher<Matcher1, Matcher2> object to match any type that | | // BothOfMatcher<Matcher1, Matcher2> object to match any type that | |
| // both Matcher1 and Matcher2 can match. | | // both Matcher1 and Matcher2 can match. | |
| template <typename T> | | template <typename T> | |
| operator Matcher<T>() const { | | operator Matcher<T>() const { | |
|
| return Matcher<T>(new Impl<T>(matcher1_, matcher2_)); | | return Matcher<T>(new BothOfMatcherImpl<T>(SafeMatcherCast<T>(matcher1_ | |
| | | ), | |
| | | SafeMatcherCast<T>(matcher2_ | |
| | | ))); | |
| } | | } | |
| private: | | private: | |
|
| // Implements the AllOf(m1, m2) matcher for a particular argument | | Matcher1 matcher1_; | |
| // type T. | | Matcher2 matcher2_; | |
| template <typename T> | | }; | |
| class Impl : public MatcherInterface<T> { | | | |
| public: | | | |
| Impl(const Matcher<T>& matcher1, const Matcher<T>& matcher2) | | | |
| : matcher1_(matcher1), matcher2_(matcher2) {} | | | |
| | | | |
|
| virtual bool Matches(T x) const { | | // Implements the AnyOf(m1, m2) matcher for a particular argument type | |
| return matcher1_.Matches(x) && matcher2_.Matches(x); | | // T. We do not nest it inside the AnyOfMatcher class template, as | |
| } | | // that will prevent different instantiations of AnyOfMatcher from | |
| | | // sharing the same EitherOfMatcherImpl<T> class. | |
| | | template <typename T> | |
| | | class EitherOfMatcherImpl : public MatcherInterface<T> { | |
| | | public: | |
| | | EitherOfMatcherImpl(const Matcher<T>& matcher1, const Matcher<T>& matcher | |
| | | 2) | |
| | | : matcher1_(matcher1), matcher2_(matcher2) {} | |
| | | | |
|
| virtual void DescribeTo(::std::ostream* os) const { | | virtual bool Matches(T x) const { | |
| *os << "("; | | return matcher1_.Matches(x) || matcher2_.Matches(x); | |
| matcher1_.DescribeTo(os); | | } | |
| *os << ") and ("; | | | |
| matcher2_.DescribeTo(os); | | | |
| *os << ")"; | | | |
| } | | | |
| | | | |
|
| virtual void DescribeNegationTo(::std::ostream* os) const { | | virtual void DescribeTo(::std::ostream* os) const { | |
| *os << "not "; | | *os << "("; | |
| DescribeTo(os); | | matcher1_.DescribeTo(os); | |
| } | | *os << ") or ("; | |
| | | matcher2_.DescribeTo(os); | |
| | | *os << ")"; | |
| | | } | |
| | | | |
|
| virtual void ExplainMatchResultTo(T x, ::std::ostream* os) const { | | virtual void DescribeNegationTo(::std::ostream* os) const { | |
| if (Matches(x)) { | | *os << "not "; | |
| // When both matcher1_ and matcher2_ match x, we need to | | DescribeTo(os); | |
| // explain why *both* of them match. | | } | |
| ::std::stringstream ss1; | | | |
| matcher1_.ExplainMatchResultTo(x, &ss1); | | | |
| const internal::string s1 = ss1.str(); | | | |
| | | | |
|
| ::std::stringstream ss2; | | virtual void ExplainMatchResultTo(T x, ::std::ostream* os) const { | |
| matcher2_.ExplainMatchResultTo(x, &ss2); | | if (Matches(x)) { | |
| const internal::string s2 = ss2.str(); | | // If either matcher1_ or matcher2_ matches x, we just need | |
| | | // to explain why *one* of them matches. | |
| | | if (matcher1_.Matches(x)) { | |
| | | matcher1_.ExplainMatchResultTo(x, os); | |
| | | } else { | |
| | | matcher2_.ExplainMatchResultTo(x, os); | |
| | | } | |
| | | } else { | |
| | | // Otherwise we need to explain why *neither* matches. | |
| | | ::std::stringstream ss1; | |
| | | matcher1_.ExplainMatchResultTo(x, &ss1); | |
| | | const internal::string s1 = ss1.str(); | |
| | | | |
|
| if (s1 == "") { | | ::std::stringstream ss2; | |
| *os << s2; | | matcher2_.ExplainMatchResultTo(x, &ss2); | |
| } else { | | const internal::string s2 = ss2.str(); | |
| *os << s1; | | | |
| if (s2 != "") { | | if (s1 == "") { | |
| *os << "; " << s2; | | *os << s2; | |
| } | | | |
| } | | | |
| } else { | | } else { | |
|
| // Otherwise we only need to explain why *one* of them fails | | *os << s1; | |
| // to match. | | if (s2 != "") { | |
| if (!matcher1_.Matches(x)) { | | *os << "; " << s2; | |
| matcher1_.ExplainMatchResultTo(x, os); | | | |
| } else { | | | |
| matcher2_.ExplainMatchResultTo(x, os); | | | |
| } | | } | |
| } | | } | |
| } | | } | |
|
| private: | | } | |
| const Matcher<T> matcher1_; | | private: | |
| const Matcher<T> matcher2_; | | const Matcher<T> matcher1_; | |
| }; | | const Matcher<T> matcher2_; | |
| | | | |
| Matcher1 matcher1_; | | | |
| Matcher2 matcher2_; | | | |
| }; | | }; | |
| | | | |
| // Used for implementing the AnyOf(m_1, ..., m_n) matcher, which | | // Used for implementing the AnyOf(m_1, ..., m_n) matcher, which | |
| // matches a value that matches at least one of the matchers m_1, ..., | | // matches a value that matches at least one of the matchers m_1, ..., | |
| // and m_n. | | // and m_n. | |
| template <typename Matcher1, typename Matcher2> | | template <typename Matcher1, typename Matcher2> | |
| class EitherOfMatcher { | | class EitherOfMatcher { | |
| public: | | public: | |
| EitherOfMatcher(Matcher1 matcher1, Matcher2 matcher2) | | EitherOfMatcher(Matcher1 matcher1, Matcher2 matcher2) | |
| : matcher1_(matcher1), matcher2_(matcher2) {} | | : matcher1_(matcher1), matcher2_(matcher2) {} | |
| | | | |
| // This template type conversion operator allows a | | // This template type conversion operator allows a | |
| // EitherOfMatcher<Matcher1, Matcher2> object to match any type that | | // EitherOfMatcher<Matcher1, Matcher2> object to match any type that | |
| // both Matcher1 and Matcher2 can match. | | // both Matcher1 and Matcher2 can match. | |
| template <typename T> | | template <typename T> | |
| operator Matcher<T>() const { | | operator Matcher<T>() const { | |
|
| return Matcher<T>(new Impl<T>(matcher1_, matcher2_)); | | return Matcher<T>(new EitherOfMatcherImpl<T>( | |
| | | SafeMatcherCast<T>(matcher1_), SafeMatcherCast<T>(matcher2_))); | |
| } | | } | |
| private: | | private: | |
|
| // Implements the AnyOf(m1, m2) matcher for a particular argument | | | |
| // type T. | | | |
| template <typename T> | | | |
| class Impl : public MatcherInterface<T> { | | | |
| public: | | | |
| Impl(const Matcher<T>& matcher1, const Matcher<T>& matcher2) | | | |
| : matcher1_(matcher1), matcher2_(matcher2) {} | | | |
| | | | |
| virtual bool Matches(T x) const { | | | |
| return matcher1_.Matches(x) || matcher2_.Matches(x); | | | |
| } | | | |
| | | | |
| virtual void DescribeTo(::std::ostream* os) const { | | | |
| *os << "("; | | | |
| matcher1_.DescribeTo(os); | | | |
| *os << ") or ("; | | | |
| matcher2_.DescribeTo(os); | | | |
| *os << ")"; | | | |
| } | | | |
| | | | |
| virtual void DescribeNegationTo(::std::ostream* os) const { | | | |
| *os << "not "; | | | |
| DescribeTo(os); | | | |
| } | | | |
| | | | |
| virtual void ExplainMatchResultTo(T x, ::std::ostream* os) const { | | | |
| if (Matches(x)) { | | | |
| // If either matcher1_ or matcher2_ matches x, we just need | | | |
| // to explain why *one* of them matches. | | | |
| if (matcher1_.Matches(x)) { | | | |
| matcher1_.ExplainMatchResultTo(x, os); | | | |
| } else { | | | |
| matcher2_.ExplainMatchResultTo(x, os); | | | |
| } | | | |
| } else { | | | |
| // Otherwise we need to explain why *neither* matches. | | | |
| ::std::stringstream ss1; | | | |
| matcher1_.ExplainMatchResultTo(x, &ss1); | | | |
| const internal::string s1 = ss1.str(); | | | |
| | | | |
| ::std::stringstream ss2; | | | |
| matcher2_.ExplainMatchResultTo(x, &ss2); | | | |
| const internal::string s2 = ss2.str(); | | | |
| | | | |
| if (s1 == "") { | | | |
| *os << s2; | | | |
| } else { | | | |
| *os << s1; | | | |
| if (s2 != "") { | | | |
| *os << "; " << s2; | | | |
| } | | | |
| } | | | |
| } | | | |
| } | | | |
| private: | | | |
| const Matcher<T> matcher1_; | | | |
| const Matcher<T> matcher2_; | | | |
| }; | | | |
| | | | |
| Matcher1 matcher1_; | | Matcher1 matcher1_; | |
| Matcher2 matcher2_; | | Matcher2 matcher2_; | |
| }; | | }; | |
| | | | |
| // Used for implementing Truly(pred), which turns a predicate into a | | // Used for implementing Truly(pred), which turns a predicate into a | |
| // matcher. | | // matcher. | |
| template <typename Predicate> | | template <typename Predicate> | |
| class TrulyMatcher { | | class TrulyMatcher { | |
| public: | | public: | |
| explicit TrulyMatcher(Predicate pred) : predicate_(pred) {} | | explicit TrulyMatcher(Predicate pred) : predicate_(pred) {} | |
| | | | |
| // This method template allows Truly(pred) to be used as a matcher | | // This method template allows Truly(pred) to be used as a matcher | |
| // for type T where T is the argument type of predicate 'pred'. The | | // for type T where T is the argument type of predicate 'pred'. The | |
| // argument is passed by reference as the predicate may be | | // argument is passed by reference as the predicate may be | |
| // interested in the address of the argument. | | // interested in the address of the argument. | |
| template <typename T> | | template <typename T> | |
|
| bool Matches(T& x) const { | | bool Matches(T& x) const { // NOLINT | |
| #if GTEST_OS_WINDOWS | | #if GTEST_OS_WINDOWS | |
| // MSVC warns about converting a value into bool (warning 4800). | | // MSVC warns about converting a value into bool (warning 4800). | |
| #pragma warning(push) // Saves the current warning state. | | #pragma warning(push) // Saves the current warning state. | |
| #pragma warning(disable:4800) // Temporarily disables warning 4800. | | #pragma warning(disable:4800) // Temporarily disables warning 4800. | |
| #endif // GTEST_OS_WINDOWS | | #endif // GTEST_OS_WINDOWS | |
| return predicate_(x); | | return predicate_(x); | |
| #if GTEST_OS_WINDOWS | | #if GTEST_OS_WINDOWS | |
| #pragma warning(pop) // Restores the warning state. | | #pragma warning(pop) // Restores the warning state. | |
| #endif // GTEST_OS_WINDOWS | | #endif // GTEST_OS_WINDOWS | |
| } | | } | |
| | | | |
| skipping to change at line 1435 | | skipping to change at line 1524 | |
| void DescribeTo(::std::ostream* os) const { | | void DescribeTo(::std::ostream* os) const { | |
| *os << "the given field "; | | *os << "the given field "; | |
| matcher_.DescribeTo(os); | | matcher_.DescribeTo(os); | |
| } | | } | |
| | | | |
| void DescribeNegationTo(::std::ostream* os) const { | | void DescribeNegationTo(::std::ostream* os) const { | |
| *os << "the given field "; | | *os << "the given field "; | |
| matcher_.DescribeNegationTo(os); | | matcher_.DescribeNegationTo(os); | |
| } | | } | |
| | | | |
|
| void ExplainMatchResultTo(const Class& obj, ::std::ostream* os) const { | | // The first argument of ExplainMatchResultTo() is needed to help | |
| | | // Symbian's C++ compiler choose which overload to use. Its type is | |
| | | // true_type iff the Field() matcher is used to match a pointer. | |
| | | void ExplainMatchResultTo(false_type /* is_not_pointer */, const Class& o | |
| | | bj, | |
| | | ::std::ostream* os) const { | |
| ::std::stringstream ss; | | ::std::stringstream ss; | |
| matcher_.ExplainMatchResultTo(obj.*field_, &ss); | | matcher_.ExplainMatchResultTo(obj.*field_, &ss); | |
| const internal::string s = ss.str(); | | const internal::string s = ss.str(); | |
| if (s != "") { | | if (s != "") { | |
| *os << "the given field " << s; | | *os << "the given field " << s; | |
| } | | } | |
| } | | } | |
| | | | |
|
| void ExplainMatchResultTo(const Class* p, ::std::ostream* os) const { | | void ExplainMatchResultTo(true_type /* is_pointer */, const Class* p, | |
| | | ::std::ostream* os) const { | |
| if (p != NULL) { | | if (p != NULL) { | |
|
| ExplainMatchResultTo(*p, os); | | // Since *p has a field, it must be a class/struct/union type | |
| | | // and thus cannot be a pointer. Therefore we pass false_type() | |
| | | // as the first argument. | |
| | | ExplainMatchResultTo(false_type(), *p, os); | |
| } | | } | |
| } | | } | |
| private: | | private: | |
| const FieldType Class::*field_; | | const FieldType Class::*field_; | |
| const Matcher<const FieldType&> matcher_; | | const Matcher<const FieldType&> matcher_; | |
| }; | | }; | |
| | | | |
|
| // Explains the result of matching an object against a field matcher. | | // Explains the result of matching an object or pointer against a field mat | |
| template <typename Class, typename FieldType> | | cher. | |
| void ExplainMatchResultTo(const FieldMatcher<Class, FieldType>& matcher, | | template <typename Class, typename FieldType, typename T> | |
| const Class& obj, ::std::ostream* os) { | | | |
| matcher.ExplainMatchResultTo(obj, os); | | | |
| } | | | |
| | | | |
| // Explains the result of matching a pointer against a field matcher. | | | |
| template <typename Class, typename FieldType> | | | |
| void ExplainMatchResultTo(const FieldMatcher<Class, FieldType>& matcher, | | void ExplainMatchResultTo(const FieldMatcher<Class, FieldType>& matcher, | |
|
| const Class* p, ::std::ostream* os) { | | const T& value, ::std::ostream* os) { | |
| matcher.ExplainMatchResultTo(p, os); | | matcher.ExplainMatchResultTo( | |
| | | typename ::testing::internal::is_pointer<T>::type(), value, os); | |
| } | | } | |
| | | | |
| // Implements the Property() matcher for matching a property | | // Implements the Property() matcher for matching a property | |
| // (i.e. return value of a getter method) of an object. | | // (i.e. return value of a getter method) of an object. | |
| template <typename Class, typename PropertyType> | | template <typename Class, typename PropertyType> | |
| class PropertyMatcher { | | class PropertyMatcher { | |
| public: | | public: | |
| // The property may have a reference type, so 'const PropertyType&' | | // The property may have a reference type, so 'const PropertyType&' | |
| // may cause double references and fail to compile. That's why we | | // may cause double references and fail to compile. That's why we | |
| // need GMOCK_REFERENCE_TO_CONST, which works regardless of | | // need GMOCK_REFERENCE_TO_CONST, which works regardless of | |
| | | | |
| skipping to change at line 1503 | | skipping to change at line 1594 | |
| void DescribeTo(::std::ostream* os) const { | | void DescribeTo(::std::ostream* os) const { | |
| *os << "the given property "; | | *os << "the given property "; | |
| matcher_.DescribeTo(os); | | matcher_.DescribeTo(os); | |
| } | | } | |
| | | | |
| void DescribeNegationTo(::std::ostream* os) const { | | void DescribeNegationTo(::std::ostream* os) const { | |
| *os << "the given property "; | | *os << "the given property "; | |
| matcher_.DescribeNegationTo(os); | | matcher_.DescribeNegationTo(os); | |
| } | | } | |
| | | | |
|
| void ExplainMatchResultTo(const Class& obj, ::std::ostream* os) const { | | // The first argument of ExplainMatchResultTo() is needed to help | |
| | | // Symbian's C++ compiler choose which overload to use. Its type is | |
| | | // true_type iff the Property() matcher is used to match a pointer. | |
| | | void ExplainMatchResultTo(false_type /* is_not_pointer */, const Class& o | |
| | | bj, | |
| | | ::std::ostream* os) const { | |
| ::std::stringstream ss; | | ::std::stringstream ss; | |
| matcher_.ExplainMatchResultTo((obj.*property_)(), &ss); | | matcher_.ExplainMatchResultTo((obj.*property_)(), &ss); | |
| const internal::string s = ss.str(); | | const internal::string s = ss.str(); | |
| if (s != "") { | | if (s != "") { | |
| *os << "the given property " << s; | | *os << "the given property " << s; | |
| } | | } | |
| } | | } | |
| | | | |
|
| void ExplainMatchResultTo(const Class* p, ::std::ostream* os) const { | | void ExplainMatchResultTo(true_type /* is_pointer */, const Class* p, | |
| | | ::std::ostream* os) const { | |
| if (p != NULL) { | | if (p != NULL) { | |
|
| ExplainMatchResultTo(*p, os); | | // Since *p has a property method, it must be a | |
| | | // class/struct/union type and thus cannot be a pointer. | |
| | | // Therefore we pass false_type() as the first argument. | |
| | | ExplainMatchResultTo(false_type(), *p, os); | |
| } | | } | |
| } | | } | |
| private: | | private: | |
| PropertyType (Class::*property_)() const; | | PropertyType (Class::*property_)() const; | |
| const Matcher<RefToConstProperty> matcher_; | | const Matcher<RefToConstProperty> matcher_; | |
| }; | | }; | |
| | | | |
|
| // Explains the result of matching an object against a property matcher. | | // Explains the result of matching an object or pointer against a | |
| template <typename Class, typename PropertyType> | | // property matcher. | |
| void ExplainMatchResultTo(const PropertyMatcher<Class, PropertyType>& match | | template <typename Class, typename PropertyType, typename T> | |
| er, | | | |
| const Class& obj, ::std::ostream* os) { | | | |
| matcher.ExplainMatchResultTo(obj, os); | | | |
| } | | | |
| | | | |
| // Explains the result of matching a pointer against a property matcher. | | | |
| template <typename Class, typename PropertyType> | | | |
| void ExplainMatchResultTo(const PropertyMatcher<Class, PropertyType>& match
er, | | void ExplainMatchResultTo(const PropertyMatcher<Class, PropertyType>& match
er, | |
|
| const Class* p, ::std::ostream* os) { | | const T& value, ::std::ostream* os) { | |
| matcher.ExplainMatchResultTo(p, os); | | matcher.ExplainMatchResultTo( | |
| | | typename ::testing::internal::is_pointer<T>::type(), value, os); | |
| } | | } | |
| | | | |
| // Type traits specifying various features of different functors for Result
Of. | | // Type traits specifying various features of different functors for Result
Of. | |
| // The default template specifies features for functor objects. | | // The default template specifies features for functor objects. | |
| // Functor classes have to typedef argument_type and result_type | | // Functor classes have to typedef argument_type and result_type | |
| // to be compatible with ResultOf. | | // to be compatible with ResultOf. | |
| template <typename Functor> | | template <typename Functor> | |
| struct CallableTraits { | | struct CallableTraits { | |
| typedef typename Functor::result_type ResultType; | | typedef typename Functor::result_type ResultType; | |
| typedef Functor StorageType; | | typedef Functor StorageType; | |
| | | | |
| skipping to change at line 1557 | | skipping to change at line 1651 | |
| static ResultType Invoke(Functor f, T arg) { return f(arg); } | | static ResultType Invoke(Functor f, T arg) { return f(arg); } | |
| }; | | }; | |
| | | | |
| // Specialization for function pointers. | | // Specialization for function pointers. | |
| template <typename ArgType, typename ResType> | | template <typename ArgType, typename ResType> | |
| struct CallableTraits<ResType(*)(ArgType)> { | | struct CallableTraits<ResType(*)(ArgType)> { | |
| typedef ResType ResultType; | | typedef ResType ResultType; | |
| typedef ResType(*StorageType)(ArgType); | | typedef ResType(*StorageType)(ArgType); | |
| | | | |
| static void CheckIsValid(ResType(*f)(ArgType)) { | | static void CheckIsValid(ResType(*f)(ArgType)) { | |
|
| GMOCK_CHECK_(f != NULL) | | GTEST_CHECK_(f != NULL) | |
| << "NULL function pointer is passed into ResultOf()."; | | << "NULL function pointer is passed into ResultOf()."; | |
| } | | } | |
| template <typename T> | | template <typename T> | |
| static ResType Invoke(ResType(*f)(ArgType), T arg) { | | static ResType Invoke(ResType(*f)(ArgType), T arg) { | |
| return (*f)(arg); | | return (*f)(arg); | |
| } | | } | |
| }; | | }; | |
| | | | |
| // Implements the ResultOf() matcher for matching a return value of a | | // Implements the ResultOf() matcher for matching a return value of a | |
| // unary function of an object. | | // unary function of an object. | |
| | | | |
| skipping to change at line 1652 | | skipping to change at line 1746 | |
| // The failure message reports elements that are in one of the operands but
not | | // The failure message reports elements that are in one of the operands but
not | |
| // the other. The failure messages do not report duplicate or out-of-order | | // the other. The failure messages do not report duplicate or out-of-order | |
| // elements in the containers (which don't properly matter to sets, but can | | // elements in the containers (which don't properly matter to sets, but can | |
| // occur if the containers are vectors or lists, for example). | | // occur if the containers are vectors or lists, for example). | |
| // | | // | |
| // Uses the container's const_iterator, value_type, operator ==, | | // Uses the container's const_iterator, value_type, operator ==, | |
| // begin(), and end(). | | // begin(), and end(). | |
| template <typename Container> | | template <typename Container> | |
| class ContainerEqMatcher { | | class ContainerEqMatcher { | |
| public: | | public: | |
|
| explicit ContainerEqMatcher(const Container& rhs) : rhs_(rhs) {} | | typedef internal::StlContainerView<Container> View; | |
| bool Matches(const Container& lhs) const { return lhs == rhs_; } | | typedef typename View::type StlContainer; | |
| | | typedef typename View::const_reference StlContainerReference; | |
| | | | |
| | | // We make a copy of rhs in case the elements in it are modified | |
| | | // after this matcher is created. | |
| | | explicit ContainerEqMatcher(const Container& rhs) : rhs_(View::Copy(rhs)) | |
| | | { | |
| | | // Makes sure the user doesn't instantiate this class template | |
| | | // with a const or reference type. | |
| | | testing::StaticAssertTypeEq<Container, | |
| | | GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container))>(); | |
| | | } | |
| | | | |
| | | template <typename LhsContainer> | |
| | | bool Matches(const LhsContainer& lhs) const { | |
| | | // GMOCK_REMOVE_CONST_() is needed to work around an MSVC 8.0 bug | |
| | | // that causes LhsContainer to be a const type sometimes. | |
| | | typedef internal::StlContainerView<GMOCK_REMOVE_CONST_(LhsContainer)> | |
| | | LhsView; | |
| | | StlContainerReference lhs_stl_container = LhsView::ConstReference(lhs); | |
| | | return lhs_stl_container == rhs_; | |
| | | } | |
| void DescribeTo(::std::ostream* os) const { | | void DescribeTo(::std::ostream* os) const { | |
| *os << "equals "; | | *os << "equals "; | |
|
| UniversalPrinter<Container>::Print(rhs_, os); | | UniversalPrinter<StlContainer>::Print(rhs_, os); | |
| } | | } | |
| void DescribeNegationTo(::std::ostream* os) const { | | void DescribeNegationTo(::std::ostream* os) const { | |
| *os << "does not equal "; | | *os << "does not equal "; | |
|
| UniversalPrinter<Container>::Print(rhs_, os); | | UniversalPrinter<StlContainer>::Print(rhs_, os); | |
| } | | } | |
| | | | |
|
| void ExplainMatchResultTo(const Container& lhs, | | template <typename LhsContainer> | |
| | | void ExplainMatchResultTo(const LhsContainer& lhs, | |
| ::std::ostream* os) const { | | ::std::ostream* os) const { | |
|
| | | // GMOCK_REMOVE_CONST_() is needed to work around an MSVC 8.0 bug | |
| | | // that causes LhsContainer to be a const type sometimes. | |
| | | typedef internal::StlContainerView<GMOCK_REMOVE_CONST_(LhsContainer)> | |
| | | LhsView; | |
| | | typedef typename LhsView::type LhsStlContainer; | |
| | | StlContainerReference lhs_stl_container = LhsView::ConstReference(lhs); | |
| | | | |
| // Something is different. Check for missing values first. | | // Something is different. Check for missing values first. | |
| bool printed_header = false; | | bool printed_header = false; | |
|
| for (typename Container::const_iterator it = lhs.begin(); | | for (typename LhsStlContainer::const_iterator it = | |
| it != lhs.end(); ++it) { | | lhs_stl_container.begin(); | |
| if (std::find(rhs_.begin(), rhs_.end(), *it) == rhs_.end()) { | | it != lhs_stl_container.end(); ++it) { | |
| | | if (internal::ArrayAwareFind(rhs_.begin(), rhs_.end(), *it) == | |
| | | rhs_.end()) { | |
| if (printed_header) { | | if (printed_header) { | |
| *os << ", "; | | *os << ", "; | |
| } else { | | } else { | |
| *os << "Only in actual: "; | | *os << "Only in actual: "; | |
| printed_header = true; | | printed_header = true; | |
| } | | } | |
|
| UniversalPrinter<typename Container::value_type>::Print(*it, os); | | UniversalPrinter<typename LhsStlContainer::value_type>::Print(*it,
os); | |
| } | | } | |
| } | | } | |
| | | | |
| // Now check for extra values. | | // Now check for extra values. | |
| bool printed_header2 = false; | | bool printed_header2 = false; | |
|
| for (typename Container::const_iterator it = rhs_.begin(); | | for (typename StlContainer::const_iterator it = rhs_.begin(); | |
| it != rhs_.end(); ++it) { | | it != rhs_.end(); ++it) { | |
|
| if (std::find(lhs.begin(), lhs.end(), *it) == lhs.end()) { | | if (internal::ArrayAwareFind( | |
| | | lhs_stl_container.begin(), lhs_stl_container.end(), *it) == | |
| | | lhs_stl_container.end()) { | |
| if (printed_header2) { | | if (printed_header2) { | |
| *os << ", "; | | *os << ", "; | |
| } else { | | } else { | |
| *os << (printed_header ? "; not" : "Not") << " in actual: "; | | *os << (printed_header ? "; not" : "Not") << " in actual: "; | |
| printed_header2 = true; | | printed_header2 = true; | |
| } | | } | |
|
| UniversalPrinter<typename Container::value_type>::Print(*it, os); | | UniversalPrinter<typename StlContainer::value_type>::Print(*it, os)
; | |
| } | | } | |
| } | | } | |
| } | | } | |
| private: | | private: | |
|
| const Container rhs_; | | const StlContainer rhs_; | |
| }; | | }; | |
| | | | |
|
| template <typename Container> | | template <typename LhsContainer, typename Container> | |
| void ExplainMatchResultTo(const ContainerEqMatcher<Container>& matcher, | | void ExplainMatchResultTo(const ContainerEqMatcher<Container>& matcher, | |
|
| const Container& lhs, | | const LhsContainer& lhs, | |
| ::std::ostream* os) { | | ::std::ostream* os) { | |
| matcher.ExplainMatchResultTo(lhs, os); | | matcher.ExplainMatchResultTo(lhs, os); | |
| } | | } | |
| | | | |
|
| | | // Implements Contains(element_matcher) for the given argument type Contain | |
| | | er. | |
| | | template <typename Container> | |
| | | class ContainsMatcherImpl : public MatcherInterface<Container> { | |
| | | public: | |
| | | typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) RawContai | |
| | | ner; | |
| | | typedef StlContainerView<RawContainer> View; | |
| | | typedef typename View::type StlContainer; | |
| | | typedef typename View::const_reference StlContainerReference; | |
| | | typedef typename StlContainer::value_type Element; | |
| | | | |
| | | template <typename InnerMatcher> | |
| | | explicit ContainsMatcherImpl(InnerMatcher inner_matcher) | |
| | | : inner_matcher_( | |
| | | testing::SafeMatcherCast<const Element&>(inner_matcher)) {} | |
| | | | |
| | | // Returns true iff 'container' matches. | |
| | | virtual bool Matches(Container container) const { | |
| | | StlContainerReference stl_container = View::ConstReference(container); | |
| | | for (typename StlContainer::const_iterator it = stl_container.begin(); | |
| | | it != stl_container.end(); ++it) { | |
| | | if (inner_matcher_.Matches(*it)) | |
| | | return true; | |
| | | } | |
| | | return false; | |
| | | } | |
| | | | |
| | | // Describes what this matcher does. | |
| | | virtual void DescribeTo(::std::ostream* os) const { | |
| | | *os << "contains at least one element that "; | |
| | | inner_matcher_.DescribeTo(os); | |
| | | } | |
| | | | |
| | | // Describes what the negation of this matcher does. | |
| | | virtual void DescribeNegationTo(::std::ostream* os) const { | |
| | | *os << "doesn't contain any element that "; | |
| | | inner_matcher_.DescribeTo(os); | |
| | | } | |
| | | | |
| | | // Explains why 'container' matches, or doesn't match, this matcher. | |
| | | virtual void ExplainMatchResultTo(Container container, | |
| | | ::std::ostream* os) const { | |
| | | StlContainerReference stl_container = View::ConstReference(container); | |
| | | | |
| | | // We need to explain which (if any) element matches inner_matcher_. | |
| | | typename StlContainer::const_iterator it = stl_container.begin(); | |
| | | for (size_t i = 0; it != stl_container.end(); ++it, ++i) { | |
| | | if (inner_matcher_.Matches(*it)) { | |
| | | *os << "element " << i << " matches"; | |
| | | return; | |
| | | } | |
| | | } | |
| | | } | |
| | | | |
| | | private: | |
| | | const Matcher<const Element&> inner_matcher_; | |
| | | }; | |
| | | | |
| | | // Implements polymorphic Contains(element_matcher). | |
| | | template <typename M> | |
| | | class ContainsMatcher { | |
| | | public: | |
| | | explicit ContainsMatcher(M m) : inner_matcher_(m) {} | |
| | | | |
| | | template <typename Container> | |
| | | operator Matcher<Container>() const { | |
| | | return MakeMatcher(new ContainsMatcherImpl<Container>(inner_matcher_)); | |
| | | } | |
| | | | |
| | | private: | |
| | | const M inner_matcher_; | |
| | | }; | |
| | | | |
| | | // Implements Key(inner_matcher) for the given argument pair type. | |
| | | // Key(inner_matcher) matches an std::pair whose 'first' field matches | |
| | | // inner_matcher. For example, Contains(Key(Ge(5))) can be used to match a | |
| | | n | |
| | | // std::map that contains at least one element whose key is >= 5. | |
| | | template <typename PairType> | |
| | | class KeyMatcherImpl : public MatcherInterface<PairType> { | |
| | | public: | |
| | | typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(PairType)) RawPairTyp | |
| | | e; | |
| | | typedef typename RawPairType::first_type KeyType; | |
| | | | |
| | | template <typename InnerMatcher> | |
| | | explicit KeyMatcherImpl(InnerMatcher inner_matcher) | |
| | | : inner_matcher_( | |
| | | testing::SafeMatcherCast<const KeyType&>(inner_matcher)) { | |
| | | } | |
| | | | |
| | | // Returns true iff 'key_value.first' (the key) matches the inner matcher | |
| | | . | |
| | | virtual bool Matches(PairType key_value) const { | |
| | | return inner_matcher_.Matches(key_value.first); | |
| | | } | |
| | | | |
| | | // Describes what this matcher does. | |
| | | virtual void DescribeTo(::std::ostream* os) const { | |
| | | *os << "has a key that "; | |
| | | inner_matcher_.DescribeTo(os); | |
| | | } | |
| | | | |
| | | // Describes what the negation of this matcher does. | |
| | | virtual void DescribeNegationTo(::std::ostream* os) const { | |
| | | *os << "doesn't have a key that "; | |
| | | inner_matcher_.DescribeTo(os); | |
| | | } | |
| | | | |
| | | // Explains why 'key_value' matches, or doesn't match, this matcher. | |
| | | virtual void ExplainMatchResultTo(PairType key_value, | |
| | | ::std::ostream* os) const { | |
| | | inner_matcher_.ExplainMatchResultTo(key_value.first, os); | |
| | | } | |
| | | | |
| | | private: | |
| | | const Matcher<const KeyType&> inner_matcher_; | |
| | | }; | |
| | | | |
| | | // Implements polymorphic Key(matcher_for_key). | |
| | | template <typename M> | |
| | | class KeyMatcher { | |
| | | public: | |
| | | explicit KeyMatcher(M m) : matcher_for_key_(m) {} | |
| | | | |
| | | template <typename PairType> | |
| | | operator Matcher<PairType>() const { | |
| | | return MakeMatcher(new KeyMatcherImpl<PairType>(matcher_for_key_)); | |
| | | } | |
| | | | |
| | | private: | |
| | | const M matcher_for_key_; | |
| | | }; | |
| | | | |
| | | // Implements Pair(first_matcher, second_matcher) for the given argument pa | |
| | | ir | |
| | | // type with its two matchers. See Pair() function below. | |
| | | template <typename PairType> | |
| | | class PairMatcherImpl : public MatcherInterface<PairType> { | |
| | | public: | |
| | | typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(PairType)) RawPairTyp | |
| | | e; | |
| | | typedef typename RawPairType::first_type FirstType; | |
| | | typedef typename RawPairType::second_type SecondType; | |
| | | | |
| | | template <typename FirstMatcher, typename SecondMatcher> | |
| | | PairMatcherImpl(FirstMatcher first_matcher, SecondMatcher second_matcher) | |
| | | : first_matcher_( | |
| | | testing::SafeMatcherCast<const FirstType&>(first_matcher)), | |
| | | second_matcher_( | |
| | | testing::SafeMatcherCast<const SecondType&>(second_matcher)) { | |
| | | } | |
| | | | |
| | | // Returns true iff 'a_pair.first' matches first_matcher and 'a_pair.seco | |
| | | nd' | |
| | | // matches second_matcher. | |
| | | virtual bool Matches(PairType a_pair) const { | |
| | | return first_matcher_.Matches(a_pair.first) && | |
| | | second_matcher_.Matches(a_pair.second); | |
| | | } | |
| | | | |
| | | // Describes what this matcher does. | |
| | | virtual void DescribeTo(::std::ostream* os) const { | |
| | | *os << "has a first field that "; | |
| | | first_matcher_.DescribeTo(os); | |
| | | *os << ", and has a second field that "; | |
| | | second_matcher_.DescribeTo(os); | |
| | | } | |
| | | | |
| | | // Describes what the negation of this matcher does. | |
| | | virtual void DescribeNegationTo(::std::ostream* os) const { | |
| | | *os << "has a first field that "; | |
| | | first_matcher_.DescribeNegationTo(os); | |
| | | *os << ", or has a second field that "; | |
| | | second_matcher_.DescribeNegationTo(os); | |
| | | } | |
| | | | |
| | | // Explains why 'a_pair' matches, or doesn't match, this matcher. | |
| | | virtual void ExplainMatchResultTo(PairType a_pair, | |
| | | ::std::ostream* os) const { | |
| | | ::std::stringstream ss1; | |
| | | first_matcher_.ExplainMatchResultTo(a_pair.first, &ss1); | |
| | | internal::string s1 = ss1.str(); | |
| | | if (s1 != "") { | |
| | | s1 = "the first field " + s1; | |
| | | } | |
| | | | |
| | | ::std::stringstream ss2; | |
| | | second_matcher_.ExplainMatchResultTo(a_pair.second, &ss2); | |
| | | internal::string s2 = ss2.str(); | |
| | | if (s2 != "") { | |
| | | s2 = "the second field " + s2; | |
| | | } | |
| | | | |
| | | *os << s1; | |
| | | if (s1 != "" && s2 != "") { | |
| | | *os << ", and "; | |
| | | } | |
| | | *os << s2; | |
| | | } | |
| | | | |
| | | private: | |
| | | const Matcher<const FirstType&> first_matcher_; | |
| | | const Matcher<const SecondType&> second_matcher_; | |
| | | }; | |
| | | | |
| | | // Implements polymorphic Pair(first_matcher, second_matcher). | |
| | | template <typename FirstMatcher, typename SecondMatcher> | |
| | | class PairMatcher { | |
| | | public: | |
| | | PairMatcher(FirstMatcher first_matcher, SecondMatcher second_matcher) | |
| | | : first_matcher_(first_matcher), second_matcher_(second_matcher) {} | |
| | | | |
| | | template <typename PairType> | |
| | | operator Matcher<PairType> () const { | |
| | | return MakeMatcher( | |
| | | new PairMatcherImpl<PairType>( | |
| | | first_matcher_, second_matcher_)); | |
| | | } | |
| | | | |
| | | private: | |
| | | const FirstMatcher first_matcher_; | |
| | | const SecondMatcher second_matcher_; | |
| | | }; | |
| | | | |
| | | // Implements ElementsAre() and ElementsAreArray(). | |
| | | template <typename Container> | |
| | | class ElementsAreMatcherImpl : public MatcherInterface<Container> { | |
| | | public: | |
| | | typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) RawContai | |
| | | ner; | |
| | | typedef internal::StlContainerView<RawContainer> View; | |
| | | typedef typename View::type StlContainer; | |
| | | typedef typename View::const_reference StlContainerReference; | |
| | | typedef typename StlContainer::value_type Element; | |
| | | | |
| | | // Constructs the matcher from a sequence of element values or | |
| | | // element matchers. | |
| | | template <typename InputIter> | |
| | | ElementsAreMatcherImpl(InputIter first, size_t count) { | |
| | | matchers_.reserve(count); | |
| | | InputIter it = first; | |
| | | for (size_t i = 0; i != count; ++i, ++it) { | |
| | | matchers_.push_back(MatcherCast<const Element&>(*it)); | |
| | | } | |
| | | } | |
| | | | |
| | | // Returns true iff 'container' matches. | |
| | | virtual bool Matches(Container container) const { | |
| | | StlContainerReference stl_container = View::ConstReference(container); | |
| | | if (stl_container.size() != count()) | |
| | | return false; | |
| | | | |
| | | typename StlContainer::const_iterator it = stl_container.begin(); | |
| | | for (size_t i = 0; i != count(); ++it, ++i) { | |
| | | if (!matchers_[i].Matches(*it)) | |
| | | return false; | |
| | | } | |
| | | | |
| | | return true; | |
| | | } | |
| | | | |
| | | // Describes what this matcher does. | |
| | | virtual void DescribeTo(::std::ostream* os) const { | |
| | | if (count() == 0) { | |
| | | *os << "is empty"; | |
| | | } else if (count() == 1) { | |
| | | *os << "has 1 element that "; | |
| | | matchers_[0].DescribeTo(os); | |
| | | } else { | |
| | | *os << "has " << Elements(count()) << " where\n"; | |
| | | for (size_t i = 0; i != count(); ++i) { | |
| | | *os << "element " << i << " "; | |
| | | matchers_[i].DescribeTo(os); | |
| | | if (i + 1 < count()) { | |
| | | *os << ",\n"; | |
| | | } | |
| | | } | |
| | | } | |
| | | } | |
| | | | |
| | | // Describes what the negation of this matcher does. | |
| | | virtual void DescribeNegationTo(::std::ostream* os) const { | |
| | | if (count() == 0) { | |
| | | *os << "is not empty"; | |
| | | return; | |
| | | } | |
| | | | |
| | | *os << "does not have " << Elements(count()) << ", or\n"; | |
| | | for (size_t i = 0; i != count(); ++i) { | |
| | | *os << "element " << i << " "; | |
| | | matchers_[i].DescribeNegationTo(os); | |
| | | if (i + 1 < count()) { | |
| | | *os << ", or\n"; | |
| | | } | |
| | | } | |
| | | } | |
| | | | |
| | | // Explains why 'container' matches, or doesn't match, this matcher. | |
| | | virtual void ExplainMatchResultTo(Container container, | |
| | | ::std::ostream* os) const { | |
| | | StlContainerReference stl_container = View::ConstReference(container); | |
| | | if (Matches(container)) { | |
| | | // We need to explain why *each* element matches (the obvious | |
| | | // ones can be skipped). | |
| | | | |
| | | bool reason_printed = false; | |
| | | typename StlContainer::const_iterator it = stl_container.begin(); | |
| | | for (size_t i = 0; i != count(); ++it, ++i) { | |
| | | ::std::stringstream ss; | |
| | | matchers_[i].ExplainMatchResultTo(*it, &ss); | |
| | | | |
| | | const string s = ss.str(); | |
| | | if (!s.empty()) { | |
| | | if (reason_printed) { | |
| | | *os << ",\n"; | |
| | | } | |
| | | *os << "element " << i << " " << s; | |
| | | reason_printed = true; | |
| | | } | |
| | | } | |
| | | } else { | |
| | | // We need to explain why the container doesn't match. | |
| | | const size_t actual_count = stl_container.size(); | |
| | | if (actual_count != count()) { | |
| | | // The element count doesn't match. If the container is | |
| | | // empty, there's no need to explain anything as Google Mock | |
| | | // already prints the empty container. Otherwise we just need | |
| | | // to show how many elements there actually are. | |
| | | if (actual_count != 0) { | |
| | | *os << "has " << Elements(actual_count); | |
| | | } | |
| | | return; | |
| | | } | |
| | | | |
| | | // The container has the right size but at least one element | |
| | | // doesn't match expectation. We need to find this element and | |
| | | // explain why it doesn't match. | |
| | | typename StlContainer::const_iterator it = stl_container.begin(); | |
| | | for (size_t i = 0; i != count(); ++it, ++i) { | |
| | | if (matchers_[i].Matches(*it)) { | |
| | | continue; | |
| | | } | |
| | | | |
| | | *os << "element " << i << " doesn't match"; | |
| | | | |
| | | ::std::stringstream ss; | |
| | | matchers_[i].ExplainMatchResultTo(*it, &ss); | |
| | | const string s = ss.str(); | |
| | | if (!s.empty()) { | |
| | | *os << " (" << s << ")"; | |
| | | } | |
| | | return; | |
| | | } | |
| | | } | |
| | | } | |
| | | | |
| | | private: | |
| | | static Message Elements(size_t count) { | |
| | | return Message() << count << (count == 1 ? " element" : " elements"); | |
| | | } | |
| | | | |
| | | size_t count() const { return matchers_.size(); } | |
| | | std::vector<Matcher<const Element&> > matchers_; | |
| | | }; | |
| | | | |
| | | // Implements ElementsAre() of 0 arguments. | |
| | | class ElementsAreMatcher0 { | |
| | | public: | |
| | | ElementsAreMatcher0() {} | |
| | | | |
| | | template <typename Container> | |
| | | operator Matcher<Container>() const { | |
| | | typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | |
| | | RawContainer; | |
| | | typedef typename internal::StlContainerView<RawContainer>::type::value_ | |
| | | type | |
| | | Element; | |
| | | | |
| | | const Matcher<const Element&>* const matchers = NULL; | |
| | | return MakeMatcher(new ElementsAreMatcherImpl<Container>(matchers, 0)); | |
| | | } | |
| | | }; | |
| | | | |
| | | // Implements ElementsAreArray(). | |
| | | template <typename T> | |
| | | class ElementsAreArrayMatcher { | |
| | | public: | |
| | | ElementsAreArrayMatcher(const T* first, size_t count) : | |
| | | first_(first), count_(count) {} | |
| | | | |
| | | template <typename Container> | |
| | | operator Matcher<Container>() const { | |
| | | typedef GMOCK_REMOVE_CONST_(GMOCK_REMOVE_REFERENCE_(Container)) | |
| | | RawContainer; | |
| | | typedef typename internal::StlContainerView<RawContainer>::type::value_ | |
| | | type | |
| | | Element; | |
| | | | |
| | | return MakeMatcher(new ElementsAreMatcherImpl<Container>(first_, count_ | |
| | | )); | |
| | | } | |
| | | | |
| | | private: | |
| | | const T* const first_; | |
| | | const size_t count_; | |
| | | }; | |
| | | | |
| | | // Constants denoting interpolations in a matcher description string. | |
| | | const int kTupleInterpolation = -1; // "%(*)s" | |
| | | const int kPercentInterpolation = -2; // "%%" | |
| | | const int kInvalidInterpolation = -3; // "%" followed by invalid text | |
| | | | |
| | | // Records the location and content of an interpolation. | |
| | | struct Interpolation { | |
| | | Interpolation(const char* start, const char* end, int param) | |
| | | : start_pos(start), end_pos(end), param_index(param) {} | |
| | | | |
| | | // Points to the start of the interpolation (the '%' character). | |
| | | const char* start_pos; | |
| | | // Points to the first character after the interpolation. | |
| | | const char* end_pos; | |
| | | // 0-based index of the interpolated matcher parameter; | |
| | | // kTupleInterpolation for "%(*)s"; kPercentInterpolation for "%%". | |
| | | int param_index; | |
| | | }; | |
| | | | |
| | | typedef ::std::vector<Interpolation> Interpolations; | |
| | | | |
| | | // Parses a matcher description string and returns a vector of | |
| | | // interpolations that appear in the string; generates non-fatal | |
| | | // failures iff 'description' is an invalid matcher description. | |
| | | // 'param_names' is a NULL-terminated array of parameter names in the | |
| | | // order they appear in the MATCHER_P*() parameter list. | |
| | | Interpolations ValidateMatcherDescription( | |
| | | const char* param_names[], const char* description); | |
| | | | |
| | | // Returns the actual matcher description, given the matcher name, | |
| | | // user-supplied description template string, interpolations in the | |
| | | // string, and the printed values of the matcher parameters. | |
| | | string FormatMatcherDescription( | |
| | | const char* matcher_name, const char* description, | |
| | | const Interpolations& interp, const Strings& param_values); | |
| | | | |
| } // namespace internal | | } // namespace internal | |
| | | | |
| // Implements MatcherCast(). | | // Implements MatcherCast(). | |
| template <typename T, typename M> | | template <typename T, typename M> | |
| inline Matcher<T> MatcherCast(M matcher) { | | inline Matcher<T> MatcherCast(M matcher) { | |
| return internal::MatcherCastImpl<T, M>::Cast(matcher); | | return internal::MatcherCastImpl<T, M>::Cast(matcher); | |
| } | | } | |
| | | | |
| // _ is a matcher that matches anything of any type. | | // _ is a matcher that matches anything of any type. | |
| // | | // | |
| | | | |
| skipping to change at line 1788 | | skipping to change at line 2347 | |
| inline internal::LtMatcher<Rhs> Lt(Rhs x) { | | inline internal::LtMatcher<Rhs> Lt(Rhs x) { | |
| return internal::LtMatcher<Rhs>(x); | | return internal::LtMatcher<Rhs>(x); | |
| } | | } | |
| | | | |
| // Creates a polymorphic matcher that matches anything != x. | | // Creates a polymorphic matcher that matches anything != x. | |
| template <typename Rhs> | | template <typename Rhs> | |
| inline internal::NeMatcher<Rhs> Ne(Rhs x) { | | inline internal::NeMatcher<Rhs> Ne(Rhs x) { | |
| return internal::NeMatcher<Rhs>(x); | | return internal::NeMatcher<Rhs>(x); | |
| } | | } | |
| | | | |
|
| | | // Creates a polymorphic matcher that matches any NULL pointer. | |
| | | inline PolymorphicMatcher<internal::IsNullMatcher > IsNull() { | |
| | | return MakePolymorphicMatcher(internal::IsNullMatcher()); | |
| | | } | |
| | | | |
| // Creates a polymorphic matcher that matches any non-NULL pointer. | | // Creates a polymorphic matcher that matches any non-NULL pointer. | |
| // This is convenient as Not(NULL) doesn't compile (the compiler | | // This is convenient as Not(NULL) doesn't compile (the compiler | |
| // thinks that that expression is comparing a pointer with an integer). | | // thinks that that expression is comparing a pointer with an integer). | |
| inline PolymorphicMatcher<internal::NotNullMatcher > NotNull() { | | inline PolymorphicMatcher<internal::NotNullMatcher > NotNull() { | |
| return MakePolymorphicMatcher(internal::NotNullMatcher()); | | return MakePolymorphicMatcher(internal::NotNullMatcher()); | |
| } | | } | |
| | | | |
| // Creates a polymorphic matcher that matches any argument that | | // Creates a polymorphic matcher that matches any argument that | |
| // references variable x. | | // references variable x. | |
| template <typename T> | | template <typename T> | |
| | | | |
| skipping to change at line 2149 | | skipping to change at line 2713 | |
| inline PolymorphicMatcher<internal::TrulyMatcher<Predicate> > | | inline PolymorphicMatcher<internal::TrulyMatcher<Predicate> > | |
| Truly(Predicate pred) { | | Truly(Predicate pred) { | |
| return MakePolymorphicMatcher(internal::TrulyMatcher<Predicate>(pred)); | | return MakePolymorphicMatcher(internal::TrulyMatcher<Predicate>(pred)); | |
| } | | } | |
| | | | |
| // Returns a matcher that matches an equal container. | | // Returns a matcher that matches an equal container. | |
| // This matcher behaves like Eq(), but in the event of mismatch lists the | | // This matcher behaves like Eq(), but in the event of mismatch lists the | |
| // values that are included in one container but not the other. (Duplicate | | // values that are included in one container but not the other. (Duplicate | |
| // values and order differences are not explained.) | | // values and order differences are not explained.) | |
| template <typename Container> | | template <typename Container> | |
|
| inline PolymorphicMatcher<internal::ContainerEqMatcher<Container> > | | inline PolymorphicMatcher<internal::ContainerEqMatcher< | |
| | | GMOCK_REMOVE_CONST_(Container)> > | |
| ContainerEq(const Container& rhs) { | | ContainerEq(const Container& rhs) { | |
|
| return MakePolymorphicMatcher(internal::ContainerEqMatcher<Container>(rhs | | // This following line is for working around a bug in MSVC 8.0, | |
| )); | | // which causes Container to be a const type sometimes. | |
| | | typedef GMOCK_REMOVE_CONST_(Container) RawContainer; | |
| | | return MakePolymorphicMatcher(internal::ContainerEqMatcher<RawContainer>( | |
| | | rhs)); | |
| | | } | |
| | | | |
| | | // Matches an STL-style container or a native array that contains at | |
| | | // least one element matching the given value or matcher. | |
| | | // | |
| | | // Examples: | |
| | | // ::std::set<int> page_ids; | |
| | | // page_ids.insert(3); | |
| | | // page_ids.insert(1); | |
| | | // EXPECT_THAT(page_ids, Contains(1)); | |
| | | // EXPECT_THAT(page_ids, Contains(Gt(2))); | |
| | | // EXPECT_THAT(page_ids, Not(Contains(4))); | |
| | | // | |
| | | // ::std::map<int, size_t> page_lengths; | |
| | | // page_lengths[1] = 100; | |
| | | // EXPECT_THAT(page_lengths, | |
| | | // Contains(::std::pair<const int, size_t>(1, 100))); | |
| | | // | |
| | | // const char* user_ids[] = { "joe", "mike", "tom" }; | |
| | | // EXPECT_THAT(user_ids, Contains(Eq(::std::string("tom")))); | |
| | | template <typename M> | |
| | | inline internal::ContainsMatcher<M> Contains(M matcher) { | |
| | | return internal::ContainsMatcher<M>(matcher); | |
| | | } | |
| | | | |
| | | // Key(inner_matcher) matches an std::pair whose 'first' field matches | |
| | | // inner_matcher. For example, Contains(Key(Ge(5))) can be used to match a | |
| | | n | |
| | | // std::map that contains at least one element whose key is >= 5. | |
| | | template <typename M> | |
| | | inline internal::KeyMatcher<M> Key(M inner_matcher) { | |
| | | return internal::KeyMatcher<M>(inner_matcher); | |
| | | } | |
| | | | |
| | | // Pair(first_matcher, second_matcher) matches a std::pair whose 'first' fi | |
| | | eld | |
| | | // matches first_matcher and whose 'second' field matches second_matcher. | |
| | | For | |
| | | // example, EXPECT_THAT(map_type, ElementsAre(Pair(Ge(5), "foo"))) can be u | |
| | | sed | |
| | | // to match a std::map<int, string> that contains exactly one element whose | |
| | | key | |
| | | // is >= 5 and whose value equals "foo". | |
| | | template <typename FirstMatcher, typename SecondMatcher> | |
| | | inline internal::PairMatcher<FirstMatcher, SecondMatcher> | |
| | | Pair(FirstMatcher first_matcher, SecondMatcher second_matcher) { | |
| | | return internal::PairMatcher<FirstMatcher, SecondMatcher>( | |
| | | first_matcher, second_matcher); | |
| } | | } | |
| | | | |
| // Returns a predicate that is satisfied by anything that matches the | | // Returns a predicate that is satisfied by anything that matches the | |
| // given matcher. | | // given matcher. | |
| template <typename M> | | template <typename M> | |
| inline internal::MatcherAsPredicate<M> Matches(M matcher) { | | inline internal::MatcherAsPredicate<M> Matches(M matcher) { | |
| return internal::MatcherAsPredicate<M>(matcher); | | return internal::MatcherAsPredicate<M>(matcher); | |
| } | | } | |
| | | | |
|
| | | // Returns true iff the value matches the matcher. | |
| | | template <typename T, typename M> | |
| | | inline bool Value(const T& value, M matcher) { | |
| | | return testing::Matches(matcher)(value); | |
| | | } | |
| | | | |
| | | // AllArgs(m) is a synonym of m. This is useful in | |
| | | // | |
| | | // EXPECT_CALL(foo, Bar(_, _)).With(AllArgs(Eq())); | |
| | | // | |
| | | // which is easier to read than | |
| | | // | |
| | | // EXPECT_CALL(foo, Bar(_, _)).With(Eq()); | |
| | | template <typename InnerMatcher> | |
| | | inline InnerMatcher AllArgs(const InnerMatcher& matcher) { return matcher; | |
| | | } | |
| | | | |
| // These macros allow using matchers to check values in Google Test | | // These macros allow using matchers to check values in Google Test | |
| // tests. ASSERT_THAT(value, matcher) and EXPECT_THAT(value, matcher) | | // tests. ASSERT_THAT(value, matcher) and EXPECT_THAT(value, matcher) | |
| // succeed iff the value matches the matcher. If the assertion fails, | | // succeed iff the value matches the matcher. If the assertion fails, | |
| // the value and the description of the matcher will be printed. | | // the value and the description of the matcher will be printed. | |
| #define ASSERT_THAT(value, matcher) ASSERT_PRED_FORMAT1(\ | | #define ASSERT_THAT(value, matcher) ASSERT_PRED_FORMAT1(\ | |
| ::testing::internal::MakePredicateFormatterFromMatcher(matcher), value) | | ::testing::internal::MakePredicateFormatterFromMatcher(matcher), value) | |
| #define EXPECT_THAT(value, matcher) EXPECT_PRED_FORMAT1(\ | | #define EXPECT_THAT(value, matcher) EXPECT_PRED_FORMAT1(\ | |
| ::testing::internal::MakePredicateFormatterFromMatcher(matcher), value) | | ::testing::internal::MakePredicateFormatterFromMatcher(matcher), value) | |
| | | | |
| } // namespace testing | | } // namespace testing | |
| | | | |
End of changes. 66 change blocks. |
| 205 lines changed or deleted | | 860 lines changed or added | |
|
| gmock-spec-builders.h | | gmock-spec-builders.h | |
| | | | |
| skipping to change at line 40 | | skipping to change at line 40 | |
| // Author: wan@google.com (Zhanyong Wan) | | // Author: wan@google.com (Zhanyong Wan) | |
| | | | |
| // Google Mock - a framework for writing C++ mock classes. | | // Google Mock - a framework for writing C++ mock classes. | |
| // | | // | |
| // This file implements the ON_CALL() and EXPECT_CALL() macros. | | // This file implements the ON_CALL() and EXPECT_CALL() macros. | |
| // | | // | |
| // A user can use the ON_CALL() macro to specify the default action of | | // A user can use the ON_CALL() macro to specify the default action of | |
| // a mock method. The syntax is: | | // a mock method. The syntax is: | |
| // | | // | |
| // ON_CALL(mock_object, Method(argument-matchers)) | | // ON_CALL(mock_object, Method(argument-matchers)) | |
|
| // .WithArguments(multi-argument-matcher) | | // .With(multi-argument-matcher) | |
| // .WillByDefault(action); | | // .WillByDefault(action); | |
| // | | // | |
|
| // where the .WithArguments() clause is optional. | | // where the .With() clause is optional. | |
| // | | // | |
| // A user can use the EXPECT_CALL() macro to specify an expectation on | | // A user can use the EXPECT_CALL() macro to specify an expectation on | |
| // a mock method. The syntax is: | | // a mock method. The syntax is: | |
| // | | // | |
| // EXPECT_CALL(mock_object, Method(argument-matchers)) | | // EXPECT_CALL(mock_object, Method(argument-matchers)) | |
|
| // .WithArguments(multi-argument-matchers) | | // .With(multi-argument-matchers) | |
| // .Times(cardinality) | | // .Times(cardinality) | |
| // .InSequence(sequences) | | // .InSequence(sequences) | |
|
| | | // .After(expectations) | |
| // .WillOnce(action) | | // .WillOnce(action) | |
| // .WillRepeatedly(action) | | // .WillRepeatedly(action) | |
| // .RetiresOnSaturation(); | | // .RetiresOnSaturation(); | |
| // | | // | |
|
| // where all clauses are optional, .InSequence() and .WillOnce() can | | // where all clauses are optional, and .InSequence()/.After()/ | |
| // appear any number of times, and .Times() can be omitted only if | | // .WillOnce() can appear any number of times. | |
| // .WillOnce() or .WillRepeatedly() is present. | | | |
| | | | |
| #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ | | #ifndef GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ | |
| #define GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ | | #define GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_ | |
| | | | |
| #include <map> | | #include <map> | |
| #include <set> | | #include <set> | |
| #include <sstream> | | #include <sstream> | |
| #include <string> | | #include <string> | |
| #include <vector> | | #include <vector> | |
| | | | |
| #include <gmock/gmock-actions.h> | | #include <gmock/gmock-actions.h> | |
| #include <gmock/gmock-cardinalities.h> | | #include <gmock/gmock-cardinalities.h> | |
| #include <gmock/gmock-matchers.h> | | #include <gmock/gmock-matchers.h> | |
| #include <gmock/gmock-printers.h> | | #include <gmock/gmock-printers.h> | |
| #include <gmock/internal/gmock-internal-utils.h> | | #include <gmock/internal/gmock-internal-utils.h> | |
| #include <gmock/internal/gmock-port.h> | | #include <gmock/internal/gmock-port.h> | |
| #include <gtest/gtest.h> | | #include <gtest/gtest.h> | |
| | | | |
| namespace testing { | | namespace testing { | |
| | | | |
|
| | | // An abstract handle of an expectation. | |
| | | class Expectation; | |
| | | | |
| | | // A set of expectation handles. | |
| | | class ExpectationSet; | |
| | | | |
| // Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION | | // Anything inside the 'internal' namespace IS INTERNAL IMPLEMENTATION | |
| // and MUST NOT BE USED IN USER CODE!!! | | // and MUST NOT BE USED IN USER CODE!!! | |
| namespace internal { | | namespace internal { | |
| | | | |
|
| template <typename F> | | // Implements a mock function. | |
| class FunctionMocker; | | template <typename F> class FunctionMocker; | |
| | | | |
| // Base class for expectations. | | // Base class for expectations. | |
| class ExpectationBase; | | class ExpectationBase; | |
| | | | |
|
| | | // Implements an expectation. | |
| | | template <typename F> class TypedExpectation; | |
| | | | |
| // Helper class for testing the Expectation class template. | | // Helper class for testing the Expectation class template. | |
| class ExpectationTester; | | class ExpectationTester; | |
| | | | |
| // Base class for function mockers. | | // Base class for function mockers. | |
|
| template <typename F> | | template <typename F> class FunctionMockerBase; | |
| class FunctionMockerBase; | | | |
| | | | |
| // Helper class for implementing FunctionMockerBase<F>::InvokeWith(). | | | |
| template <typename Result, typename F> | | | |
| class InvokeWithHelper; | | | |
| | | | |
| // Protects the mock object registry (in class Mock), all function | | // Protects the mock object registry (in class Mock), all function | |
| // mockers, and all expectations. | | // mockers, and all expectations. | |
| // | | // | |
| // The reason we don't use more fine-grained protection is: when a | | // The reason we don't use more fine-grained protection is: when a | |
| // mock function Foo() is called, it needs to consult its expectations | | // mock function Foo() is called, it needs to consult its expectations | |
| // to see which one should be picked. If another thread is allowed to | | // to see which one should be picked. If another thread is allowed to | |
| // call a mock function (either Foo() or a different one) at the same | | // call a mock function (either Foo() or a different one) at the same | |
| // time, it could affect the "retired" attributes of Foo()'s | | // time, it could affect the "retired" attributes of Foo()'s | |
| // expectations when InSequence() is used, and thus affect which | | // expectations when InSequence() is used, and thus affect which | |
| | | | |
| skipping to change at line 146 | | skipping to change at line 150 | |
| typedef typename Function<F>::ArgumentTuple ArgumentTuple; | | typedef typename Function<F>::ArgumentTuple ArgumentTuple; | |
| typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple; | | typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple; | |
| | | | |
| // Constructs a DefaultActionSpec object from the information inside | | // Constructs a DefaultActionSpec object from the information inside | |
| // the parenthesis of an ON_CALL() statement. | | // the parenthesis of an ON_CALL() statement. | |
| DefaultActionSpec(const char* file, int line, | | DefaultActionSpec(const char* file, int line, | |
| const ArgumentMatcherTuple& matchers) | | const ArgumentMatcherTuple& matchers) | |
| : file_(file), | | : file_(file), | |
| line_(line), | | line_(line), | |
| matchers_(matchers), | | matchers_(matchers), | |
|
| extra_matcher_(_), | | // By default, extra_matcher_ should match anything. However, | |
| last_clause_(NONE) { | | // we cannot initialize it with _ as that triggers a compiler | |
| | | // bug in Symbian's C++ compiler (cannot decide between two | |
| | | // overloaded constructors of Matcher<const ArgumentTuple&>). | |
| | | extra_matcher_(A<const ArgumentTuple&>()), | |
| | | last_clause_(kNone) { | |
| } | | } | |
| | | | |
| // Where in the source file was the default action spec defined? | | // Where in the source file was the default action spec defined? | |
| const char* file() const { return file_; } | | const char* file() const { return file_; } | |
| int line() const { return line_; } | | int line() const { return line_; } | |
| | | | |
|
| // Implements the .WithArguments() clause. | | // Implements the .With() clause. | |
| DefaultActionSpec& WithArguments(const Matcher<const ArgumentTuple&>& m) | | DefaultActionSpec& With(const Matcher<const ArgumentTuple&>& m) { | |
| { | | | |
| // Makes sure this is called at most once. | | // Makes sure this is called at most once. | |
|
| ExpectSpecProperty(last_clause_ < WITH_ARGUMENTS, | | ExpectSpecProperty(last_clause_ < kWith, | |
| ".WithArguments() cannot appear " | | ".With() cannot appear " | |
| "more than once in an ON_CALL()."); | | "more than once in an ON_CALL()."); | |
|
| last_clause_ = WITH_ARGUMENTS; | | last_clause_ = kWith; | |
| | | | |
| extra_matcher_ = m; | | extra_matcher_ = m; | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| // Implements the .WillByDefault() clause. | | // Implements the .WillByDefault() clause. | |
| DefaultActionSpec& WillByDefault(const Action<F>& action) { | | DefaultActionSpec& WillByDefault(const Action<F>& action) { | |
|
| ExpectSpecProperty(last_clause_ < WILL_BY_DEFAULT, | | ExpectSpecProperty(last_clause_ < kWillByDefault, | |
| ".WillByDefault() must appear " | | ".WillByDefault() must appear " | |
| "exactly once in an ON_CALL()."); | | "exactly once in an ON_CALL()."); | |
|
| last_clause_ = WILL_BY_DEFAULT; | | last_clause_ = kWillByDefault; | |
| | | | |
| ExpectSpecProperty(!action.IsDoDefault(), | | ExpectSpecProperty(!action.IsDoDefault(), | |
| "DoDefault() cannot be used in ON_CALL()."); | | "DoDefault() cannot be used in ON_CALL()."); | |
| action_ = action; | | action_ = action; | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| // Returns true iff the given arguments match the matchers. | | // Returns true iff the given arguments match the matchers. | |
| bool Matches(const ArgumentTuple& args) const { | | bool Matches(const ArgumentTuple& args) const { | |
| return TupleMatches(matchers_, args) && extra_matcher_.Matches(args); | | return TupleMatches(matchers_, args) && extra_matcher_.Matches(args); | |
| } | | } | |
| | | | |
| // Returns the action specified by the user. | | // Returns the action specified by the user. | |
| const Action<F>& GetAction() const { | | const Action<F>& GetAction() const { | |
|
| AssertSpecProperty(last_clause_ == WILL_BY_DEFAULT, | | AssertSpecProperty(last_clause_ == kWillByDefault, | |
| ".WillByDefault() must appear exactly " | | ".WillByDefault() must appear exactly " | |
| "once in an ON_CALL()."); | | "once in an ON_CALL()."); | |
| return action_; | | return action_; | |
| } | | } | |
| private: | | private: | |
| // Gives each clause in the ON_CALL() statement a name. | | // Gives each clause in the ON_CALL() statement a name. | |
| enum Clause { | | enum Clause { | |
| // Do not change the order of the enum members! The run-time | | // Do not change the order of the enum members! The run-time | |
| // syntax checking relies on it. | | // syntax checking relies on it. | |
|
| NONE, | | kNone, | |
| WITH_ARGUMENTS, | | kWith, | |
| WILL_BY_DEFAULT, | | kWillByDefault, | |
| }; | | }; | |
| | | | |
| // Asserts that the ON_CALL() statement has a certain property. | | // Asserts that the ON_CALL() statement has a certain property. | |
| void AssertSpecProperty(bool property, const string& failure_message) con
st { | | void AssertSpecProperty(bool property, const string& failure_message) con
st { | |
| Assert(property, file_, line_, failure_message); | | Assert(property, file_, line_, failure_message); | |
| } | | } | |
| | | | |
| // Expects that the ON_CALL() statement has a certain property. | | // Expects that the ON_CALL() statement has a certain property. | |
| void ExpectSpecProperty(bool property, const string& failure_message) con
st { | | void ExpectSpecProperty(bool property, const string& failure_message) con
st { | |
| Expect(property, file_, line_, failure_message); | | Expect(property, file_, line_, failure_message); | |
| } | | } | |
| | | | |
| // The information in statement | | // The information in statement | |
| // | | // | |
| // ON_CALL(mock_object, Method(matchers)) | | // ON_CALL(mock_object, Method(matchers)) | |
|
| // .WithArguments(multi-argument-matcher) | | // .With(multi-argument-matcher) | |
| // .WillByDefault(action); | | // .WillByDefault(action); | |
| // | | // | |
| // is recorded in the data members like this: | | // is recorded in the data members like this: | |
| // | | // | |
| // source file that contains the statement => file_ | | // source file that contains the statement => file_ | |
| // line number of the statement => line_ | | // line number of the statement => line_ | |
| // matchers => matchers_ | | // matchers => matchers_ | |
| // multi-argument-matcher => extra_matcher_ | | // multi-argument-matcher => extra_matcher_ | |
| // action => action_ | | // action => action_ | |
| const char* file_; | | const char* file_; | |
| int line_; | | int line_; | |
| ArgumentMatcherTuple matchers_; | | ArgumentMatcherTuple matchers_; | |
| Matcher<const ArgumentTuple&> extra_matcher_; | | Matcher<const ArgumentTuple&> extra_matcher_; | |
| Action<F> action_; | | Action<F> action_; | |
| | | | |
| // The last clause in the ON_CALL() statement as seen so far. | | // The last clause in the ON_CALL() statement as seen so far. | |
|
| // Initially NONE and changes as the statement is parsed. | | // Initially kNone and changes as the statement is parsed. | |
| Clause last_clause_; | | Clause last_clause_; | |
| }; // class DefaultActionSpec | | }; // class DefaultActionSpec | |
| | | | |
|
| // Possible reactions on uninteresting calls. | | // Possible reactions on uninteresting calls. TODO(wan@google.com): | |
| | | // rename the enum values to the kFoo style. | |
| enum CallReaction { | | enum CallReaction { | |
| ALLOW, | | ALLOW, | |
| WARN, | | WARN, | |
| FAIL, | | FAIL, | |
| }; | | }; | |
| | | | |
| } // namespace internal | | } // namespace internal | |
| | | | |
| // Utilities for manipulating mock objects. | | // Utilities for manipulating mock objects. | |
| class Mock { | | class Mock { | |
| public: | | public: | |
| // The following public methods can be called concurrently. | | // The following public methods can be called concurrently. | |
| | | | |
|
| | | // Tells Google Mock to ignore mock_obj when checking for leaked | |
| | | // mock objects. | |
| | | static void AllowLeak(const void* mock_obj); | |
| | | | |
| // Verifies and clears all expectations on the given mock object. | | // Verifies and clears all expectations on the given mock object. | |
| // If the expectations aren't satisfied, generates one or more | | // If the expectations aren't satisfied, generates one or more | |
| // Google Test non-fatal failures and returns false. | | // Google Test non-fatal failures and returns false. | |
| static bool VerifyAndClearExpectations(void* mock_obj); | | static bool VerifyAndClearExpectations(void* mock_obj); | |
| | | | |
| // Verifies all expectations on the given mock object and clears its | | // Verifies all expectations on the given mock object and clears its | |
| // default actions and expectations. Returns true iff the | | // default actions and expectations. Returns true iff the | |
| // verification was successful. | | // verification was successful. | |
| static bool VerifyAndClear(void* mock_obj); | | static bool VerifyAndClear(void* mock_obj); | |
| private: | | private: | |
| // Needed for a function mocker to register itself (so that we know | | // Needed for a function mocker to register itself (so that we know | |
| // how to clear a mock object). | | // how to clear a mock object). | |
| template <typename F> | | template <typename F> | |
| friend class internal::FunctionMockerBase; | | friend class internal::FunctionMockerBase; | |
| | | | |
|
| template <typename R, typename Args> | | | |
| friend class internal::InvokeWithHelper; | | | |
| | | | |
| template <typename M> | | template <typename M> | |
| friend class NiceMock; | | friend class NiceMock; | |
| | | | |
| template <typename M> | | template <typename M> | |
| friend class StrictMock; | | friend class StrictMock; | |
| | | | |
| // Tells Google Mock to allow uninteresting calls on the given mock | | // Tells Google Mock to allow uninteresting calls on the given mock | |
| // object. | | // object. | |
| // L < g_gmock_mutex | | // L < g_gmock_mutex | |
| static void AllowUninterestingCalls(const void* mock_obj); | | static void AllowUninterestingCalls(const void* mock_obj); | |
| | | | |
| skipping to change at line 314 | | skipping to change at line 324 | |
| | | | |
| // Clears all ON_CALL()s set on the given mock object. | | // Clears all ON_CALL()s set on the given mock object. | |
| // L >= g_gmock_mutex | | // L >= g_gmock_mutex | |
| static void ClearDefaultActionsLocked(void* mock_obj); | | static void ClearDefaultActionsLocked(void* mock_obj); | |
| | | | |
| // Registers a mock object and a mock method it owns. | | // Registers a mock object and a mock method it owns. | |
| // L < g_gmock_mutex | | // L < g_gmock_mutex | |
| static void Register(const void* mock_obj, | | static void Register(const void* mock_obj, | |
| internal::UntypedFunctionMockerBase* mocker); | | internal::UntypedFunctionMockerBase* mocker); | |
| | | | |
|
| | | // Tells Google Mock where in the source code mock_obj is used in an | |
| | | // ON_CALL or EXPECT_CALL. In case mock_obj is leaked, this | |
| | | // information helps the user identify which object it is. | |
| | | // L < g_gmock_mutex | |
| | | static void RegisterUseByOnCallOrExpectCall( | |
| | | const void* mock_obj, const char* file, int line); | |
| | | | |
| // Unregisters a mock method; removes the owning mock object from | | // Unregisters a mock method; removes the owning mock object from | |
| // the registry when the last mock method associated with it has | | // the registry when the last mock method associated with it has | |
| // been unregistered. This is called only in the destructor of | | // been unregistered. This is called only in the destructor of | |
| // FunctionMockerBase. | | // FunctionMockerBase. | |
| // L >= g_gmock_mutex | | // L >= g_gmock_mutex | |
| static void UnregisterLocked(internal::UntypedFunctionMockerBase* mocker)
; | | static void UnregisterLocked(internal::UntypedFunctionMockerBase* mocker)
; | |
| }; // class Mock | | }; // class Mock | |
| | | | |
|
| | | // An abstract handle of an expectation. Useful in the .After() | |
| | | // clause of EXPECT_CALL() for setting the (partial) order of | |
| | | // expectations. The syntax: | |
| | | // | |
| | | // Expectation e1 = EXPECT_CALL(...)...; | |
| | | // EXPECT_CALL(...).After(e1)...; | |
| | | // | |
| | | // sets two expectations where the latter can only be matched after | |
| | | // the former has been satisfied. | |
| | | // | |
| | | // Notes: | |
| | | // - This class is copyable and has value semantics. | |
| | | // - Constness is shallow: a const Expectation object itself cannot | |
| | | // be modified, but the mutable methods of the ExpectationBase | |
| | | // object it references can be called via expectation_base(). | |
| | | // - The constructors and destructor are defined out-of-line because | |
| | | // the Symbian WINSCW compiler wants to otherwise instantiate them | |
| | | // when it sees this class definition, at which point it doesn't have | |
| | | // ExpectationBase available yet, leading to incorrect destruction | |
| | | // in the linked_ptr (or compilation errors if using a checking | |
| | | // linked_ptr). | |
| | | class Expectation { | |
| | | public: | |
| | | // Constructs a null object that doesn't reference any expectation. | |
| | | Expectation(); | |
| | | | |
| | | ~Expectation(); | |
| | | | |
| | | // This single-argument ctor must not be explicit, in order to support th | |
| | | e | |
| | | // Expectation e = EXPECT_CALL(...); | |
| | | // syntax. | |
| | | // | |
| | | // A TypedExpectation object stores its pre-requisites as | |
| | | // Expectation objects, and needs to call the non-const Retire() | |
| | | // method on the ExpectationBase objects they reference. Therefore | |
| | | // Expectation must receive a *non-const* reference to the | |
| | | // ExpectationBase object. | |
| | | Expectation(internal::ExpectationBase& exp); // NOLINT | |
| | | | |
| | | // The compiler-generated copy ctor and operator= work exactly as | |
| | | // intended, so we don't need to define our own. | |
| | | | |
| | | // Returns true iff rhs references the same expectation as this object do | |
| | | es. | |
| | | bool operator==(const Expectation& rhs) const { | |
| | | return expectation_base_ == rhs.expectation_base_; | |
| | | } | |
| | | | |
| | | bool operator!=(const Expectation& rhs) const { return !(*this == rhs); } | |
| | | | |
| | | private: | |
| | | friend class ExpectationSet; | |
| | | friend class Sequence; | |
| | | friend class ::testing::internal::ExpectationBase; | |
| | | | |
| | | template <typename F> | |
| | | friend class ::testing::internal::FunctionMockerBase; | |
| | | | |
| | | template <typename F> | |
| | | friend class ::testing::internal::TypedExpectation; | |
| | | | |
| | | // This comparator is needed for putting Expectation objects into a set. | |
| | | class Less { | |
| | | public: | |
| | | bool operator()(const Expectation& lhs, const Expectation& rhs) const { | |
| | | return lhs.expectation_base_.get() < rhs.expectation_base_.get(); | |
| | | } | |
| | | }; | |
| | | | |
| | | typedef ::std::set<Expectation, Less> Set; | |
| | | | |
| | | Expectation( | |
| | | const internal::linked_ptr<internal::ExpectationBase>& expectation_ba | |
| | | se); | |
| | | | |
| | | // Returns the expectation this object references. | |
| | | const internal::linked_ptr<internal::ExpectationBase>& | |
| | | expectation_base() const { | |
| | | return expectation_base_; | |
| | | } | |
| | | | |
| | | // A linked_ptr that co-owns the expectation this handle references. | |
| | | internal::linked_ptr<internal::ExpectationBase> expectation_base_; | |
| | | }; | |
| | | | |
| | | // A set of expectation handles. Useful in the .After() clause of | |
| | | // EXPECT_CALL() for setting the (partial) order of expectations. The | |
| | | // syntax: | |
| | | // | |
| | | // ExpectationSet es; | |
| | | // es += EXPECT_CALL(...)...; | |
| | | // es += EXPECT_CALL(...)...; | |
| | | // EXPECT_CALL(...).After(es)...; | |
| | | // | |
| | | // sets three expectations where the last one can only be matched | |
| | | // after the first two have both been satisfied. | |
| | | // | |
| | | // This class is copyable and has value semantics. | |
| | | class ExpectationSet { | |
| | | public: | |
| | | // A bidirectional iterator that can read a const element in the set. | |
| | | typedef Expectation::Set::const_iterator const_iterator; | |
| | | | |
| | | // An object stored in the set. This is an alias of Expectation. | |
| | | typedef Expectation::Set::value_type value_type; | |
| | | | |
| | | // Constructs an empty set. | |
| | | ExpectationSet() {} | |
| | | | |
| | | // This single-argument ctor must not be explicit, in order to support th | |
| | | e | |
| | | // ExpectationSet es = EXPECT_CALL(...); | |
| | | // syntax. | |
| | | ExpectationSet(internal::ExpectationBase& exp) { // NOLINT | |
| | | *this += Expectation(exp); | |
| | | } | |
| | | | |
| | | // This single-argument ctor implements implicit conversion from | |
| | | // Expectation and thus must not be explicit. This allows either an | |
| | | // Expectation or an ExpectationSet to be used in .After(). | |
| | | ExpectationSet(const Expectation& e) { // NOLINT | |
| | | *this += e; | |
| | | } | |
| | | | |
| | | // The compiler-generator ctor and operator= works exactly as | |
| | | // intended, so we don't need to define our own. | |
| | | | |
| | | // Returns true iff rhs contains the same set of Expectation objects | |
| | | // as this does. | |
| | | bool operator==(const ExpectationSet& rhs) const { | |
| | | return expectations_ == rhs.expectations_; | |
| | | } | |
| | | | |
| | | bool operator!=(const ExpectationSet& rhs) const { return !(*this == rhs) | |
| | | ; } | |
| | | | |
| | | // Implements the syntax | |
| | | // expectation_set += EXPECT_CALL(...); | |
| | | ExpectationSet& operator+=(const Expectation& e) { | |
| | | expectations_.insert(e); | |
| | | return *this; | |
| | | } | |
| | | | |
| | | int size() const { return static_cast<int>(expectations_.size()); } | |
| | | | |
| | | const_iterator begin() const { return expectations_.begin(); } | |
| | | const_iterator end() const { return expectations_.end(); } | |
| | | | |
| | | private: | |
| | | Expectation::Set expectations_; | |
| | | }; | |
| | | | |
| // Sequence objects are used by a user to specify the relative order | | // Sequence objects are used by a user to specify the relative order | |
| // in which the expectations should match. They are copyable (we rely | | // in which the expectations should match. They are copyable (we rely | |
| // on the compiler-defined copy constructor and assignment operator). | | // on the compiler-defined copy constructor and assignment operator). | |
| class Sequence { | | class Sequence { | |
| public: | | public: | |
| // Constructs an empty sequence. | | // Constructs an empty sequence. | |
|
| Sequence() | | Sequence() : last_expectation_(new Expectation) {} | |
| : last_expectation_( | | | |
| new internal::linked_ptr<internal::ExpectationBase>(NULL)) {} | | | |
| | | | |
| // Adds an expectation to this sequence. The caller must ensure | | // Adds an expectation to this sequence. The caller must ensure | |
| // that no other thread is accessing this Sequence object. | | // that no other thread is accessing this Sequence object. | |
|
| void AddExpectation( | | void AddExpectation(const Expectation& expectation) const; | |
| const internal::linked_ptr<internal::ExpectationBase>& expectation) c | | | |
| onst; | | | |
| private: | | private: | |
|
| // The last expectation in this sequence. We use a nested | | // The last expectation in this sequence. We use a linked_ptr here | |
| // linked_ptr here because: | | // because Sequence objects are copyable and we want the copies to | |
| // - Sequence objects are copyable, and we want the copies to act | | // be aliases. The linked_ptr allows the copies to co-own and share | |
| // as aliases. The outer linked_ptr allows the copies to co-own | | // the same Expectation object. | |
| // and share the same state. | | internal::linked_ptr<Expectation> last_expectation_; | |
| // - An Expectation object is co-owned (via linked_ptr) by its | | | |
| // FunctionMocker and its successors (other Expectation objects). | | | |
| // Hence the inner linked_ptr. | | | |
| internal::linked_ptr<internal::linked_ptr<internal::ExpectationBase> > | | | |
| last_expectation_; | | | |
| }; // class Sequence | | }; // class Sequence | |
| | | | |
| // An object of this type causes all EXPECT_CALL() statements | | // An object of this type causes all EXPECT_CALL() statements | |
| // encountered in its scope to be put in an anonymous sequence. The | | // encountered in its scope to be put in an anonymous sequence. The | |
| // work is done in the constructor and destructor. You should only | | // work is done in the constructor and destructor. You should only | |
| // create an InSequence object on the stack. | | // create an InSequence object on the stack. | |
| // | | // | |
| // The sole purpose for this class is to support easy definition of | | // The sole purpose for this class is to support easy definition of | |
| // sequential expectations, e.g. | | // sequential expectations, e.g. | |
| // | | // | |
| | | | |
| skipping to change at line 426 | | skipping to change at line 584 | |
| // Describes the source file location of this expectation. | | // Describes the source file location of this expectation. | |
| void DescribeLocationTo(::std::ostream* os) const { | | void DescribeLocationTo(::std::ostream* os) const { | |
| *os << file() << ":" << line() << ": "; | | *os << file() << ":" << line() << ": "; | |
| } | | } | |
| | | | |
| // Describes how many times a function call matching this | | // Describes how many times a function call matching this | |
| // expectation has occurred. | | // expectation has occurred. | |
| // L >= g_gmock_mutex | | // L >= g_gmock_mutex | |
| virtual void DescribeCallCountTo(::std::ostream* os) const = 0; | | virtual void DescribeCallCountTo(::std::ostream* os) const = 0; | |
| protected: | | protected: | |
|
| typedef std::set<linked_ptr<ExpectationBase>, | | friend class ::testing::Expectation; | |
| LinkedPtrLessThan<ExpectationBase> > | | | |
| ExpectationBaseSet; | | | |
| | | | |
| enum Clause { | | enum Clause { | |
| // Don't change the order of the enum members! | | // Don't change the order of the enum members! | |
|
| NONE, | | kNone, | |
| WITH_ARGUMENTS, | | kWith, | |
| TIMES, | | kTimes, | |
| IN_SEQUENCE, | | kInSequence, | |
| WILL_ONCE, | | kAfter, | |
| WILL_REPEATEDLY, | | kWillOnce, | |
| RETIRES_ON_SATURATION, | | kWillRepeatedly, | |
| | | kRetiresOnSaturation, | |
| }; | | }; | |
| | | | |
|
| | | // Returns an Expectation object that references and co-owns this | |
| | | // expectation. | |
| | | virtual Expectation GetHandle() = 0; | |
| | | | |
| // Asserts that the EXPECT_CALL() statement has the given property. | | // Asserts that the EXPECT_CALL() statement has the given property. | |
| void AssertSpecProperty(bool property, const string& failure_message) con
st { | | void AssertSpecProperty(bool property, const string& failure_message) con
st { | |
| Assert(property, file_, line_, failure_message); | | Assert(property, file_, line_, failure_message); | |
| } | | } | |
| | | | |
| // Expects that the EXPECT_CALL() statement has the given property. | | // Expects that the EXPECT_CALL() statement has the given property. | |
| void ExpectSpecProperty(bool property, const string& failure_message) con
st { | | void ExpectSpecProperty(bool property, const string& failure_message) con
st { | |
| Expect(property, file_, line_, failure_message); | | Expect(property, file_, line_, failure_message); | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 513 | | skipping to change at line 674 | |
| g_gmock_mutex.AssertHeld(); | | g_gmock_mutex.AssertHeld(); | |
| return cardinality().IsOverSaturatedByCallCount(call_count_); | | return cardinality().IsOverSaturatedByCallCount(call_count_); | |
| } | | } | |
| | | | |
| // Returns true iff all pre-requisites of this expectation are satisfied. | | // Returns true iff all pre-requisites of this expectation are satisfied. | |
| // L >= g_gmock_mutex | | // L >= g_gmock_mutex | |
| bool AllPrerequisitesAreSatisfied() const; | | bool AllPrerequisitesAreSatisfied() const; | |
| | | | |
| // Adds unsatisfied pre-requisites of this expectation to 'result'. | | // Adds unsatisfied pre-requisites of this expectation to 'result'. | |
| // L >= g_gmock_mutex | | // L >= g_gmock_mutex | |
|
| void FindUnsatisfiedPrerequisites(ExpectationBaseSet* result) const; | | void FindUnsatisfiedPrerequisites(ExpectationSet* result) const; | |
| | | | |
| // Returns the number this expectation has been invoked. | | // Returns the number this expectation has been invoked. | |
| // L >= g_gmock_mutex | | // L >= g_gmock_mutex | |
| int call_count() const { | | int call_count() const { | |
| g_gmock_mutex.AssertHeld(); | | g_gmock_mutex.AssertHeld(); | |
| return call_count_; | | return call_count_; | |
| } | | } | |
| | | | |
| // Increments the number this expectation has been invoked. | | // Increments the number this expectation has been invoked. | |
| // L >= g_gmock_mutex | | // L >= g_gmock_mutex | |
| void IncrementCallCount() { | | void IncrementCallCount() { | |
| g_gmock_mutex.AssertHeld(); | | g_gmock_mutex.AssertHeld(); | |
| call_count_++; | | call_count_++; | |
| } | | } | |
| | | | |
| private: | | private: | |
| friend class ::testing::Sequence; | | friend class ::testing::Sequence; | |
| friend class ::testing::internal::ExpectationTester; | | friend class ::testing::internal::ExpectationTester; | |
| | | | |
| template <typename Function> | | template <typename Function> | |
|
| friend class Expectation; | | friend class TypedExpectation; | |
| | | | |
| // This group of fields are part of the spec and won't change after | | // This group of fields are part of the spec and won't change after | |
| // an EXPECT_CALL() statement finishes. | | // an EXPECT_CALL() statement finishes. | |
| const char* file_; // The file that contains the expectation. | | const char* file_; // The file that contains the expectation. | |
| int line_; // The line number of the expectation. | | int line_; // The line number of the expectation. | |
| // True iff the cardinality is specified explicitly. | | // True iff the cardinality is specified explicitly. | |
| bool cardinality_specified_; | | bool cardinality_specified_; | |
| Cardinality cardinality_; // The cardinality of the expectatio
n. | | Cardinality cardinality_; // The cardinality of the expectatio
n. | |
|
| // The immediate pre-requisites of this expectation. We use | | // The immediate pre-requisites (i.e. expectations that must be | |
| // linked_ptr in the set because we want an Expectation object to be | | // satisfied before this expectation can be matched) of this | |
| // co-owned by its FunctionMocker and its successors. This allows | | // expectation. We use linked_ptr in the set because we want an | |
| // multiple mock objects to be deleted at different times. | | // Expectation object to be co-owned by its FunctionMocker and its | |
| ExpectationBaseSet immediate_prerequisites_; | | // successors. This allows multiple mock objects to be deleted at | |
| | | // different times. | |
| | | ExpectationSet immediate_prerequisites_; | |
| | | | |
| // This group of fields are the current state of the expectation, | | // This group of fields are the current state of the expectation, | |
| // and can change as the mock function is called. | | // and can change as the mock function is called. | |
| int call_count_; // How many times this expectation has been invoked. | | int call_count_; // How many times this expectation has been invoked. | |
| bool retired_; // True iff this expectation has retired. | | bool retired_; // True iff this expectation has retired. | |
| }; // class ExpectationBase | | }; // class ExpectationBase | |
| | | | |
| // Impements an expectation for the given function type. | | // Impements an expectation for the given function type. | |
| template <typename F> | | template <typename F> | |
|
| class Expectation : public ExpectationBase { | | class TypedExpectation : public ExpectationBase { | |
| public: | | public: | |
| typedef typename Function<F>::ArgumentTuple ArgumentTuple; | | typedef typename Function<F>::ArgumentTuple ArgumentTuple; | |
| typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple; | | typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple; | |
| typedef typename Function<F>::Result Result; | | typedef typename Function<F>::Result Result; | |
| | | | |
|
| Expectation(FunctionMockerBase<F>* owner, const char* file, int line, | | TypedExpectation(FunctionMockerBase<F>* owner, const char* file, int line | |
| const ArgumentMatcherTuple& m) | | , | |
| | | const ArgumentMatcherTuple& m) | |
| : ExpectationBase(file, line), | | : ExpectationBase(file, line), | |
| owner_(owner), | | owner_(owner), | |
| matchers_(m), | | matchers_(m), | |
|
| extra_matcher_(_), | | // By default, extra_matcher_ should match anything. However, | |
| | | // we cannot initialize it with _ as that triggers a compiler | |
| | | // bug in Symbian's C++ compiler (cannot decide between two | |
| | | // overloaded constructors of Matcher<const ArgumentTuple&>). | |
| | | extra_matcher_(A<const ArgumentTuple&>()), | |
| repeated_action_specified_(false), | | repeated_action_specified_(false), | |
| repeated_action_(DoDefault()), | | repeated_action_(DoDefault()), | |
| retires_on_saturation_(false), | | retires_on_saturation_(false), | |
|
| last_clause_(NONE), | | last_clause_(kNone), | |
| action_count_checked_(false) {} | | action_count_checked_(false) {} | |
| | | | |
|
| virtual ~Expectation() { | | virtual ~TypedExpectation() { | |
| // Check the validity of the action count if it hasn't been done | | // Check the validity of the action count if it hasn't been done | |
| // yet (for example, if the expectation was never used). | | // yet (for example, if the expectation was never used). | |
| CheckActionCountIfNotDone(); | | CheckActionCountIfNotDone(); | |
| } | | } | |
| | | | |
|
| // Implements the .WithArguments() clause. | | // Implements the .With() clause. | |
| Expectation& WithArguments(const Matcher<const ArgumentTuple&>& m) { | | TypedExpectation& With(const Matcher<const ArgumentTuple&>& m) { | |
| if (last_clause_ == WITH_ARGUMENTS) { | | if (last_clause_ == kWith) { | |
| ExpectSpecProperty(false, | | ExpectSpecProperty(false, | |
|
| ".WithArguments() cannot appear " | | ".With() cannot appear " | |
| "more than once in an EXPECT_CALL()."); | | "more than once in an EXPECT_CALL()."); | |
| } else { | | } else { | |
|
| ExpectSpecProperty(last_clause_ < WITH_ARGUMENTS, | | ExpectSpecProperty(last_clause_ < kWith, | |
| ".WithArguments() must be the first " | | ".With() must be the first " | |
| "clause in an EXPECT_CALL()."); | | "clause in an EXPECT_CALL()."); | |
| } | | } | |
|
| last_clause_ = WITH_ARGUMENTS; | | last_clause_ = kWith; | |
| | | | |
| extra_matcher_ = m; | | extra_matcher_ = m; | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| // Implements the .Times() clause. | | // Implements the .Times() clause. | |
|
| Expectation& Times(const Cardinality& cardinality) { | | TypedExpectation& Times(const Cardinality& cardinality) { | |
| if (last_clause_ ==TIMES) { | | if (last_clause_ ==kTimes) { | |
| ExpectSpecProperty(false, | | ExpectSpecProperty(false, | |
| ".Times() cannot appear " | | ".Times() cannot appear " | |
| "more than once in an EXPECT_CALL()."); | | "more than once in an EXPECT_CALL()."); | |
| } else { | | } else { | |
|
| ExpectSpecProperty(last_clause_ < TIMES, | | ExpectSpecProperty(last_clause_ < kTimes, | |
| ".Times() cannot appear after " | | ".Times() cannot appear after " | |
| ".InSequence(), .WillOnce(), .WillRepeatedly(), " | | ".InSequence(), .WillOnce(), .WillRepeatedly(), " | |
| "or .RetiresOnSaturation()."); | | "or .RetiresOnSaturation()."); | |
| } | | } | |
|
| last_clause_ = TIMES; | | last_clause_ = kTimes; | |
| | | | |
| ExpectationBase::SpecifyCardinality(cardinality); | | ExpectationBase::SpecifyCardinality(cardinality); | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| // Implements the .Times() clause. | | // Implements the .Times() clause. | |
|
| Expectation& Times(int n) { | | TypedExpectation& Times(int n) { | |
| return Times(Exactly(n)); | | return Times(Exactly(n)); | |
| } | | } | |
| | | | |
| // Implements the .InSequence() clause. | | // Implements the .InSequence() clause. | |
|
| Expectation& InSequence(const Sequence& s) { | | TypedExpectation& InSequence(const Sequence& s) { | |
| ExpectSpecProperty(last_clause_ <= IN_SEQUENCE, | | ExpectSpecProperty(last_clause_ <= kInSequence, | |
| ".InSequence() cannot appear after .WillOnce()," | | ".InSequence() cannot appear after .After()," | |
| " .WillRepeatedly(), or " | | " .WillOnce(), .WillRepeatedly(), or " | |
| ".RetiresOnSaturation()."); | | ".RetiresOnSaturation()."); | |
|
| last_clause_ = IN_SEQUENCE; | | last_clause_ = kInSequence; | |
| | | | |
|
| s.AddExpectation(owner_->GetLinkedExpectationBase(this)); | | s.AddExpectation(GetHandle()); | |
| return *this; | | return *this; | |
| } | | } | |
|
| Expectation& InSequence(const Sequence& s1, const Sequence& s2) { | | TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2) { | |
| return InSequence(s1).InSequence(s2); | | return InSequence(s1).InSequence(s2); | |
| } | | } | |
|
| Expectation& InSequence(const Sequence& s1, const Sequence& s2, | | TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2, | |
| const Sequence& s3) { | | const Sequence& s3) { | |
| return InSequence(s1, s2).InSequence(s3); | | return InSequence(s1, s2).InSequence(s3); | |
| } | | } | |
|
| Expectation& InSequence(const Sequence& s1, const Sequence& s2, | | TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2, | |
| const Sequence& s3, const Sequence& s4) { | | const Sequence& s3, const Sequence& s4) { | |
| return InSequence(s1, s2, s3).InSequence(s4); | | return InSequence(s1, s2, s3).InSequence(s4); | |
| } | | } | |
|
| Expectation& InSequence(const Sequence& s1, const Sequence& s2, | | TypedExpectation& InSequence(const Sequence& s1, const Sequence& s2, | |
| const Sequence& s3, const Sequence& s4, | | const Sequence& s3, const Sequence& s4, | |
| const Sequence& s5) { | | const Sequence& s5) { | |
| return InSequence(s1, s2, s3, s4).InSequence(s5); | | return InSequence(s1, s2, s3, s4).InSequence(s5); | |
| } | | } | |
| | | | |
|
| | | // Implements that .After() clause. | |
| | | TypedExpectation& After(const ExpectationSet& s) { | |
| | | ExpectSpecProperty(last_clause_ <= kAfter, | |
| | | ".After() cannot appear after .WillOnce()," | |
| | | " .WillRepeatedly(), or " | |
| | | ".RetiresOnSaturation()."); | |
| | | last_clause_ = kAfter; | |
| | | | |
| | | for (ExpectationSet::const_iterator it = s.begin(); it != s.end(); ++it | |
| | | ) { | |
| | | immediate_prerequisites_ += *it; | |
| | | } | |
| | | return *this; | |
| | | } | |
| | | TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s | |
| | | 2) { | |
| | | return After(s1).After(s2); | |
| | | } | |
| | | TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s | |
| | | 2, | |
| | | const ExpectationSet& s3) { | |
| | | return After(s1, s2).After(s3); | |
| | | } | |
| | | TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s | |
| | | 2, | |
| | | const ExpectationSet& s3, const ExpectationSet& s | |
| | | 4) { | |
| | | return After(s1, s2, s3).After(s4); | |
| | | } | |
| | | TypedExpectation& After(const ExpectationSet& s1, const ExpectationSet& s | |
| | | 2, | |
| | | const ExpectationSet& s3, const ExpectationSet& s | |
| | | 4, | |
| | | const ExpectationSet& s5) { | |
| | | return After(s1, s2, s3, s4).After(s5); | |
| | | } | |
| | | | |
| // Implements the .WillOnce() clause. | | // Implements the .WillOnce() clause. | |
|
| Expectation& WillOnce(const Action<F>& action) { | | TypedExpectation& WillOnce(const Action<F>& action) { | |
| ExpectSpecProperty(last_clause_ <= WILL_ONCE, | | ExpectSpecProperty(last_clause_ <= kWillOnce, | |
| ".WillOnce() cannot appear after " | | ".WillOnce() cannot appear after " | |
| ".WillRepeatedly() or .RetiresOnSaturation()."); | | ".WillRepeatedly() or .RetiresOnSaturation()."); | |
|
| last_clause_ = WILL_ONCE; | | last_clause_ = kWillOnce; | |
| | | | |
| actions_.push_back(action); | | actions_.push_back(action); | |
| if (!cardinality_specified()) { | | if (!cardinality_specified()) { | |
| set_cardinality(Exactly(static_cast<int>(actions_.size()))); | | set_cardinality(Exactly(static_cast<int>(actions_.size()))); | |
| } | | } | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| // Implements the .WillRepeatedly() clause. | | // Implements the .WillRepeatedly() clause. | |
|
| Expectation& WillRepeatedly(const Action<F>& action) { | | TypedExpectation& WillRepeatedly(const Action<F>& action) { | |
| if (last_clause_ == WILL_REPEATEDLY) { | | if (last_clause_ == kWillRepeatedly) { | |
| ExpectSpecProperty(false, | | ExpectSpecProperty(false, | |
| ".WillRepeatedly() cannot appear " | | ".WillRepeatedly() cannot appear " | |
| "more than once in an EXPECT_CALL()."); | | "more than once in an EXPECT_CALL()."); | |
| } else { | | } else { | |
|
| ExpectSpecProperty(last_clause_ < WILL_REPEATEDLY, | | ExpectSpecProperty(last_clause_ < kWillRepeatedly, | |
| ".WillRepeatedly() cannot appear " | | ".WillRepeatedly() cannot appear " | |
| "after .RetiresOnSaturation()."); | | "after .RetiresOnSaturation()."); | |
| } | | } | |
|
| last_clause_ = WILL_REPEATEDLY; | | last_clause_ = kWillRepeatedly; | |
| repeated_action_specified_ = true; | | repeated_action_specified_ = true; | |
| | | | |
| repeated_action_ = action; | | repeated_action_ = action; | |
| if (!cardinality_specified()) { | | if (!cardinality_specified()) { | |
| set_cardinality(AtLeast(static_cast<int>(actions_.size()))); | | set_cardinality(AtLeast(static_cast<int>(actions_.size()))); | |
| } | | } | |
| | | | |
| // Now that no more action clauses can be specified, we check | | // Now that no more action clauses can be specified, we check | |
| // whether their count makes sense. | | // whether their count makes sense. | |
| CheckActionCountIfNotDone(); | | CheckActionCountIfNotDone(); | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| // Implements the .RetiresOnSaturation() clause. | | // Implements the .RetiresOnSaturation() clause. | |
|
| Expectation& RetiresOnSaturation() { | | TypedExpectation& RetiresOnSaturation() { | |
| ExpectSpecProperty(last_clause_ < RETIRES_ON_SATURATION, | | ExpectSpecProperty(last_clause_ < kRetiresOnSaturation, | |
| ".RetiresOnSaturation() cannot appear " | | ".RetiresOnSaturation() cannot appear " | |
| "more than once."); | | "more than once."); | |
|
| last_clause_ = RETIRES_ON_SATURATION; | | last_clause_ = kRetiresOnSaturation; | |
| retires_on_saturation_ = true; | | retires_on_saturation_ = true; | |
| | | | |
| // Now that no more action clauses can be specified, we check | | // Now that no more action clauses can be specified, we check | |
| // whether their count makes sense. | | // whether their count makes sense. | |
| CheckActionCountIfNotDone(); | | CheckActionCountIfNotDone(); | |
| return *this; | | return *this; | |
| } | | } | |
| | | | |
| // Returns the matchers for the arguments as specified inside the | | // Returns the matchers for the arguments as specified inside the | |
| // EXPECT_CALL() macro. | | // EXPECT_CALL() macro. | |
| const ArgumentMatcherTuple& matchers() const { | | const ArgumentMatcherTuple& matchers() const { | |
| return matchers_; | | return matchers_; | |
| } | | } | |
| | | | |
|
| // Returns the matcher specified by the .WithArguments() clause. | | // Returns the matcher specified by the .With() clause. | |
| const Matcher<const ArgumentTuple&>& extra_matcher() const { | | const Matcher<const ArgumentTuple&>& extra_matcher() const { | |
| return extra_matcher_; | | return extra_matcher_; | |
| } | | } | |
| | | | |
| // Returns the sequence of actions specified by the .WillOnce() clause. | | // Returns the sequence of actions specified by the .WillOnce() clause. | |
| const std::vector<Action<F> >& actions() const { return actions_; } | | const std::vector<Action<F> >& actions() const { return actions_; } | |
| | | | |
| // Returns the action specified by the .WillRepeatedly() clause. | | // Returns the action specified by the .WillRepeatedly() clause. | |
| const Action<F>& repeated_action() const { return repeated_action_; } | | const Action<F>& repeated_action() const { return repeated_action_; } | |
| | | | |
| | | | |
| skipping to change at line 747 | | skipping to change at line 944 | |
| *os << " - " << (IsOverSaturated() ? "over-saturated" : | | *os << " - " << (IsOverSaturated() ? "over-saturated" : | |
| IsSaturated() ? "saturated" : | | IsSaturated() ? "saturated" : | |
| IsSatisfied() ? "satisfied" : "unsatisfied") | | IsSatisfied() ? "satisfied" : "unsatisfied") | |
| << " and " | | << " and " | |
| << (is_retired() ? "retired" : "active"); | | << (is_retired() ? "retired" : "active"); | |
| } | | } | |
| private: | | private: | |
| template <typename Function> | | template <typename Function> | |
| friend class FunctionMockerBase; | | friend class FunctionMockerBase; | |
| | | | |
|
| template <typename R, typename Function> | | // Returns an Expectation object that references and co-owns this | |
| friend class InvokeWithHelper; | | // expectation. | |
| | | virtual Expectation GetHandle() { | |
| | | return owner_->GetHandleOf(this); | |
| | | } | |
| | | | |
| // The following methods will be called only after the EXPECT_CALL() | | // The following methods will be called only after the EXPECT_CALL() | |
| // statement finishes and when the current thread holds | | // statement finishes and when the current thread holds | |
| // g_gmock_mutex. | | // g_gmock_mutex. | |
| | | | |
| // Returns true iff this expectation matches the given arguments. | | // Returns true iff this expectation matches the given arguments. | |
| // L >= g_gmock_mutex | | // L >= g_gmock_mutex | |
| bool Matches(const ArgumentTuple& args) const { | | bool Matches(const ArgumentTuple& args) const { | |
| g_gmock_mutex.AssertHeld(); | | g_gmock_mutex.AssertHeld(); | |
| return TupleMatches(matchers_, args) && extra_matcher_.Matches(args); | | return TupleMatches(matchers_, args) && extra_matcher_.Matches(args); | |
| | | | |
| skipping to change at line 789 | | skipping to change at line 989 | |
| g_gmock_mutex.AssertHeld(); | | g_gmock_mutex.AssertHeld(); | |
| | | | |
| if (is_retired()) { | | if (is_retired()) { | |
| *os << " Expected: the expectation is active\n" | | *os << " Expected: the expectation is active\n" | |
| << " Actual: it is retired\n"; | | << " Actual: it is retired\n"; | |
| } else if (!Matches(args)) { | | } else if (!Matches(args)) { | |
| if (!TupleMatches(matchers_, args)) { | | if (!TupleMatches(matchers_, args)) { | |
| DescribeMatchFailureTupleTo(matchers_, args, os); | | DescribeMatchFailureTupleTo(matchers_, args, os); | |
| } | | } | |
| if (!extra_matcher_.Matches(args)) { | | if (!extra_matcher_.Matches(args)) { | |
|
| *os << " Expected: "; | | *os << " Expected args: "; | |
| extra_matcher_.DescribeTo(os); | | extra_matcher_.DescribeTo(os); | |
|
| *os << "\n Actual: false"; | | *os << "\n Actual: don't match"; | |
| | | | |
| internal::ExplainMatchResultAsNeededTo<const ArgumentTuple&>( | | internal::ExplainMatchResultAsNeededTo<const ArgumentTuple&>( | |
| extra_matcher_, args, os); | | extra_matcher_, args, os); | |
| *os << "\n"; | | *os << "\n"; | |
| } | | } | |
| } else if (!AllPrerequisitesAreSatisfied()) { | | } else if (!AllPrerequisitesAreSatisfied()) { | |
| *os << " Expected: all pre-requisites are satisfied\n" | | *os << " Expected: all pre-requisites are satisfied\n" | |
| << " Actual: the following immediate pre-requisites " | | << " Actual: the following immediate pre-requisites " | |
| << "are not satisfied:\n"; | | << "are not satisfied:\n"; | |
|
| ExpectationBaseSet unsatisfied_prereqs; | | ExpectationSet unsatisfied_prereqs; | |
| FindUnsatisfiedPrerequisites(&unsatisfied_prereqs); | | FindUnsatisfiedPrerequisites(&unsatisfied_prereqs); | |
| int i = 0; | | int i = 0; | |
|
| for (ExpectationBaseSet::const_iterator it = unsatisfied_prereqs.begi
n(); | | for (ExpectationSet::const_iterator it = unsatisfied_prereqs.begin(); | |
| it != unsatisfied_prereqs.end(); ++it) { | | it != unsatisfied_prereqs.end(); ++it) { | |
|
| (*it)->DescribeLocationTo(os); | | it->expectation_base()->DescribeLocationTo(os); | |
| *os << "pre-requisite #" << i++ << "\n"; | | *os << "pre-requisite #" << i++ << "\n"; | |
| } | | } | |
| *os << " (end of pre-requisites)\n"; | | *os << " (end of pre-requisites)\n"; | |
| } else { | | } else { | |
| // This line is here just for completeness' sake. It will never | | // This line is here just for completeness' sake. It will never | |
| // be executed as currently the DescribeMatchResultTo() function | | // be executed as currently the DescribeMatchResultTo() function | |
| // is called only when the mock function call does NOT match the | | // is called only when the mock function call does NOT match the | |
| // expectation. | | // expectation. | |
| *os << "The call matches the expectation.\n"; | | *os << "The call matches the expectation.\n"; | |
| } | | } | |
| | | | |
| skipping to change at line 951 | | skipping to change at line 1151 | |
| FunctionMockerBase<F>* const owner_; | | FunctionMockerBase<F>* const owner_; | |
| ArgumentMatcherTuple matchers_; | | ArgumentMatcherTuple matchers_; | |
| Matcher<const ArgumentTuple&> extra_matcher_; | | Matcher<const ArgumentTuple&> extra_matcher_; | |
| std::vector<Action<F> > actions_; | | std::vector<Action<F> > actions_; | |
| bool repeated_action_specified_; // True if a WillRepeatedly() was speci
fied. | | bool repeated_action_specified_; // True if a WillRepeatedly() was speci
fied. | |
| Action<F> repeated_action_; | | Action<F> repeated_action_; | |
| bool retires_on_saturation_; | | bool retires_on_saturation_; | |
| Clause last_clause_; | | Clause last_clause_; | |
| mutable bool action_count_checked_; // Under mutex_. | | mutable bool action_count_checked_; // Under mutex_. | |
| mutable Mutex mutex_; // Protects action_count_checked_. | | mutable Mutex mutex_; // Protects action_count_checked_. | |
|
| }; // class Expectation | | }; // class TypedExpectation | |
| | | | |
| // A MockSpec object is used by ON_CALL() or EXPECT_CALL() for | | // A MockSpec object is used by ON_CALL() or EXPECT_CALL() for | |
| // specifying the default behavior of, or expectation on, a mock | | // specifying the default behavior of, or expectation on, a mock | |
| // function. | | // function. | |
| | | | |
| // Note: class MockSpec really belongs to the ::testing namespace. | | // Note: class MockSpec really belongs to the ::testing namespace. | |
| // However if we define it in ::testing, MSVC will complain when | | // However if we define it in ::testing, MSVC will complain when | |
| // classes in ::testing::internal declare it as a friend class | | // classes in ::testing::internal declare it as a friend class | |
| // template. To workaround this compiler bug, we define MockSpec in | | // template. To workaround this compiler bug, we define MockSpec in | |
| // ::testing::internal and import it into ::testing. | | // ::testing::internal and import it into ::testing. | |
| | | | |
| skipping to change at line 986 | | skipping to change at line 1186 | |
| // the newly created spec. | | // the newly created spec. | |
| internal::DefaultActionSpec<F>& InternalDefaultActionSetAt( | | internal::DefaultActionSpec<F>& InternalDefaultActionSetAt( | |
| const char* file, int line, const char* obj, const char* call) { | | const char* file, int line, const char* obj, const char* call) { | |
| LogWithLocation(internal::INFO, file, line, | | LogWithLocation(internal::INFO, file, line, | |
| string("ON_CALL(") + obj + ", " + call + ") invoked"); | | string("ON_CALL(") + obj + ", " + call + ") invoked"); | |
| return function_mocker_->AddNewDefaultActionSpec(file, line, matchers_)
; | | return function_mocker_->AddNewDefaultActionSpec(file, line, matchers_)
; | |
| } | | } | |
| | | | |
| // Adds a new expectation spec to the function mocker and returns | | // Adds a new expectation spec to the function mocker and returns | |
| // the newly created spec. | | // the newly created spec. | |
|
| internal::Expectation<F>& InternalExpectedAt( | | internal::TypedExpectation<F>& InternalExpectedAt( | |
| const char* file, int line, const char* obj, const char* call) { | | const char* file, int line, const char* obj, const char* call) { | |
| LogWithLocation(internal::INFO, file, line, | | LogWithLocation(internal::INFO, file, line, | |
| string("EXPECT_CALL(") + obj + ", " + call + ") invoked"); | | string("EXPECT_CALL(") + obj + ", " + call + ") invoked"); | |
| return function_mocker_->AddNewExpectation(file, line, matchers_); | | return function_mocker_->AddNewExpectation(file, line, matchers_); | |
| } | | } | |
| | | | |
| private: | | private: | |
| template <typename Function> | | template <typename Function> | |
| friend class internal::FunctionMocker; | | friend class internal::FunctionMocker; | |
| | | | |
| | | | |
| skipping to change at line 1026 | | skipping to change at line 1226 | |
| // MSVC warns about using 'this' in base member initializer list, so | | // MSVC warns about using 'this' in base member initializer list, so | |
| // we need to temporarily disable the warning. We have to do it for | | // we need to temporarily disable the warning. We have to do it for | |
| // the entire class to suppress the warning, even though it's about | | // the entire class to suppress the warning, even though it's about | |
| // the constructor only. | | // the constructor only. | |
| | | | |
| #ifdef _MSC_VER | | #ifdef _MSC_VER | |
| #pragma warning(push) // Saves the current warning state. | | #pragma warning(push) // Saves the current warning state. | |
| #pragma warning(disable:4355) // Temporarily disables warning 4355. | | #pragma warning(disable:4355) // Temporarily disables warning 4355. | |
| #endif // _MSV_VER | | #endif // _MSV_VER | |
| | | | |
|
| | | // C++ treats the void type specially. For example, you cannot define | |
| | | // a void-typed variable or pass a void value to a function. | |
| | | // ActionResultHolder<T> holds a value of type T, where T must be a | |
| | | // copyable type or void (T doesn't need to be default-constructable). | |
| | | // It hides the syntactic difference between void and other types, and | |
| | | // is used to unify the code for invoking both void-returning and | |
| | | // non-void-returning mock functions. This generic definition is used | |
| | | // when T is not void. | |
| | | template <typename T> | |
| | | class ActionResultHolder { | |
| | | public: | |
| | | explicit ActionResultHolder(T value) : value_(value) {} | |
| | | | |
| | | // The compiler-generated copy constructor and assignment operator | |
| | | // are exactly what we need, so we don't need to define them. | |
| | | | |
| | | T value() const { return value_; } | |
| | | | |
| | | // Prints the held value as an action's result to os. | |
| | | void PrintAsActionResult(::std::ostream* os) const { | |
| | | *os << "\n Returns: "; | |
| | | UniversalPrinter<T>::Print(value_, os); | |
| | | } | |
| | | | |
| | | // Performs the given mock function's default action and returns the | |
| | | // result in a ActionResultHolder. | |
| | | template <typename Function, typename Arguments> | |
| | | static ActionResultHolder PerformDefaultAction( | |
| | | const FunctionMockerBase<Function>* func_mocker, | |
| | | const Arguments& args, | |
| | | const string& call_description) { | |
| | | return ActionResultHolder( | |
| | | func_mocker->PerformDefaultAction(args, call_description)); | |
| | | } | |
| | | | |
| | | // Performs the given action and returns the result in a | |
| | | // ActionResultHolder. | |
| | | template <typename Function, typename Arguments> | |
| | | static ActionResultHolder PerformAction(const Action<Function>& action, | |
| | | const Arguments& args) { | |
| | | return ActionResultHolder(action.Perform(args)); | |
| | | } | |
| | | | |
| | | private: | |
| | | T value_; | |
| | | }; | |
| | | | |
| | | // Specialization for T = void. | |
| | | template <> | |
| | | class ActionResultHolder<void> { | |
| | | public: | |
| | | ActionResultHolder() {} | |
| | | void value() const {} | |
| | | void PrintAsActionResult(::std::ostream* /* os */) const {} | |
| | | | |
| | | template <typename Function, typename Arguments> | |
| | | static ActionResultHolder PerformDefaultAction( | |
| | | const FunctionMockerBase<Function>* func_mocker, | |
| | | const Arguments& args, | |
| | | const string& call_description) { | |
| | | func_mocker->PerformDefaultAction(args, call_description); | |
| | | return ActionResultHolder(); | |
| | | } | |
| | | | |
| | | template <typename Function, typename Arguments> | |
| | | static ActionResultHolder PerformAction(const Action<Function>& action, | |
| | | const Arguments& args) { | |
| | | action.Perform(args); | |
| | | return ActionResultHolder(); | |
| | | } | |
| | | }; | |
| | | | |
| // The base of the function mocker class for the given function type. | | // The base of the function mocker class for the given function type. | |
| // We put the methods in this class instead of its child to avoid code | | // We put the methods in this class instead of its child to avoid code | |
| // bloat. | | // bloat. | |
| template <typename F> | | template <typename F> | |
| class FunctionMockerBase : public UntypedFunctionMockerBase { | | class FunctionMockerBase : public UntypedFunctionMockerBase { | |
| public: | | public: | |
| typedef typename Function<F>::Result Result; | | typedef typename Function<F>::Result Result; | |
| typedef typename Function<F>::ArgumentTuple ArgumentTuple; | | typedef typename Function<F>::ArgumentTuple ArgumentTuple; | |
| typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple; | | typedef typename Function<F>::ArgumentMatcherTuple ArgumentMatcherTuple; | |
| | | | |
| | | | |
| skipping to change at line 1084 | | skipping to change at line 1356 | |
| } | | } | |
| Assert(DefaultValue<Result>::Exists(), "", -1, | | Assert(DefaultValue<Result>::Exists(), "", -1, | |
| call_description + "\n The mock function has no default actio
n " | | call_description + "\n The mock function has no default actio
n " | |
| "set, and its return type has no default value set."); | | "set, and its return type has no default value set."); | |
| return DefaultValue<Result>::Get(); | | return DefaultValue<Result>::Get(); | |
| } | | } | |
| | | | |
| // Registers this function mocker and the mock object owning it; | | // Registers this function mocker and the mock object owning it; | |
| // returns a reference to the function mocker object. This is only | | // returns a reference to the function mocker object. This is only | |
| // called by the ON_CALL() and EXPECT_CALL() macros. | | // called by the ON_CALL() and EXPECT_CALL() macros. | |
|
| | | // L < g_gmock_mutex | |
| FunctionMocker<F>& RegisterOwner(const void* mock_obj) { | | FunctionMocker<F>& RegisterOwner(const void* mock_obj) { | |
|
| | | { | |
| | | MutexLock l(&g_gmock_mutex); | |
| | | mock_obj_ = mock_obj; | |
| | | } | |
| Mock::Register(mock_obj, this); | | Mock::Register(mock_obj, this); | |
|
| return *down_cast<FunctionMocker<F>*>(this); | | return *::testing::internal::down_cast<FunctionMocker<F>*>(this); | |
| } | | } | |
| | | | |
| // The following two functions are from UntypedFunctionMockerBase. | | // The following two functions are from UntypedFunctionMockerBase. | |
| | | | |
| // Verifies that all expectations on this mock function have been | | // Verifies that all expectations on this mock function have been | |
| // satisfied. Reports one or more Google Test non-fatal failures | | // satisfied. Reports one or more Google Test non-fatal failures | |
| // and returns false if not. | | // and returns false if not. | |
| // L >= g_gmock_mutex | | // L >= g_gmock_mutex | |
| virtual bool VerifyAndClearExpectationsLocked(); | | virtual bool VerifyAndClearExpectationsLocked(); | |
| | | | |
| | | | |
| skipping to change at line 1146 | | skipping to change at line 1423 | |
| // function is called from two threads concurrently. | | // function is called from two threads concurrently. | |
| MutexLock l(&g_gmock_mutex); | | MutexLock l(&g_gmock_mutex); | |
| name = name_; | | name = name_; | |
| } | | } | |
| return name; | | return name; | |
| } | | } | |
| protected: | | protected: | |
| template <typename Function> | | template <typename Function> | |
| friend class MockSpec; | | friend class MockSpec; | |
| | | | |
|
| template <typename R, typename Function> | | | |
| friend class InvokeWithHelper; | | | |
| | | | |
| // Returns the result of invoking this mock function with the given | | // Returns the result of invoking this mock function with the given | |
| // arguments. This function can be safely called from multiple | | // arguments. This function can be safely called from multiple | |
| // threads concurrently. | | // threads concurrently. | |
| // L < g_gmock_mutex | | // L < g_gmock_mutex | |
|
| Result InvokeWith(const ArgumentTuple& args) { | | Result InvokeWith(const ArgumentTuple& args); | |
| return InvokeWithHelper<Result, F>::InvokeAndPrintResult(this, args); | | | |
| } | | | |
| | | | |
| // Adds and returns a default action spec for this mock function. | | // Adds and returns a default action spec for this mock function. | |
|
| | | // L < g_gmock_mutex | |
| DefaultActionSpec<F>& AddNewDefaultActionSpec( | | DefaultActionSpec<F>& AddNewDefaultActionSpec( | |
| const char* file, int line, | | const char* file, int line, | |
| const ArgumentMatcherTuple& m) { | | const ArgumentMatcherTuple& m) { | |
|
| | | Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line); | |
| default_actions_.push_back(DefaultActionSpec<F>(file, line, m)); | | default_actions_.push_back(DefaultActionSpec<F>(file, line, m)); | |
| return default_actions_.back(); | | return default_actions_.back(); | |
| } | | } | |
| | | | |
| // Adds and returns an expectation spec for this mock function. | | // Adds and returns an expectation spec for this mock function. | |
|
| Expectation<F>& AddNewExpectation( | | // L < g_gmock_mutex | |
| | | TypedExpectation<F>& AddNewExpectation( | |
| const char* file, int line, | | const char* file, int line, | |
| const ArgumentMatcherTuple& m) { | | const ArgumentMatcherTuple& m) { | |
|
| const linked_ptr<Expectation<F> > expectation( | | Mock::RegisterUseByOnCallOrExpectCall(MockObject(), file, line); | |
| new Expectation<F>(this, file, line, m)); | | const linked_ptr<TypedExpectation<F> > expectation( | |
| | | new TypedExpectation<F>(this, file, line, m)); | |
| expectations_.push_back(expectation); | | expectations_.push_back(expectation); | |
| | | | |
| // Adds this expectation into the implicit sequence if there is one. | | // Adds this expectation into the implicit sequence if there is one. | |
| Sequence* const implicit_sequence = g_gmock_implicit_sequence.get(); | | Sequence* const implicit_sequence = g_gmock_implicit_sequence.get(); | |
| if (implicit_sequence != NULL) { | | if (implicit_sequence != NULL) { | |
|
| implicit_sequence->AddExpectation(expectation); | | implicit_sequence->AddExpectation(Expectation(expectation)); | |
| } | | } | |
| | | | |
| return *expectation; | | return *expectation; | |
| } | | } | |
| | | | |
| // The current spec (either default action spec or expectation spec) | | // The current spec (either default action spec or expectation spec) | |
| // being described on this function mocker. | | // being described on this function mocker. | |
| MockSpec<F>& current_spec() { return current_spec_; } | | MockSpec<F>& current_spec() { return current_spec_; } | |
| private: | | private: | |
|
| template <typename Func> friend class Expectation; | | template <typename Func> friend class TypedExpectation; | |
| | | | |
|
| typedef std::vector<internal::linked_ptr<Expectation<F> > > Expectations; | | typedef std::vector<internal::linked_ptr<TypedExpectation<F> > > | |
| | | TypedExpectations; | |
| | | | |
|
| // Gets the internal::linked_ptr<ExpectationBase> object that co-owns 'ex | | // Returns an Expectation object that references and co-owns exp, | |
| p'. | | // which must be an expectation on this mock function. | |
| internal::linked_ptr<ExpectationBase> GetLinkedExpectationBase( | | Expectation GetHandleOf(TypedExpectation<F>* exp) { | |
| Expectation<F>* exp) { | | for (typename TypedExpectations::const_iterator it = expectations_.begi | |
| for (typename Expectations::const_iterator it = expectations_.begin(); | | n(); | |
| it != expectations_.end(); ++it) { | | it != expectations_.end(); ++it) { | |
| if (it->get() == exp) { | | if (it->get() == exp) { | |
|
| return *it; | | return Expectation(*it); | |
| } | | } | |
| } | | } | |
| | | | |
| Assert(false, __FILE__, __LINE__, "Cannot find expectation."); | | Assert(false, __FILE__, __LINE__, "Cannot find expectation."); | |
|
| return internal::linked_ptr<ExpectationBase>(NULL); | | return Expectation(); | |
| // The above statement is just to make the code compile, and will | | // The above statement is just to make the code compile, and will | |
| // never be executed. | | // never be executed. | |
| } | | } | |
| | | | |
| // Some utilities needed for implementing InvokeWith(). | | // Some utilities needed for implementing InvokeWith(). | |
| | | | |
| // Describes what default action will be performed for the given | | // Describes what default action will be performed for the given | |
| // arguments. | | // arguments. | |
| // L = * | | // L = * | |
| void DescribeDefaultActionTo(const ArgumentTuple& args, | | void DescribeDefaultActionTo(const ArgumentTuple& args, | |
| | | | |
| skipping to change at line 1248 | | skipping to change at line 1525 | |
| // corresponding action that needs to be taken in an ATOMIC | | // corresponding action that needs to be taken in an ATOMIC | |
| // transaction. Otherwise another thread may call this mock | | // transaction. Otherwise another thread may call this mock | |
| // method in the middle and mess up the state. | | // method in the middle and mess up the state. | |
| // | | // | |
| // However, performing the action has to be left out of the critical | | // However, performing the action has to be left out of the critical | |
| // section. The reason is that we have no control on what the | | // section. The reason is that we have no control on what the | |
| // action does (it can invoke an arbitrary user function or even a | | // action does (it can invoke an arbitrary user function or even a | |
| // mock function) and excessive locking could cause a dead lock. | | // mock function) and excessive locking could cause a dead lock. | |
| // L < g_gmock_mutex | | // L < g_gmock_mutex | |
| bool FindMatchingExpectationAndAction( | | bool FindMatchingExpectationAndAction( | |
|
| const ArgumentTuple& args, Expectation<F>** exp, Action<F>* action, | | const ArgumentTuple& args, TypedExpectation<F>** exp, Action<F>* acti
on, | |
| bool* is_excessive, ::std::ostream* what, ::std::ostream* why) { | | bool* is_excessive, ::std::ostream* what, ::std::ostream* why) { | |
| MutexLock l(&g_gmock_mutex); | | MutexLock l(&g_gmock_mutex); | |
| *exp = this->FindMatchingExpectationLocked(args); | | *exp = this->FindMatchingExpectationLocked(args); | |
| if (*exp == NULL) { // A match wasn't found. | | if (*exp == NULL) { // A match wasn't found. | |
| *action = DoDefault(); | | *action = DoDefault(); | |
| this->FormatUnexpectedCallMessageLocked(args, what, why); | | this->FormatUnexpectedCallMessageLocked(args, what, why); | |
| return false; | | return false; | |
| } | | } | |
| | | | |
| // This line must be done before calling GetActionForArguments(), | | // This line must be done before calling GetActionForArguments(), | |
| // which will increment the call count for *exp and thus affect | | // which will increment the call count for *exp and thus affect | |
| // its saturation status. | | // its saturation status. | |
| *is_excessive = (*exp)->IsSaturated(); | | *is_excessive = (*exp)->IsSaturated(); | |
| *action = (*exp)->GetActionForArguments(this, args, what, why); | | *action = (*exp)->GetActionForArguments(this, args, what, why); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
| // Returns the expectation that matches the arguments, or NULL if no | | // Returns the expectation that matches the arguments, or NULL if no | |
| // expectation matches them. | | // expectation matches them. | |
| // L >= g_gmock_mutex | | // L >= g_gmock_mutex | |
|
| Expectation<F>* FindMatchingExpectationLocked( | | TypedExpectation<F>* FindMatchingExpectationLocked( | |
| const ArgumentTuple& args) const { | | const ArgumentTuple& args) const { | |
| g_gmock_mutex.AssertHeld(); | | g_gmock_mutex.AssertHeld(); | |
|
| for (typename Expectations::const_reverse_iterator it = | | for (typename TypedExpectations::const_reverse_iterator it = | |
| expectations_.rbegin(); | | expectations_.rbegin(); | |
| it != expectations_.rend(); ++it) { | | it != expectations_.rend(); ++it) { | |
|
| Expectation<F>* const exp = it->get(); | | TypedExpectation<F>* const exp = it->get(); | |
| if (exp->ShouldHandleArguments(args)) { | | if (exp->ShouldHandleArguments(args)) { | |
| return exp; | | return exp; | |
| } | | } | |
| } | | } | |
| return NULL; | | return NULL; | |
| } | | } | |
| | | | |
| // Returns a message that the arguments don't match any expectation. | | // Returns a message that the arguments don't match any expectation. | |
| // L >= g_gmock_mutex | | // L >= g_gmock_mutex | |
| void FormatUnexpectedCallMessageLocked(const ArgumentTuple& args, | | void FormatUnexpectedCallMessageLocked(const ArgumentTuple& args, | |
| | | | |
| skipping to change at line 1317 | | skipping to change at line 1594 | |
| expectations_[i]->DescribeLocationTo(why); | | expectations_[i]->DescribeLocationTo(why); | |
| if (count > 1) { | | if (count > 1) { | |
| *why << "tried expectation #" << i; | | *why << "tried expectation #" << i; | |
| } | | } | |
| *why << "\n"; | | *why << "\n"; | |
| expectations_[i]->DescribeMatchResultTo(args, why); | | expectations_[i]->DescribeMatchResultTo(args, why); | |
| expectations_[i]->DescribeCallCountTo(why); | | expectations_[i]->DescribeCallCountTo(why); | |
| } | | } | |
| } | | } | |
| | | | |
|
| // Address of the mock object this mock method belongs to. | | // Address of the mock object this mock method belongs to. Only | |
| | | // valid after this mock method has been called or | |
| | | // ON_CALL/EXPECT_CALL has been invoked on it. | |
| const void* mock_obj_; // Protected by g_gmock_mutex. | | const void* mock_obj_; // Protected by g_gmock_mutex. | |
| | | | |
|
| // Name of the function being mocked. | | // Name of the function being mocked. Only valid after this mock | |
| | | // method has been called. | |
| const char* name_; // Protected by g_gmock_mutex. | | const char* name_; // Protected by g_gmock_mutex. | |
| | | | |
| // The current spec (either default action spec or expectation spec) | | // The current spec (either default action spec or expectation spec) | |
| // being described on this function mocker. | | // being described on this function mocker. | |
| MockSpec<F> current_spec_; | | MockSpec<F> current_spec_; | |
| | | | |
| // All default action specs for this function mocker. | | // All default action specs for this function mocker. | |
| std::vector<DefaultActionSpec<F> > default_actions_; | | std::vector<DefaultActionSpec<F> > default_actions_; | |
| // All expectations for this function mocker. | | // All expectations for this function mocker. | |
|
| Expectations expectations_; | | TypedExpectations expectations_; | |
| | | | |
| | | // There is no generally useful and implementable semantics of | |
| | | // copying a mock object, so copying a mock is usually a user error. | |
| | | // Thus we disallow copying function mockers. If the user really | |
| | | // wants to copy a mock object, he should implement his own copy | |
| | | // operation, for example: | |
| | | // | |
| | | // class MockFoo : public Foo { | |
| | | // public: | |
| | | // // Defines a copy constructor explicitly. | |
| | | // MockFoo(const MockFoo& src) {} | |
| | | // ... | |
| | | // }; | |
| | | GTEST_DISALLOW_COPY_AND_ASSIGN_(FunctionMockerBase); | |
| }; // class FunctionMockerBase | | }; // class FunctionMockerBase | |
| | | | |
| #ifdef _MSC_VER | | #ifdef _MSC_VER | |
| #pragma warning(pop) // Restores the warning state. | | #pragma warning(pop) // Restores the warning state. | |
| #endif // _MSV_VER | | #endif // _MSV_VER | |
| | | | |
| // Implements methods of FunctionMockerBase. | | // Implements methods of FunctionMockerBase. | |
| | | | |
| // Verifies that all expectations on this mock function have been | | // Verifies that all expectations on this mock function have been | |
| // satisfied. Reports one or more Google Test non-fatal failures and | | // satisfied. Reports one or more Google Test non-fatal failures and | |
| // returns false if not. | | // returns false if not. | |
| // L >= g_gmock_mutex | | // L >= g_gmock_mutex | |
| template <typename F> | | template <typename F> | |
| bool FunctionMockerBase<F>::VerifyAndClearExpectationsLocked() { | | bool FunctionMockerBase<F>::VerifyAndClearExpectationsLocked() { | |
| g_gmock_mutex.AssertHeld(); | | g_gmock_mutex.AssertHeld(); | |
| bool expectations_met = true; | | bool expectations_met = true; | |
|
| for (typename Expectations::const_iterator it = expectations_.begin(); | | for (typename TypedExpectations::const_iterator it = expectations_.begin(
); | |
| it != expectations_.end(); ++it) { | | it != expectations_.end(); ++it) { | |
|
| Expectation<F>* const exp = it->get(); | | TypedExpectation<F>* const exp = it->get(); | |
| | | | |
| if (exp->IsOverSaturated()) { | | if (exp->IsOverSaturated()) { | |
| // There was an upper-bound violation. Since the error was | | // There was an upper-bound violation. Since the error was | |
| // already reported when it occurred, there is no need to do | | // already reported when it occurred, there is no need to do | |
| // anything here. | | // anything here. | |
| expectations_met = false; | | expectations_met = false; | |
| } else if (!exp->IsSatisfied()) { | | } else if (!exp->IsSatisfied()) { | |
| expectations_met = false; | | expectations_met = false; | |
| ::std::stringstream ss; | | ::std::stringstream ss; | |
| ss << "Actual function call count doesn't match this expectation.\n"; | | ss << "Actual function call count doesn't match this expectation.\n"; | |
| | | | |
| skipping to change at line 1375 | | skipping to change at line 1669 | |
| } | | } | |
| } | | } | |
| expectations_.clear(); | | expectations_.clear(); | |
| return expectations_met; | | return expectations_met; | |
| } | | } | |
| | | | |
| // Reports an uninteresting call (whose description is in msg) in the | | // Reports an uninteresting call (whose description is in msg) in the | |
| // manner specified by 'reaction'. | | // manner specified by 'reaction'. | |
| void ReportUninterestingCall(CallReaction reaction, const string& msg); | | void ReportUninterestingCall(CallReaction reaction, const string& msg); | |
| | | | |
|
| // When an uninteresting or unexpected mock function is called, we | | // Calculates the result of invoking this mock function with the given | |
| // want to print its return value to assist the user debugging. Since | | // arguments, prints it, and returns it. | |
| // there's nothing to print when the function returns void, we need to | | // L < g_gmock_mutex | |
| // specialize the logic of FunctionMockerBase<F>::InvokeWith() for | | template <typename F> | |
| // void return values. | | typename Function<F>::Result FunctionMockerBase<F>::InvokeWith( | |
| // | | const typename Function<F>::ArgumentTuple& args) { | |
| // C++ doesn't allow us to specialize a member function template | | typedef ActionResultHolder<Result> ResultHolder; | |
| // unless we also specialize its enclosing class, so we had to let | | | |
| // InvokeWith() delegate its work to a helper class InvokeWithHelper, | | | |
| // which can then be specialized. | | | |
| // | | | |
| // Note that InvokeWithHelper must be a class template (as opposed to | | | |
| // a function template), as only class templates can be partially | | | |
| // specialized. | | | |
| template <typename Result, typename F> | | | |
| class InvokeWithHelper { | | | |
| public: | | | |
| typedef typename Function<F>::ArgumentTuple ArgumentTuple; | | | |
| | | | |
| // Calculates the result of invoking the function mocked by mocker | | | |
| // with the given arguments, prints it, and returns it. | | | |
| // L < g_gmock_mutex | | | |
| static Result InvokeAndPrintResult( | | | |
| FunctionMockerBase<F>* mocker, | | | |
| const ArgumentTuple& args) { | | | |
| if (mocker->expectations_.size() == 0) { | | | |
| // No expectation is set on this mock method - we have an | | | |
| // uninteresting call. | | | |
| | | | |
| // Warns about the uninteresting call. | | | |
| ::std::stringstream ss; | | | |
| mocker->DescribeUninterestingCall(args, &ss); | | | |
| | | | |
|
| // We must get Google Mock's reaction on uninteresting calls | | if (expectations_.size() == 0) { | |
| // made on this mock object BEFORE performing the action, | | // No expectation is set on this mock method - we have an | |
| // because the action may DELETE the mock object and make the | | // uninteresting call. | |
| // following expression meaningless. | | | |
| const CallReaction reaction = | | | |
| Mock::GetReactionOnUninterestingCalls(mocker->MockObject()); | | | |
| | | | |
|
| // Calculates the function result. | | // We must get Google Mock's reaction on uninteresting calls | |
| Result result = mocker->PerformDefaultAction(args, ss.str()); | | // made on this mock object BEFORE performing the action, | |
| | | // because the action may DELETE the mock object and make the | |
| | | // following expression meaningless. | |
| | | const CallReaction reaction = | |
| | | Mock::GetReactionOnUninterestingCalls(MockObject()); | |
| | | | |
|
| // Prints the function result. | | // True iff we need to print this call's arguments and return | |
| ss << "\n Returns: "; | | // value. This definition must be kept in sync with | |
| UniversalPrinter<Result>::Print(result, &ss); | | // the behavior of ReportUninterestingCall(). | |
| ReportUninterestingCall(reaction, ss.str()); | | const bool need_to_report_uninteresting_call = | |
| | | // If the user allows this uninteresting call, we print it | |
| | | // only when he wants informational messages. | |
| | | reaction == ALLOW ? LogIsVisible(INFO) : | |
| | | // If the user wants this to be a warning, we print it only | |
| | | // when he wants to see warnings. | |
| | | reaction == WARN ? LogIsVisible(WARNING) : | |
| | | // Otherwise, the user wants this to be an error, and we | |
| | | // should always print detailed information in the error. | |
| | | true; | |
| | | | |
|
| return result; | | if (!need_to_report_uninteresting_call) { | |
| | | // Perform the action without printing the call information. | |
| | | return PerformDefaultAction(args, ""); | |
| } | | } | |
| | | | |
|
| bool is_excessive = false; | | // Warns about the uninteresting call. | |
| ::std::stringstream ss; | | ::std::stringstream ss; | |
|
| ::std::stringstream why; | | DescribeUninterestingCall(args, &ss); | |
| ::std::stringstream loc; | | | |
| Action<F> action; | | | |
| Expectation<F>* exp; | | | |
| | | | |
|
| // The FindMatchingExpectationAndAction() function acquires and | | // Calculates the function result. | |
| // releases g_gmock_mutex. | | const ResultHolder result = | |
| const bool found = mocker->FindMatchingExpectationAndAction( | | ResultHolder::PerformDefaultAction(this, args, ss.str()); | |
| args, &exp, &action, &is_excessive, &ss, &why); | | | |
| ss << " Function call: " << mocker->Name(); | | | |
| UniversalPrinter<ArgumentTuple>::Print(args, &ss); | | | |
| // In case the action deletes a piece of the expectation, we | | | |
| // generate the message beforehand. | | | |
| if (found && !is_excessive) { | | | |
| exp->DescribeLocationTo(&loc); | | | |
| } | | | |
| Result result = action.IsDoDefault() ? | | | |
| mocker->PerformDefaultAction(args, ss.str()) | | | |
| : action.Perform(args); | | | |
| ss << "\n Returns: "; | | | |
| UniversalPrinter<Result>::Print(result, &ss); | | | |
| ss << "\n" << why.str(); | | | |
| | | | |
|
| if (found) { | | // Prints the function result. | |
| if (is_excessive) { | | result.PrintAsActionResult(&ss); | |
| // We had an upper-bound violation and the failure message is in ss | | | |
| . | | ReportUninterestingCall(reaction, ss.str()); | |
| Expect(false, exp->file(), exp->line(), ss.str()); | | return result.value(); | |
| } else { | | | |
| // We had an expected call and the matching expectation is | | | |
| // described in ss. | | | |
| Log(INFO, loc.str() + ss.str(), 3); | | | |
| } | | | |
| } else { | | | |
| // No expectation matches this call - reports a failure. | | | |
| Expect(false, NULL, -1, ss.str()); | | | |
| } | | | |
| return result; | | | |
| } | | } | |
|
| }; // class InvokeWithHelper | | | |
| | | | |
|
| // This specialization helps to implement | | bool is_excessive = false; | |
| // FunctionMockerBase<F>::InvokeWith() for void-returning functions. | | ::std::stringstream ss; | |
| template <typename F> | | ::std::stringstream why; | |
| class InvokeWithHelper<void, F> { | | ::std::stringstream loc; | |
| public: | | Action<F> action; | |
| typedef typename Function<F>::ArgumentTuple ArgumentTuple; | | TypedExpectation<F>* exp; | |
| | | | |
|
| // Invokes the function mocked by mocker with the given arguments. | | // The FindMatchingExpectationAndAction() function acquires and | |
| // L < g_gmock_mutex | | // releases g_gmock_mutex. | |
| static void InvokeAndPrintResult(FunctionMockerBase<F>* mocker, | | const bool found = FindMatchingExpectationAndAction( | |
| const ArgumentTuple& args) { | | args, &exp, &action, &is_excessive, &ss, &why); | |
| const int count = static_cast<int>(mocker->expectations_.size()); | | | |
| if (count == 0) { | | | |
| // No expectation is set on this mock method - we have an | | | |
| // uninteresting call. | | | |
| ::std::stringstream ss; | | | |
| mocker->DescribeUninterestingCall(args, &ss); | | | |
| | | | |
|
| // We must get Google Mock's reaction on uninteresting calls | | // True iff we need to print the call's arguments and return value. | |
| // made on this mock object BEFORE performing the action, | | // This definition must be kept in sync with the uses of Expect() | |
| // because the action may DELETE the mock object and make the | | // and Log() in this function. | |
| // following expression meaningless. | | const bool need_to_report_call = !found || is_excessive || LogIsVisible(I | |
| const CallReaction reaction = | | NFO); | |
| Mock::GetReactionOnUninterestingCalls(mocker->MockObject()); | | if (!need_to_report_call) { | |
| | | // Perform the action without printing the call information. | |
| | | return action.IsDoDefault() ? PerformDefaultAction(args, "") : | |
| | | action.Perform(args); | |
| | | } | |
| | | | |
|
| mocker->PerformDefaultAction(args, ss.str()); | | ss << " Function call: " << Name(); | |
| ReportUninterestingCall(reaction, ss.str()); | | UniversalPrinter<ArgumentTuple>::Print(args, &ss); | |
| return; | | | |
| } | | | |
| | | | |
|
| bool is_excessive = false; | | // In case the action deletes a piece of the expectation, we | |
| ::std::stringstream ss; | | // generate the message beforehand. | |
| ::std::stringstream why; | | if (found && !is_excessive) { | |
| ::std::stringstream loc; | | exp->DescribeLocationTo(&loc); | |
| Action<F> action; | | } | |
| Expectation<F>* exp; | | | |
| | | | |
|
| // The FindMatchingExpectationAndAction() function acquires and | | const ResultHolder result = action.IsDoDefault() ? | |
| // releases g_gmock_mutex. | | ResultHolder::PerformDefaultAction(this, args, ss.str()) : | |
| const bool found = mocker->FindMatchingExpectationAndAction( | | ResultHolder::PerformAction(action, args); | |
| args, &exp, &action, &is_excessive, &ss, &why); | | result.PrintAsActionResult(&ss); | |
| ss << " Function call: " << mocker->Name(); | | ss << "\n" << why.str(); | |
| UniversalPrinter<ArgumentTuple>::Print(args, &ss); | | | |
| ss << "\n" << why.str(); | | | |
| // In case the action deletes a piece of the expectation, we | | | |
| // generate the message beforehand. | | | |
| if (found && !is_excessive) { | | | |
| exp->DescribeLocationTo(&loc); | | | |
| } | | | |
| if (action.IsDoDefault()) { | | | |
| mocker->PerformDefaultAction(args, ss.str()); | | | |
| } else { | | | |
| action.Perform(args); | | | |
| } | | | |
| | | | |
|
| if (found) { | | if (!found) { | |
| // A matching expectation and corresponding action were found. | | // No expectation matches this call - reports a failure. | |
| if (is_excessive) { | | Expect(false, NULL, -1, ss.str()); | |
| // We had an upper-bound violation and the failure message is in ss | | } else if (is_excessive) { | |
| . | | // We had an upper-bound violation and the failure message is in ss. | |
| Expect(false, exp->file(), exp->line(), ss.str()); | | Expect(false, exp->file(), exp->line(), ss.str()); | |
| } else { | | } else { | |
| // We had an expected call and the matching expectation is | | // We had an expected call and the matching expectation is | |
| // described in ss. | | // described in ss. | |
| Log(INFO, loc.str() + ss.str(), 3); | | Log(INFO, loc.str() + ss.str(), 2); | |
| } | | | |
| } else { | | | |
| // No matching expectation was found - reports an error. | | | |
| Expect(false, NULL, -1, ss.str()); | | | |
| } | | | |
| } | | } | |
|
| }; // class InvokeWithHelper<void, F> | | return result.value(); | |
| | | } | |
| | | | |
| } // namespace internal | | } // namespace internal | |
| | | | |
| // The style guide prohibits "using" statements in a namespace scope | | // The style guide prohibits "using" statements in a namespace scope | |
| // inside a header file. However, the MockSpec class template is | | // inside a header file. However, the MockSpec class template is | |
| // meant to be defined in the ::testing namespace. The following line | | // meant to be defined in the ::testing namespace. The following line | |
| // is just a trick for working around a bug in MSVC 8.0, which cannot | | // is just a trick for working around a bug in MSVC 8.0, which cannot | |
| // handle it if we define MockSpec in ::testing. | | // handle it if we define MockSpec in ::testing. | |
| using internal::MockSpec; | | using internal::MockSpec; | |
| | | | |
| | | | |
| skipping to change at line 1567 | | skipping to change at line 1800 | |
| // }; | | // }; | |
| // | | // | |
| // MockFoo foo; | | // MockFoo foo; | |
| // // Expects a call to non-const MockFoo::Bar(). | | // // Expects a call to non-const MockFoo::Bar(). | |
| // EXPECT_CALL(foo, Bar()); | | // EXPECT_CALL(foo, Bar()); | |
| // // Expects a call to const MockFoo::Bar(). | | // // Expects a call to const MockFoo::Bar(). | |
| // EXPECT_CALL(Const(foo), Bar()); | | // EXPECT_CALL(Const(foo), Bar()); | |
| template <typename T> | | template <typename T> | |
| inline const T& Const(const T& x) { return x; } | | inline const T& Const(const T& x) { return x; } | |
| | | | |
|
| | | // Constructs an Expectation object that references and co-owns exp. | |
| | | inline Expectation::Expectation(internal::ExpectationBase& exp) // NOLINT | |
| | | : expectation_base_(exp.GetHandle().expectation_base()) {} | |
| | | | |
| } // namespace testing | | } // namespace testing | |
| | | | |
| // A separate macro is required to avoid compile errors when the name | | // A separate macro is required to avoid compile errors when the name | |
| // of the method used in call is a result of macro expansion. | | // of the method used in call is a result of macro expansion. | |
| // See CompilesWithMethodNameExpandedFromMacro tests in | | // See CompilesWithMethodNameExpandedFromMacro tests in | |
| // internal/gmock-spec-builders_test.cc for more details. | | // internal/gmock-spec-builders_test.cc for more details. | |
| #define GMOCK_ON_CALL_IMPL_(obj, call) \ | | #define GMOCK_ON_CALL_IMPL_(obj, call) \ | |
| ((obj).gmock_##call).InternalDefaultActionSetAt(__FILE__, __LINE__, \ | | ((obj).gmock_##call).InternalDefaultActionSetAt(__FILE__, __LINE__, \ | |
| #obj, #call) | | #obj, #call) | |
| #define ON_CALL(obj, call) GMOCK_ON_CALL_IMPL_(obj, call) | | #define ON_CALL(obj, call) GMOCK_ON_CALL_IMPL_(obj, call) | |
| | | | |
End of changes. 114 change blocks. |
| 296 lines changed or deleted | | 543 lines changed or added | |
|
| gtest-param-util-generated.h | | gtest-param-util-generated.h | |
| | | | |
| skipping to change at line 66 | | skipping to change at line 66 | |
| // Used in the Values() function to provide polymorphic capabilities. | | // Used in the Values() function to provide polymorphic capabilities. | |
| template <typename T1> | | template <typename T1> | |
| class ValueArray1 { | | class ValueArray1 { | |
| public: | | public: | |
| explicit ValueArray1(T1 v1) : v1_(v1) {} | | explicit ValueArray1(T1 v1) : v1_(v1) {} | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { return ValuesIn(&v1_, &v1_ + 1); } | | operator ParamGenerator<T>() const { return ValuesIn(&v1_, &v1_ + 1); } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray1& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| }; | | }; | |
| | | | |
| template <typename T1, typename T2> | | template <typename T1, typename T2> | |
| class ValueArray2 { | | class ValueArray2 { | |
| public: | | public: | |
| ValueArray2(T1 v1, T2 v2) : v1_(v1), v2_(v2) {} | | ValueArray2(T1 v1, T2 v2) : v1_(v1), v2_(v2) {} | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_}; | | const T array[] = {v1_, v2_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray2& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| }; | | }; | |
| | | | |
| template <typename T1, typename T2, typename T3> | | template <typename T1, typename T2, typename T3> | |
| class ValueArray3 { | | class ValueArray3 { | |
| public: | | public: | |
| ValueArray3(T1 v1, T2 v2, T3 v3) : v1_(v1), v2_(v2), v3_(v3) {} | | ValueArray3(T1 v1, T2 v2, T3 v3) : v1_(v1), v2_(v2), v3_(v3) {} | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_}; | | const T array[] = {v1_, v2_, v3_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray3& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| }; | | }; | |
| | | | |
| template <typename T1, typename T2, typename T3, typename T4> | | template <typename T1, typename T2, typename T3, typename T4> | |
| class ValueArray4 { | | class ValueArray4 { | |
| public: | | public: | |
| ValueArray4(T1 v1, T2 v2, T3 v3, T4 v4) : v1_(v1), v2_(v2), v3_(v3), | | ValueArray4(T1 v1, T2 v2, T3 v3, T4 v4) : v1_(v1), v2_(v2), v3_(v3), | |
| v4_(v4) {} | | v4_(v4) {} | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_}; | | const T array[] = {v1_, v2_, v3_, v4_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray4& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| }; | | }; | |
| | | | |
| template <typename T1, typename T2, typename T3, typename T4, typename T5> | | template <typename T1, typename T2, typename T3, typename T4, typename T5> | |
| class ValueArray5 { | | class ValueArray5 { | |
| public: | | public: | |
| ValueArray5(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) : v1_(v1), v2_(v2), v3_(v3
), | | ValueArray5(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) : v1_(v1), v2_(v2), v3_(v3
), | |
| v4_(v4), v5_(v5) {} | | v4_(v4), v5_(v5) {} | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_}; | | const T array[] = {v1_, v2_, v3_, v4_, v5_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray5& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| }; | | }; | |
| | | | |
| template <typename T1, typename T2, typename T3, typename T4, typename T5, | | template <typename T1, typename T2, typename T3, typename T4, typename T5, | |
| typename T6> | | typename T6> | |
| class ValueArray6 { | | class ValueArray6 { | |
| | | | |
| skipping to change at line 155 | | skipping to change at line 170 | |
| ValueArray6(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6) : v1_(v1), v2_(v2), | | ValueArray6(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6) : v1_(v1), v2_(v2), | |
| v3_(v3), v4_(v4), v5_(v5), v6_(v6) {} | | v3_(v3), v4_(v4), v5_(v5), v6_(v6) {} | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_}; | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray6& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| }; | | }; | |
| | | | |
| template <typename T1, typename T2, typename T3, typename T4, typename T5, | | template <typename T1, typename T2, typename T3, typename T4, typename T5, | |
| typename T6, typename T7> | | typename T6, typename T7> | |
| | | | |
| skipping to change at line 177 | | skipping to change at line 195 | |
| ValueArray7(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7) : v1_(v1), | | ValueArray7(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7) : v1_(v1), | |
| v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7) {} | | v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7) {} | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_}; | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray7& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| }; | | }; | |
| | | | |
| template <typename T1, typename T2, typename T3, typename T4, typename T5, | | template <typename T1, typename T2, typename T3, typename T4, typename T5, | |
| | | | |
| skipping to change at line 201 | | skipping to change at line 222 | |
| T8 v8) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7
), | | T8 v8) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7
), | |
| v8_(v8) {} | | v8_(v8) {} | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_}; | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray8& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| }; | | }; | |
| | | | |
| | | | |
| skipping to change at line 226 | | skipping to change at line 250 | |
| T9 v9) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7
), | | T9 v9) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(v7
), | |
| v8_(v8), v9_(v9) {} | | v8_(v8), v9_(v9) {} | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_}; | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray9& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| }; | | }; | |
| | | | |
| skipping to change at line 252 | | skipping to change at line 279 | |
| T10 v10) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(
v7), | | T10 v10) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(v6), v7_(
v7), | |
| v8_(v8), v9_(v9), v10_(v10) {} | | v8_(v8), v9_(v9), v10_(v10) {} | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_}; | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray10& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 280 | | skipping to change at line 310 | |
| T10 v10, T11 v11) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(
v6), | | T10 v10, T11 v11) : v1_(v1), v2_(v2), v3_(v3), v4_(v4), v5_(v5), v6_(
v6), | |
| v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11) {} | | v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11) {} | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_}; | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray11& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 310 | | skipping to change at line 343 | |
| v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12) {
} | | v6_(v6), v7_(v7), v8_(v8), v9_(v9), v10_(v10), v11_(v11), v12_(v12) {
} | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_}; | | v12_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray12& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 342 | | skipping to change at line 378 | |
| v12_(v12), v13_(v13) {} | | v12_(v12), v13_(v13) {} | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_}; | | v12_, v13_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray13& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 375 | | skipping to change at line 414 | |
| v11_(v11), v12_(v12), v13_(v13), v14_(v14) {} | | v11_(v11), v12_(v12), v13_(v13), v14_(v14) {} | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_}; | | v12_, v13_, v14_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray14& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 409 | | skipping to change at line 451 | |
| v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15) {} | | v11_(v11), v12_(v12), v13_(v13), v14_(v14), v15_(v15) {} | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_}; | | v12_, v13_, v14_, v15_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray15& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 446 | | skipping to change at line 491 | |
| v16_(v16) {} | | v16_(v16) {} | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_}; | | v12_, v13_, v14_, v15_, v16_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray16& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 484 | | skipping to change at line 532 | |
| v15_(v15), v16_(v16), v17_(v17) {} | | v15_(v15), v16_(v16), v17_(v17) {} | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_}; | | v12_, v13_, v14_, v15_, v16_, v17_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray17& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 523 | | skipping to change at line 574 | |
| v15_(v15), v16_(v16), v17_(v17), v18_(v18) {} | | v15_(v15), v16_(v16), v17_(v17), v18_(v18) {} | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_}; | | v12_, v13_, v14_, v15_, v16_, v17_, v18_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray18& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 563 | | skipping to change at line 617 | |
| v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19) {} | | v14_(v14), v15_(v15), v16_(v16), v17_(v17), v18_(v18), v19_(v19) {} | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_}; | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray19& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 605 | | skipping to change at line 662 | |
| v19_(v19), v20_(v20) {} | | v19_(v19), v20_(v20) {} | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_}; | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray20& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 649 | | skipping to change at line 709 | |
| v18_(v18), v19_(v19), v20_(v20), v21_(v21) {} | | v18_(v18), v19_(v19), v20_(v20), v21_(v21) {} | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_}; | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray21& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 694 | | skipping to change at line 757 | |
| v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22) {} | | v17_(v17), v18_(v18), v19_(v19), v20_(v20), v21_(v21), v22_(v22) {} | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_}; | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray22& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 742 | | skipping to change at line 808 | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, | |
| v23_}; | | v23_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray23& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 791 | | skipping to change at line 860 | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_}; | | v24_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray24& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 841 | | skipping to change at line 913 | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_}; | | v24_, v25_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray25& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 893 | | skipping to change at line 968 | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_}; | | v24_, v25_, v26_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray26& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 947 | | skipping to change at line 1025 | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_}; | | v24_, v25_, v26_, v27_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray27& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 1002 | | skipping to change at line 1083 | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_}; | | v24_, v25_, v26_, v27_, v28_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray28& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 1058 | | skipping to change at line 1142 | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_, v29_}; | | v24_, v25_, v26_, v27_, v28_, v29_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray29& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 1116 | | skipping to change at line 1203 | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_, v29_, v30_}; | | v24_, v25_, v26_, v27_, v28_, v29_, v30_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray30& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 1176 | | skipping to change at line 1266 | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_}; | | v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray31& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 1237 | | skipping to change at line 1330 | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_}; | | v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray32& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 1300 | | skipping to change at line 1396 | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_}; | | v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray33& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 1364 | | skipping to change at line 1463 | |
| | | | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_}; | | v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray34& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 1430 | | skipping to change at line 1532 | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, | | v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, | |
| v35_}; | | v35_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray35& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 1498 | | skipping to change at line 1603 | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | | v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | |
| v36_}; | | v36_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray36& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 1568 | | skipping to change at line 1676 | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | | v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | |
| v36_, v37_}; | | v36_, v37_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray37& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 1639 | | skipping to change at line 1750 | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | | v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | |
| v36_, v37_, v38_}; | | v36_, v37_, v38_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray38& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 1711 | | skipping to change at line 1825 | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | | v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | |
| v36_, v37_, v38_, v39_}; | | v36_, v37_, v38_, v39_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray39& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 1785 | | skipping to change at line 1902 | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | | v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | |
| v36_, v37_, v38_, v39_, v40_}; | | v36_, v37_, v38_, v39_, v40_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray40& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 1861 | | skipping to change at line 1981 | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | | v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | |
| v36_, v37_, v38_, v39_, v40_, v41_}; | | v36_, v37_, v38_, v39_, v40_, v41_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray41& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 1938 | | skipping to change at line 2061 | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | | v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | |
| v36_, v37_, v38_, v39_, v40_, v41_, v42_}; | | v36_, v37_, v38_, v39_, v40_, v41_, v42_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray42& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 2016 | | skipping to change at line 2142 | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | | v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | |
| v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_}; | | v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray43& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 2096 | | skipping to change at line 2225 | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | | v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | |
| v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_}; | | v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray44& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 2177 | | skipping to change at line 2309 | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | | v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | |
| v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_}; | | v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray45& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 2260 | | skipping to change at line 2395 | |
| template <typename T> | | template <typename T> | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | | v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | |
| v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_}; | | v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray46& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 2346 | | skipping to change at line 2484 | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | | v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | |
| v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, | | v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, | |
| v47_}; | | v47_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray47& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 2433 | | skipping to change at line 2574 | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | | v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | |
| v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v
47_, | | v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v
47_, | |
| v48_}; | | v48_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray48& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 2521 | | skipping to change at line 2665 | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | | v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | |
| v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v
47_, | | v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v
47_, | |
| v48_, v49_}; | | v48_, v49_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray49& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 2610 | | skipping to change at line 2757 | |
| operator ParamGenerator<T>() const { | | operator ParamGenerator<T>() const { | |
| const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | | const T array[] = {v1_, v2_, v3_, v4_, v5_, v6_, v7_, v8_, v9_, v10_, v
11_, | |
| v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | | v12_, v13_, v14_, v15_, v16_, v17_, v18_, v19_, v20_, v21_, v22_, v
23_, | |
| v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | | v24_, v25_, v26_, v27_, v28_, v29_, v30_, v31_, v32_, v33_, v34_, v
35_, | |
| v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v
47_, | | v36_, v37_, v38_, v39_, v40_, v41_, v42_, v43_, v44_, v45_, v46_, v
47_, | |
| v48_, v49_, v50_}; | | v48_, v49_, v50_}; | |
| return ValuesIn(array); | | return ValuesIn(array); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const ValueArray50& other); | |
| | | | |
| const T1 v1_; | | const T1 v1_; | |
| const T2 v2_; | | const T2 v2_; | |
| const T3 v3_; | | const T3 v3_; | |
| const T4 v4_; | | const T4 v4_; | |
| const T5 v5_; | | const T5 v5_; | |
| const T6 v6_; | | const T6 v6_; | |
| const T7 v7_; | | const T7 v7_; | |
| const T8 v8_; | | const T8 v8_; | |
| const T9 v9_; | | const T9 v9_; | |
| const T10 v10_; | | const T10 v10_; | |
| | | | |
| skipping to change at line 2760 | | skipping to change at line 2910 | |
| current_value_ = ParamType(*current1_, *current2_); | | current_value_ = ParamType(*current1_, *current2_); | |
| } | | } | |
| bool AtEnd() const { | | bool AtEnd() const { | |
| // We must report iterator past the end of the range when either of t
he | | // We must report iterator past the end of the range when either of t
he | |
| // component iterators has reached the end of its range. | | // component iterators has reached the end of its range. | |
| return | | return | |
| current1_ == end1_ || | | current1_ == end1_ || | |
| current2_ == end2_; | | current2_ == end2_; | |
| } | | } | |
| | | | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const Iterator& other); | |
| | | | |
| const ParamGeneratorInterface<ParamType>* const base_; | | const ParamGeneratorInterface<ParamType>* const base_; | |
| // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. | | // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. | |
| // current[i]_ is the actual traversing iterator. | | // current[i]_ is the actual traversing iterator. | |
| const typename ParamGenerator<T1>::iterator begin1_; | | const typename ParamGenerator<T1>::iterator begin1_; | |
| const typename ParamGenerator<T1>::iterator end1_; | | const typename ParamGenerator<T1>::iterator end1_; | |
| typename ParamGenerator<T1>::iterator current1_; | | typename ParamGenerator<T1>::iterator current1_; | |
| const typename ParamGenerator<T2>::iterator begin2_; | | const typename ParamGenerator<T2>::iterator begin2_; | |
| const typename ParamGenerator<T2>::iterator end2_; | | const typename ParamGenerator<T2>::iterator end2_; | |
| typename ParamGenerator<T2>::iterator current2_; | | typename ParamGenerator<T2>::iterator current2_; | |
| ParamType current_value_; | | ParamType current_value_; | |
|
| }; | | }; // class CartesianProductGenerator2::Iterator | |
| | | | |
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const CartesianProductGenerator2& other); | |
| | | | |
| const ParamGenerator<T1> g1_; | | const ParamGenerator<T1> g1_; | |
| const ParamGenerator<T2> g2_; | | const ParamGenerator<T2> g2_; | |
|
| }; | | }; // class CartesianProductGenerator2 | |
| | | | |
| template <typename T1, typename T2, typename T3> | | template <typename T1, typename T2, typename T3> | |
| class CartesianProductGenerator3 | | class CartesianProductGenerator3 | |
| : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3> > { | | : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3> > { | |
| public: | | public: | |
| typedef ::std::tr1::tuple<T1, T2, T3> ParamType; | | typedef ::std::tr1::tuple<T1, T2, T3> ParamType; | |
| | | | |
| CartesianProductGenerator3(const ParamGenerator<T1>& g1, | | CartesianProductGenerator3(const ParamGenerator<T1>& g1, | |
| const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3) | | const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3) | |
| : g1_(g1), g2_(g2), g3_(g3) {} | | : g1_(g1), g2_(g2), g3_(g3) {} | |
| | | | |
| skipping to change at line 2881 | | skipping to change at line 3037 | |
| } | | } | |
| bool AtEnd() const { | | bool AtEnd() const { | |
| // We must report iterator past the end of the range when either of t
he | | // We must report iterator past the end of the range when either of t
he | |
| // component iterators has reached the end of its range. | | // component iterators has reached the end of its range. | |
| return | | return | |
| current1_ == end1_ || | | current1_ == end1_ || | |
| current2_ == end2_ || | | current2_ == end2_ || | |
| current3_ == end3_; | | current3_ == end3_; | |
| } | | } | |
| | | | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const Iterator& other); | |
| | | | |
| const ParamGeneratorInterface<ParamType>* const base_; | | const ParamGeneratorInterface<ParamType>* const base_; | |
| // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. | | // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. | |
| // current[i]_ is the actual traversing iterator. | | // current[i]_ is the actual traversing iterator. | |
| const typename ParamGenerator<T1>::iterator begin1_; | | const typename ParamGenerator<T1>::iterator begin1_; | |
| const typename ParamGenerator<T1>::iterator end1_; | | const typename ParamGenerator<T1>::iterator end1_; | |
| typename ParamGenerator<T1>::iterator current1_; | | typename ParamGenerator<T1>::iterator current1_; | |
| const typename ParamGenerator<T2>::iterator begin2_; | | const typename ParamGenerator<T2>::iterator begin2_; | |
| const typename ParamGenerator<T2>::iterator end2_; | | const typename ParamGenerator<T2>::iterator end2_; | |
| typename ParamGenerator<T2>::iterator current2_; | | typename ParamGenerator<T2>::iterator current2_; | |
| const typename ParamGenerator<T3>::iterator begin3_; | | const typename ParamGenerator<T3>::iterator begin3_; | |
| const typename ParamGenerator<T3>::iterator end3_; | | const typename ParamGenerator<T3>::iterator end3_; | |
| typename ParamGenerator<T3>::iterator current3_; | | typename ParamGenerator<T3>::iterator current3_; | |
| ParamType current_value_; | | ParamType current_value_; | |
|
| }; | | }; // class CartesianProductGenerator3::Iterator | |
| | | | |
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const CartesianProductGenerator3& other); | |
| | | | |
| const ParamGenerator<T1> g1_; | | const ParamGenerator<T1> g1_; | |
| const ParamGenerator<T2> g2_; | | const ParamGenerator<T2> g2_; | |
| const ParamGenerator<T3> g3_; | | const ParamGenerator<T3> g3_; | |
|
| }; | | }; // class CartesianProductGenerator3 | |
| | | | |
| template <typename T1, typename T2, typename T3, typename T4> | | template <typename T1, typename T2, typename T3, typename T4> | |
| class CartesianProductGenerator4 | | class CartesianProductGenerator4 | |
| : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4> > { | | : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4> > { | |
| public: | | public: | |
| typedef ::std::tr1::tuple<T1, T2, T3, T4> ParamType; | | typedef ::std::tr1::tuple<T1, T2, T3, T4> ParamType; | |
| | | | |
| CartesianProductGenerator4(const ParamGenerator<T1>& g1, | | CartesianProductGenerator4(const ParamGenerator<T1>& g1, | |
| const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3, | | const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3, | |
| const ParamGenerator<T4>& g4) | | const ParamGenerator<T4>& g4) | |
| | | | |
| skipping to change at line 3021 | | skipping to change at line 3183 | |
| bool AtEnd() const { | | bool AtEnd() const { | |
| // We must report iterator past the end of the range when either of t
he | | // We must report iterator past the end of the range when either of t
he | |
| // component iterators has reached the end of its range. | | // component iterators has reached the end of its range. | |
| return | | return | |
| current1_ == end1_ || | | current1_ == end1_ || | |
| current2_ == end2_ || | | current2_ == end2_ || | |
| current3_ == end3_ || | | current3_ == end3_ || | |
| current4_ == end4_; | | current4_ == end4_; | |
| } | | } | |
| | | | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const Iterator& other); | |
| | | | |
| const ParamGeneratorInterface<ParamType>* const base_; | | const ParamGeneratorInterface<ParamType>* const base_; | |
| // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. | | // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. | |
| // current[i]_ is the actual traversing iterator. | | // current[i]_ is the actual traversing iterator. | |
| const typename ParamGenerator<T1>::iterator begin1_; | | const typename ParamGenerator<T1>::iterator begin1_; | |
| const typename ParamGenerator<T1>::iterator end1_; | | const typename ParamGenerator<T1>::iterator end1_; | |
| typename ParamGenerator<T1>::iterator current1_; | | typename ParamGenerator<T1>::iterator current1_; | |
| const typename ParamGenerator<T2>::iterator begin2_; | | const typename ParamGenerator<T2>::iterator begin2_; | |
| const typename ParamGenerator<T2>::iterator end2_; | | const typename ParamGenerator<T2>::iterator end2_; | |
| typename ParamGenerator<T2>::iterator current2_; | | typename ParamGenerator<T2>::iterator current2_; | |
| const typename ParamGenerator<T3>::iterator begin3_; | | const typename ParamGenerator<T3>::iterator begin3_; | |
| const typename ParamGenerator<T3>::iterator end3_; | | const typename ParamGenerator<T3>::iterator end3_; | |
| typename ParamGenerator<T3>::iterator current3_; | | typename ParamGenerator<T3>::iterator current3_; | |
| const typename ParamGenerator<T4>::iterator begin4_; | | const typename ParamGenerator<T4>::iterator begin4_; | |
| const typename ParamGenerator<T4>::iterator end4_; | | const typename ParamGenerator<T4>::iterator end4_; | |
| typename ParamGenerator<T4>::iterator current4_; | | typename ParamGenerator<T4>::iterator current4_; | |
| ParamType current_value_; | | ParamType current_value_; | |
|
| }; | | }; // class CartesianProductGenerator4::Iterator | |
| | | | |
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const CartesianProductGenerator4& other); | |
| | | | |
| const ParamGenerator<T1> g1_; | | const ParamGenerator<T1> g1_; | |
| const ParamGenerator<T2> g2_; | | const ParamGenerator<T2> g2_; | |
| const ParamGenerator<T3> g3_; | | const ParamGenerator<T3> g3_; | |
| const ParamGenerator<T4> g4_; | | const ParamGenerator<T4> g4_; | |
|
| }; | | }; // class CartesianProductGenerator4 | |
| | | | |
| template <typename T1, typename T2, typename T3, typename T4, typename T5> | | template <typename T1, typename T2, typename T3, typename T4, typename T5> | |
| class CartesianProductGenerator5 | | class CartesianProductGenerator5 | |
| : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5>
> { | | : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5>
> { | |
| public: | | public: | |
| typedef ::std::tr1::tuple<T1, T2, T3, T4, T5> ParamType; | | typedef ::std::tr1::tuple<T1, T2, T3, T4, T5> ParamType; | |
| | | | |
| CartesianProductGenerator5(const ParamGenerator<T1>& g1, | | CartesianProductGenerator5(const ParamGenerator<T1>& g1, | |
| const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3, | | const ParamGenerator<T2>& g2, const ParamGenerator<T3>& g3, | |
| const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5) | | const ParamGenerator<T4>& g4, const ParamGenerator<T5>& g5) | |
| | | | |
| skipping to change at line 3177 | | skipping to change at line 3345 | |
| // We must report iterator past the end of the range when either of t
he | | // We must report iterator past the end of the range when either of t
he | |
| // component iterators has reached the end of its range. | | // component iterators has reached the end of its range. | |
| return | | return | |
| current1_ == end1_ || | | current1_ == end1_ || | |
| current2_ == end2_ || | | current2_ == end2_ || | |
| current3_ == end3_ || | | current3_ == end3_ || | |
| current4_ == end4_ || | | current4_ == end4_ || | |
| current5_ == end5_; | | current5_ == end5_; | |
| } | | } | |
| | | | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const Iterator& other); | |
| | | | |
| const ParamGeneratorInterface<ParamType>* const base_; | | const ParamGeneratorInterface<ParamType>* const base_; | |
| // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. | | // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. | |
| // current[i]_ is the actual traversing iterator. | | // current[i]_ is the actual traversing iterator. | |
| const typename ParamGenerator<T1>::iterator begin1_; | | const typename ParamGenerator<T1>::iterator begin1_; | |
| const typename ParamGenerator<T1>::iterator end1_; | | const typename ParamGenerator<T1>::iterator end1_; | |
| typename ParamGenerator<T1>::iterator current1_; | | typename ParamGenerator<T1>::iterator current1_; | |
| const typename ParamGenerator<T2>::iterator begin2_; | | const typename ParamGenerator<T2>::iterator begin2_; | |
| const typename ParamGenerator<T2>::iterator end2_; | | const typename ParamGenerator<T2>::iterator end2_; | |
| typename ParamGenerator<T2>::iterator current2_; | | typename ParamGenerator<T2>::iterator current2_; | |
| const typename ParamGenerator<T3>::iterator begin3_; | | const typename ParamGenerator<T3>::iterator begin3_; | |
| const typename ParamGenerator<T3>::iterator end3_; | | const typename ParamGenerator<T3>::iterator end3_; | |
| typename ParamGenerator<T3>::iterator current3_; | | typename ParamGenerator<T3>::iterator current3_; | |
| const typename ParamGenerator<T4>::iterator begin4_; | | const typename ParamGenerator<T4>::iterator begin4_; | |
| const typename ParamGenerator<T4>::iterator end4_; | | const typename ParamGenerator<T4>::iterator end4_; | |
| typename ParamGenerator<T4>::iterator current4_; | | typename ParamGenerator<T4>::iterator current4_; | |
| const typename ParamGenerator<T5>::iterator begin5_; | | const typename ParamGenerator<T5>::iterator begin5_; | |
| const typename ParamGenerator<T5>::iterator end5_; | | const typename ParamGenerator<T5>::iterator end5_; | |
| typename ParamGenerator<T5>::iterator current5_; | | typename ParamGenerator<T5>::iterator current5_; | |
| ParamType current_value_; | | ParamType current_value_; | |
|
| }; | | }; // class CartesianProductGenerator5::Iterator | |
| | | | |
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const CartesianProductGenerator5& other); | |
| | | | |
| const ParamGenerator<T1> g1_; | | const ParamGenerator<T1> g1_; | |
| const ParamGenerator<T2> g2_; | | const ParamGenerator<T2> g2_; | |
| const ParamGenerator<T3> g3_; | | const ParamGenerator<T3> g3_; | |
| const ParamGenerator<T4> g4_; | | const ParamGenerator<T4> g4_; | |
| const ParamGenerator<T5> g5_; | | const ParamGenerator<T5> g5_; | |
|
| }; | | }; // class CartesianProductGenerator5 | |
| | | | |
| template <typename T1, typename T2, typename T3, typename T4, typename T5, | | template <typename T1, typename T2, typename T3, typename T4, typename T5, | |
| typename T6> | | typename T6> | |
| class CartesianProductGenerator6 | | class CartesianProductGenerator6 | |
| : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, | | : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5, | |
| T6> > { | | T6> > { | |
| public: | | public: | |
| typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> ParamType; | | typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6> ParamType; | |
| | | | |
| CartesianProductGenerator6(const ParamGenerator<T1>& g1, | | CartesianProductGenerator6(const ParamGenerator<T1>& g1, | |
| | | | |
| skipping to change at line 3352 | | skipping to change at line 3526 | |
| // component iterators has reached the end of its range. | | // component iterators has reached the end of its range. | |
| return | | return | |
| current1_ == end1_ || | | current1_ == end1_ || | |
| current2_ == end2_ || | | current2_ == end2_ || | |
| current3_ == end3_ || | | current3_ == end3_ || | |
| current4_ == end4_ || | | current4_ == end4_ || | |
| current5_ == end5_ || | | current5_ == end5_ || | |
| current6_ == end6_; | | current6_ == end6_; | |
| } | | } | |
| | | | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const Iterator& other); | |
| | | | |
| const ParamGeneratorInterface<ParamType>* const base_; | | const ParamGeneratorInterface<ParamType>* const base_; | |
| // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. | | // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. | |
| // current[i]_ is the actual traversing iterator. | | // current[i]_ is the actual traversing iterator. | |
| const typename ParamGenerator<T1>::iterator begin1_; | | const typename ParamGenerator<T1>::iterator begin1_; | |
| const typename ParamGenerator<T1>::iterator end1_; | | const typename ParamGenerator<T1>::iterator end1_; | |
| typename ParamGenerator<T1>::iterator current1_; | | typename ParamGenerator<T1>::iterator current1_; | |
| const typename ParamGenerator<T2>::iterator begin2_; | | const typename ParamGenerator<T2>::iterator begin2_; | |
| const typename ParamGenerator<T2>::iterator end2_; | | const typename ParamGenerator<T2>::iterator end2_; | |
| typename ParamGenerator<T2>::iterator current2_; | | typename ParamGenerator<T2>::iterator current2_; | |
| const typename ParamGenerator<T3>::iterator begin3_; | | const typename ParamGenerator<T3>::iterator begin3_; | |
| | | | |
| skipping to change at line 3374 | | skipping to change at line 3551 | |
| const typename ParamGenerator<T4>::iterator begin4_; | | const typename ParamGenerator<T4>::iterator begin4_; | |
| const typename ParamGenerator<T4>::iterator end4_; | | const typename ParamGenerator<T4>::iterator end4_; | |
| typename ParamGenerator<T4>::iterator current4_; | | typename ParamGenerator<T4>::iterator current4_; | |
| const typename ParamGenerator<T5>::iterator begin5_; | | const typename ParamGenerator<T5>::iterator begin5_; | |
| const typename ParamGenerator<T5>::iterator end5_; | | const typename ParamGenerator<T5>::iterator end5_; | |
| typename ParamGenerator<T5>::iterator current5_; | | typename ParamGenerator<T5>::iterator current5_; | |
| const typename ParamGenerator<T6>::iterator begin6_; | | const typename ParamGenerator<T6>::iterator begin6_; | |
| const typename ParamGenerator<T6>::iterator end6_; | | const typename ParamGenerator<T6>::iterator end6_; | |
| typename ParamGenerator<T6>::iterator current6_; | | typename ParamGenerator<T6>::iterator current6_; | |
| ParamType current_value_; | | ParamType current_value_; | |
|
| }; | | }; // class CartesianProductGenerator6::Iterator | |
| | | | |
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const CartesianProductGenerator6& other); | |
| | | | |
| const ParamGenerator<T1> g1_; | | const ParamGenerator<T1> g1_; | |
| const ParamGenerator<T2> g2_; | | const ParamGenerator<T2> g2_; | |
| const ParamGenerator<T3> g3_; | | const ParamGenerator<T3> g3_; | |
| const ParamGenerator<T4> g4_; | | const ParamGenerator<T4> g4_; | |
| const ParamGenerator<T5> g5_; | | const ParamGenerator<T5> g5_; | |
| const ParamGenerator<T6> g6_; | | const ParamGenerator<T6> g6_; | |
|
| }; | | }; // class CartesianProductGenerator6 | |
| | | | |
| template <typename T1, typename T2, typename T3, typename T4, typename T5, | | template <typename T1, typename T2, typename T3, typename T4, typename T5, | |
| typename T6, typename T7> | | typename T6, typename T7> | |
| class CartesianProductGenerator7 | | class CartesianProductGenerator7 | |
| : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5,
T6, | | : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5,
T6, | |
| T7> > { | | T7> > { | |
| public: | | public: | |
| typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7> ParamType; | | typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7> ParamType; | |
| | | | |
| CartesianProductGenerator7(const ParamGenerator<T1>& g1, | | CartesianProductGenerator7(const ParamGenerator<T1>& g1, | |
| | | | |
| skipping to change at line 3544 | | skipping to change at line 3724 | |
| return | | return | |
| current1_ == end1_ || | | current1_ == end1_ || | |
| current2_ == end2_ || | | current2_ == end2_ || | |
| current3_ == end3_ || | | current3_ == end3_ || | |
| current4_ == end4_ || | | current4_ == end4_ || | |
| current5_ == end5_ || | | current5_ == end5_ || | |
| current6_ == end6_ || | | current6_ == end6_ || | |
| current7_ == end7_; | | current7_ == end7_; | |
| } | | } | |
| | | | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const Iterator& other); | |
| | | | |
| const ParamGeneratorInterface<ParamType>* const base_; | | const ParamGeneratorInterface<ParamType>* const base_; | |
| // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. | | // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. | |
| // current[i]_ is the actual traversing iterator. | | // current[i]_ is the actual traversing iterator. | |
| const typename ParamGenerator<T1>::iterator begin1_; | | const typename ParamGenerator<T1>::iterator begin1_; | |
| const typename ParamGenerator<T1>::iterator end1_; | | const typename ParamGenerator<T1>::iterator end1_; | |
| typename ParamGenerator<T1>::iterator current1_; | | typename ParamGenerator<T1>::iterator current1_; | |
| const typename ParamGenerator<T2>::iterator begin2_; | | const typename ParamGenerator<T2>::iterator begin2_; | |
| const typename ParamGenerator<T2>::iterator end2_; | | const typename ParamGenerator<T2>::iterator end2_; | |
| typename ParamGenerator<T2>::iterator current2_; | | typename ParamGenerator<T2>::iterator current2_; | |
| const typename ParamGenerator<T3>::iterator begin3_; | | const typename ParamGenerator<T3>::iterator begin3_; | |
| | | | |
| skipping to change at line 3569 | | skipping to change at line 3752 | |
| const typename ParamGenerator<T5>::iterator begin5_; | | const typename ParamGenerator<T5>::iterator begin5_; | |
| const typename ParamGenerator<T5>::iterator end5_; | | const typename ParamGenerator<T5>::iterator end5_; | |
| typename ParamGenerator<T5>::iterator current5_; | | typename ParamGenerator<T5>::iterator current5_; | |
| const typename ParamGenerator<T6>::iterator begin6_; | | const typename ParamGenerator<T6>::iterator begin6_; | |
| const typename ParamGenerator<T6>::iterator end6_; | | const typename ParamGenerator<T6>::iterator end6_; | |
| typename ParamGenerator<T6>::iterator current6_; | | typename ParamGenerator<T6>::iterator current6_; | |
| const typename ParamGenerator<T7>::iterator begin7_; | | const typename ParamGenerator<T7>::iterator begin7_; | |
| const typename ParamGenerator<T7>::iterator end7_; | | const typename ParamGenerator<T7>::iterator end7_; | |
| typename ParamGenerator<T7>::iterator current7_; | | typename ParamGenerator<T7>::iterator current7_; | |
| ParamType current_value_; | | ParamType current_value_; | |
|
| }; | | }; // class CartesianProductGenerator7::Iterator | |
| | | | |
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const CartesianProductGenerator7& other); | |
| | | | |
| const ParamGenerator<T1> g1_; | | const ParamGenerator<T1> g1_; | |
| const ParamGenerator<T2> g2_; | | const ParamGenerator<T2> g2_; | |
| const ParamGenerator<T3> g3_; | | const ParamGenerator<T3> g3_; | |
| const ParamGenerator<T4> g4_; | | const ParamGenerator<T4> g4_; | |
| const ParamGenerator<T5> g5_; | | const ParamGenerator<T5> g5_; | |
| const ParamGenerator<T6> g6_; | | const ParamGenerator<T6> g6_; | |
| const ParamGenerator<T7> g7_; | | const ParamGenerator<T7> g7_; | |
|
| }; | | }; // class CartesianProductGenerator7 | |
| | | | |
| template <typename T1, typename T2, typename T3, typename T4, typename T5, | | template <typename T1, typename T2, typename T3, typename T4, typename T5, | |
| typename T6, typename T7, typename T8> | | typename T6, typename T7, typename T8> | |
| class CartesianProductGenerator8 | | class CartesianProductGenerator8 | |
| : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5,
T6, | | : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5,
T6, | |
| T7, T8> > { | | T7, T8> > { | |
| public: | | public: | |
| typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8> ParamType; | | typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8> ParamType; | |
| | | | |
| CartesianProductGenerator8(const ParamGenerator<T1>& g1, | | CartesianProductGenerator8(const ParamGenerator<T1>& g1, | |
| | | | |
| skipping to change at line 3755 | | skipping to change at line 3941 | |
| current1_ == end1_ || | | current1_ == end1_ || | |
| current2_ == end2_ || | | current2_ == end2_ || | |
| current3_ == end3_ || | | current3_ == end3_ || | |
| current4_ == end4_ || | | current4_ == end4_ || | |
| current5_ == end5_ || | | current5_ == end5_ || | |
| current6_ == end6_ || | | current6_ == end6_ || | |
| current7_ == end7_ || | | current7_ == end7_ || | |
| current8_ == end8_; | | current8_ == end8_; | |
| } | | } | |
| | | | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const Iterator& other); | |
| | | | |
| const ParamGeneratorInterface<ParamType>* const base_; | | const ParamGeneratorInterface<ParamType>* const base_; | |
| // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. | | // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. | |
| // current[i]_ is the actual traversing iterator. | | // current[i]_ is the actual traversing iterator. | |
| const typename ParamGenerator<T1>::iterator begin1_; | | const typename ParamGenerator<T1>::iterator begin1_; | |
| const typename ParamGenerator<T1>::iterator end1_; | | const typename ParamGenerator<T1>::iterator end1_; | |
| typename ParamGenerator<T1>::iterator current1_; | | typename ParamGenerator<T1>::iterator current1_; | |
| const typename ParamGenerator<T2>::iterator begin2_; | | const typename ParamGenerator<T2>::iterator begin2_; | |
| const typename ParamGenerator<T2>::iterator end2_; | | const typename ParamGenerator<T2>::iterator end2_; | |
| typename ParamGenerator<T2>::iterator current2_; | | typename ParamGenerator<T2>::iterator current2_; | |
| const typename ParamGenerator<T3>::iterator begin3_; | | const typename ParamGenerator<T3>::iterator begin3_; | |
| | | | |
| skipping to change at line 3783 | | skipping to change at line 3972 | |
| const typename ParamGenerator<T6>::iterator begin6_; | | const typename ParamGenerator<T6>::iterator begin6_; | |
| const typename ParamGenerator<T6>::iterator end6_; | | const typename ParamGenerator<T6>::iterator end6_; | |
| typename ParamGenerator<T6>::iterator current6_; | | typename ParamGenerator<T6>::iterator current6_; | |
| const typename ParamGenerator<T7>::iterator begin7_; | | const typename ParamGenerator<T7>::iterator begin7_; | |
| const typename ParamGenerator<T7>::iterator end7_; | | const typename ParamGenerator<T7>::iterator end7_; | |
| typename ParamGenerator<T7>::iterator current7_; | | typename ParamGenerator<T7>::iterator current7_; | |
| const typename ParamGenerator<T8>::iterator begin8_; | | const typename ParamGenerator<T8>::iterator begin8_; | |
| const typename ParamGenerator<T8>::iterator end8_; | | const typename ParamGenerator<T8>::iterator end8_; | |
| typename ParamGenerator<T8>::iterator current8_; | | typename ParamGenerator<T8>::iterator current8_; | |
| ParamType current_value_; | | ParamType current_value_; | |
|
| }; | | }; // class CartesianProductGenerator8::Iterator | |
| | | | |
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const CartesianProductGenerator8& other); | |
| | | | |
| const ParamGenerator<T1> g1_; | | const ParamGenerator<T1> g1_; | |
| const ParamGenerator<T2> g2_; | | const ParamGenerator<T2> g2_; | |
| const ParamGenerator<T3> g3_; | | const ParamGenerator<T3> g3_; | |
| const ParamGenerator<T4> g4_; | | const ParamGenerator<T4> g4_; | |
| const ParamGenerator<T5> g5_; | | const ParamGenerator<T5> g5_; | |
| const ParamGenerator<T6> g6_; | | const ParamGenerator<T6> g6_; | |
| const ParamGenerator<T7> g7_; | | const ParamGenerator<T7> g7_; | |
| const ParamGenerator<T8> g8_; | | const ParamGenerator<T8> g8_; | |
|
| }; | | }; // class CartesianProductGenerator8 | |
| | | | |
| template <typename T1, typename T2, typename T3, typename T4, typename T5, | | template <typename T1, typename T2, typename T3, typename T4, typename T5, | |
| typename T6, typename T7, typename T8, typename T9> | | typename T6, typename T7, typename T8, typename T9> | |
| class CartesianProductGenerator9 | | class CartesianProductGenerator9 | |
| : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5,
T6, | | : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5,
T6, | |
| T7, T8, T9> > { | | T7, T8, T9> > { | |
| public: | | public: | |
| typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> ParamType; | | typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9> ParamType; | |
| | | | |
| CartesianProductGenerator9(const ParamGenerator<T1>& g1, | | CartesianProductGenerator9(const ParamGenerator<T1>& g1, | |
| | | | |
| skipping to change at line 3983 | | skipping to change at line 4175 | |
| current2_ == end2_ || | | current2_ == end2_ || | |
| current3_ == end3_ || | | current3_ == end3_ || | |
| current4_ == end4_ || | | current4_ == end4_ || | |
| current5_ == end5_ || | | current5_ == end5_ || | |
| current6_ == end6_ || | | current6_ == end6_ || | |
| current7_ == end7_ || | | current7_ == end7_ || | |
| current8_ == end8_ || | | current8_ == end8_ || | |
| current9_ == end9_; | | current9_ == end9_; | |
| } | | } | |
| | | | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const Iterator& other); | |
| | | | |
| const ParamGeneratorInterface<ParamType>* const base_; | | const ParamGeneratorInterface<ParamType>* const base_; | |
| // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. | | // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. | |
| // current[i]_ is the actual traversing iterator. | | // current[i]_ is the actual traversing iterator. | |
| const typename ParamGenerator<T1>::iterator begin1_; | | const typename ParamGenerator<T1>::iterator begin1_; | |
| const typename ParamGenerator<T1>::iterator end1_; | | const typename ParamGenerator<T1>::iterator end1_; | |
| typename ParamGenerator<T1>::iterator current1_; | | typename ParamGenerator<T1>::iterator current1_; | |
| const typename ParamGenerator<T2>::iterator begin2_; | | const typename ParamGenerator<T2>::iterator begin2_; | |
| const typename ParamGenerator<T2>::iterator end2_; | | const typename ParamGenerator<T2>::iterator end2_; | |
| typename ParamGenerator<T2>::iterator current2_; | | typename ParamGenerator<T2>::iterator current2_; | |
| const typename ParamGenerator<T3>::iterator begin3_; | | const typename ParamGenerator<T3>::iterator begin3_; | |
| | | | |
| skipping to change at line 4014 | | skipping to change at line 4209 | |
| const typename ParamGenerator<T7>::iterator begin7_; | | const typename ParamGenerator<T7>::iterator begin7_; | |
| const typename ParamGenerator<T7>::iterator end7_; | | const typename ParamGenerator<T7>::iterator end7_; | |
| typename ParamGenerator<T7>::iterator current7_; | | typename ParamGenerator<T7>::iterator current7_; | |
| const typename ParamGenerator<T8>::iterator begin8_; | | const typename ParamGenerator<T8>::iterator begin8_; | |
| const typename ParamGenerator<T8>::iterator end8_; | | const typename ParamGenerator<T8>::iterator end8_; | |
| typename ParamGenerator<T8>::iterator current8_; | | typename ParamGenerator<T8>::iterator current8_; | |
| const typename ParamGenerator<T9>::iterator begin9_; | | const typename ParamGenerator<T9>::iterator begin9_; | |
| const typename ParamGenerator<T9>::iterator end9_; | | const typename ParamGenerator<T9>::iterator end9_; | |
| typename ParamGenerator<T9>::iterator current9_; | | typename ParamGenerator<T9>::iterator current9_; | |
| ParamType current_value_; | | ParamType current_value_; | |
|
| }; | | }; // class CartesianProductGenerator9::Iterator | |
| | | | |
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const CartesianProductGenerator9& other); | |
| | | | |
| const ParamGenerator<T1> g1_; | | const ParamGenerator<T1> g1_; | |
| const ParamGenerator<T2> g2_; | | const ParamGenerator<T2> g2_; | |
| const ParamGenerator<T3> g3_; | | const ParamGenerator<T3> g3_; | |
| const ParamGenerator<T4> g4_; | | const ParamGenerator<T4> g4_; | |
| const ParamGenerator<T5> g5_; | | const ParamGenerator<T5> g5_; | |
| const ParamGenerator<T6> g6_; | | const ParamGenerator<T6> g6_; | |
| const ParamGenerator<T7> g7_; | | const ParamGenerator<T7> g7_; | |
| const ParamGenerator<T8> g8_; | | const ParamGenerator<T8> g8_; | |
| const ParamGenerator<T9> g9_; | | const ParamGenerator<T9> g9_; | |
|
| }; | | }; // class CartesianProductGenerator9 | |
| | | | |
| template <typename T1, typename T2, typename T3, typename T4, typename T5, | | template <typename T1, typename T2, typename T3, typename T4, typename T5, | |
| typename T6, typename T7, typename T8, typename T9, typename T10> | | typename T6, typename T7, typename T8, typename T9, typename T10> | |
| class CartesianProductGenerator10 | | class CartesianProductGenerator10 | |
| : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5,
T6, | | : public ParamGeneratorInterface< ::std::tr1::tuple<T1, T2, T3, T4, T5,
T6, | |
| T7, T8, T9, T10> > { | | T7, T8, T9, T10> > { | |
| public: | | public: | |
| typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ParamT
ype; | | typedef ::std::tr1::tuple<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> ParamT
ype; | |
| | | | |
| CartesianProductGenerator10(const ParamGenerator<T1>& g1, | | CartesianProductGenerator10(const ParamGenerator<T1>& g1, | |
| | | | |
| skipping to change at line 4228 | | skipping to change at line 4426 | |
| current3_ == end3_ || | | current3_ == end3_ || | |
| current4_ == end4_ || | | current4_ == end4_ || | |
| current5_ == end5_ || | | current5_ == end5_ || | |
| current6_ == end6_ || | | current6_ == end6_ || | |
| current7_ == end7_ || | | current7_ == end7_ || | |
| current8_ == end8_ || | | current8_ == end8_ || | |
| current9_ == end9_ || | | current9_ == end9_ || | |
| current10_ == end10_; | | current10_ == end10_; | |
| } | | } | |
| | | | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const Iterator& other); | |
| | | | |
| const ParamGeneratorInterface<ParamType>* const base_; | | const ParamGeneratorInterface<ParamType>* const base_; | |
| // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. | | // begin[i]_ and end[i]_ define the i-th range that Iterator traverses. | |
| // current[i]_ is the actual traversing iterator. | | // current[i]_ is the actual traversing iterator. | |
| const typename ParamGenerator<T1>::iterator begin1_; | | const typename ParamGenerator<T1>::iterator begin1_; | |
| const typename ParamGenerator<T1>::iterator end1_; | | const typename ParamGenerator<T1>::iterator end1_; | |
| typename ParamGenerator<T1>::iterator current1_; | | typename ParamGenerator<T1>::iterator current1_; | |
| const typename ParamGenerator<T2>::iterator begin2_; | | const typename ParamGenerator<T2>::iterator begin2_; | |
| const typename ParamGenerator<T2>::iterator end2_; | | const typename ParamGenerator<T2>::iterator end2_; | |
| typename ParamGenerator<T2>::iterator current2_; | | typename ParamGenerator<T2>::iterator current2_; | |
| const typename ParamGenerator<T3>::iterator begin3_; | | const typename ParamGenerator<T3>::iterator begin3_; | |
| | | | |
| skipping to change at line 4262 | | skipping to change at line 4463 | |
| const typename ParamGenerator<T8>::iterator begin8_; | | const typename ParamGenerator<T8>::iterator begin8_; | |
| const typename ParamGenerator<T8>::iterator end8_; | | const typename ParamGenerator<T8>::iterator end8_; | |
| typename ParamGenerator<T8>::iterator current8_; | | typename ParamGenerator<T8>::iterator current8_; | |
| const typename ParamGenerator<T9>::iterator begin9_; | | const typename ParamGenerator<T9>::iterator begin9_; | |
| const typename ParamGenerator<T9>::iterator end9_; | | const typename ParamGenerator<T9>::iterator end9_; | |
| typename ParamGenerator<T9>::iterator current9_; | | typename ParamGenerator<T9>::iterator current9_; | |
| const typename ParamGenerator<T10>::iterator begin10_; | | const typename ParamGenerator<T10>::iterator begin10_; | |
| const typename ParamGenerator<T10>::iterator end10_; | | const typename ParamGenerator<T10>::iterator end10_; | |
| typename ParamGenerator<T10>::iterator current10_; | | typename ParamGenerator<T10>::iterator current10_; | |
| ParamType current_value_; | | ParamType current_value_; | |
|
| }; | | }; // class CartesianProductGenerator10::Iterator | |
| | | | |
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const CartesianProductGenerator10& other); | |
| | | | |
| const ParamGenerator<T1> g1_; | | const ParamGenerator<T1> g1_; | |
| const ParamGenerator<T2> g2_; | | const ParamGenerator<T2> g2_; | |
| const ParamGenerator<T3> g3_; | | const ParamGenerator<T3> g3_; | |
| const ParamGenerator<T4> g4_; | | const ParamGenerator<T4> g4_; | |
| const ParamGenerator<T5> g5_; | | const ParamGenerator<T5> g5_; | |
| const ParamGenerator<T6> g6_; | | const ParamGenerator<T6> g6_; | |
| const ParamGenerator<T7> g7_; | | const ParamGenerator<T7> g7_; | |
| const ParamGenerator<T8> g8_; | | const ParamGenerator<T8> g8_; | |
| const ParamGenerator<T9> g9_; | | const ParamGenerator<T9> g9_; | |
| const ParamGenerator<T10> g10_; | | const ParamGenerator<T10> g10_; | |
|
| }; | | }; // class CartesianProductGenerator10 | |
| | | | |
| // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. | | // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. | |
| // | | // | |
| // Helper classes providing Combine() with polymorphic features. They allow | | // Helper classes providing Combine() with polymorphic features. They allow | |
| // casting CartesianProductGeneratorN<T> to ParamGenerator<U> if T is | | // casting CartesianProductGeneratorN<T> to ParamGenerator<U> if T is | |
| // convertible to U. | | // convertible to U. | |
| // | | // | |
| template <class Generator1, class Generator2> | | template <class Generator1, class Generator2> | |
| class CartesianProductHolder2 { | | class CartesianProductHolder2 { | |
| public: | | public: | |
| | | | |
| skipping to change at line 4296 | | skipping to change at line 4500 | |
| : g1_(g1), g2_(g2) {} | | : g1_(g1), g2_(g2) {} | |
| template <typename T1, typename T2> | | template <typename T1, typename T2> | |
| operator ParamGenerator< ::std::tr1::tuple<T1, T2> >() const { | | operator ParamGenerator< ::std::tr1::tuple<T1, T2> >() const { | |
| return ParamGenerator< ::std::tr1::tuple<T1, T2> >( | | return ParamGenerator< ::std::tr1::tuple<T1, T2> >( | |
| new CartesianProductGenerator2<T1, T2>( | | new CartesianProductGenerator2<T1, T2>( | |
| static_cast<ParamGenerator<T1> >(g1_), | | static_cast<ParamGenerator<T1> >(g1_), | |
| static_cast<ParamGenerator<T2> >(g2_))); | | static_cast<ParamGenerator<T2> >(g2_))); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const CartesianProductHolder2& other); | |
| | | | |
| const Generator1 g1_; | | const Generator1 g1_; | |
| const Generator2 g2_; | | const Generator2 g2_; | |
|
| }; | | }; // class CartesianProductHolder2 | |
| | | | |
| template <class Generator1, class Generator2, class Generator3> | | template <class Generator1, class Generator2, class Generator3> | |
| class CartesianProductHolder3 { | | class CartesianProductHolder3 { | |
| public: | | public: | |
| CartesianProductHolder3(const Generator1& g1, const Generator2& g2, | | CartesianProductHolder3(const Generator1& g1, const Generator2& g2, | |
| const Generator3& g3) | | const Generator3& g3) | |
| : g1_(g1), g2_(g2), g3_(g3) {} | | : g1_(g1), g2_(g2), g3_(g3) {} | |
| template <typename T1, typename T2, typename T3> | | template <typename T1, typename T2, typename T3> | |
| operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3> >() const { | | operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3> >() const { | |
| return ParamGenerator< ::std::tr1::tuple<T1, T2, T3> >( | | return ParamGenerator< ::std::tr1::tuple<T1, T2, T3> >( | |
| new CartesianProductGenerator3<T1, T2, T3>( | | new CartesianProductGenerator3<T1, T2, T3>( | |
| static_cast<ParamGenerator<T1> >(g1_), | | static_cast<ParamGenerator<T1> >(g1_), | |
| static_cast<ParamGenerator<T2> >(g2_), | | static_cast<ParamGenerator<T2> >(g2_), | |
| static_cast<ParamGenerator<T3> >(g3_))); | | static_cast<ParamGenerator<T3> >(g3_))); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const CartesianProductHolder3& other); | |
| | | | |
| const Generator1 g1_; | | const Generator1 g1_; | |
| const Generator2 g2_; | | const Generator2 g2_; | |
| const Generator3 g3_; | | const Generator3 g3_; | |
|
| }; | | }; // class CartesianProductHolder3 | |
| | | | |
| template <class Generator1, class Generator2, class Generator3, | | template <class Generator1, class Generator2, class Generator3, | |
| class Generator4> | | class Generator4> | |
| class CartesianProductHolder4 { | | class CartesianProductHolder4 { | |
| public: | | public: | |
| CartesianProductHolder4(const Generator1& g1, const Generator2& g2, | | CartesianProductHolder4(const Generator1& g1, const Generator2& g2, | |
| const Generator3& g3, const Generator4& g4) | | const Generator3& g3, const Generator4& g4) | |
| : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {} | | : g1_(g1), g2_(g2), g3_(g3), g4_(g4) {} | |
| template <typename T1, typename T2, typename T3, typename T4> | | template <typename T1, typename T2, typename T3, typename T4> | |
| operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4> >() const { | | operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4> >() const { | |
| return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4> >( | | return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4> >( | |
| new CartesianProductGenerator4<T1, T2, T3, T4>( | | new CartesianProductGenerator4<T1, T2, T3, T4>( | |
| static_cast<ParamGenerator<T1> >(g1_), | | static_cast<ParamGenerator<T1> >(g1_), | |
| static_cast<ParamGenerator<T2> >(g2_), | | static_cast<ParamGenerator<T2> >(g2_), | |
| static_cast<ParamGenerator<T3> >(g3_), | | static_cast<ParamGenerator<T3> >(g3_), | |
| static_cast<ParamGenerator<T4> >(g4_))); | | static_cast<ParamGenerator<T4> >(g4_))); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const CartesianProductHolder4& other); | |
| | | | |
| const Generator1 g1_; | | const Generator1 g1_; | |
| const Generator2 g2_; | | const Generator2 g2_; | |
| const Generator3 g3_; | | const Generator3 g3_; | |
| const Generator4 g4_; | | const Generator4 g4_; | |
|
| }; | | }; // class CartesianProductHolder4 | |
| | | | |
| template <class Generator1, class Generator2, class Generator3, | | template <class Generator1, class Generator2, class Generator3, | |
| class Generator4, class Generator5> | | class Generator4, class Generator5> | |
| class CartesianProductHolder5 { | | class CartesianProductHolder5 { | |
| public: | | public: | |
| CartesianProductHolder5(const Generator1& g1, const Generator2& g2, | | CartesianProductHolder5(const Generator1& g1, const Generator2& g2, | |
| const Generator3& g3, const Generator4& g4, const Generator5& g5) | | const Generator3& g3, const Generator4& g4, const Generator5& g5) | |
| : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {} | | : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5) {} | |
| template <typename T1, typename T2, typename T3, typename T4, typename T5
> | | template <typename T1, typename T2, typename T3, typename T4, typename T5
> | |
| operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5> >() const
{ | | operator ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5> >() const
{ | |
| return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5> >( | | return ParamGenerator< ::std::tr1::tuple<T1, T2, T3, T4, T5> >( | |
| new CartesianProductGenerator5<T1, T2, T3, T4, T5>( | | new CartesianProductGenerator5<T1, T2, T3, T4, T5>( | |
| static_cast<ParamGenerator<T1> >(g1_), | | static_cast<ParamGenerator<T1> >(g1_), | |
| static_cast<ParamGenerator<T2> >(g2_), | | static_cast<ParamGenerator<T2> >(g2_), | |
| static_cast<ParamGenerator<T3> >(g3_), | | static_cast<ParamGenerator<T3> >(g3_), | |
| static_cast<ParamGenerator<T4> >(g4_), | | static_cast<ParamGenerator<T4> >(g4_), | |
| static_cast<ParamGenerator<T5> >(g5_))); | | static_cast<ParamGenerator<T5> >(g5_))); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const CartesianProductHolder5& other); | |
| | | | |
| const Generator1 g1_; | | const Generator1 g1_; | |
| const Generator2 g2_; | | const Generator2 g2_; | |
| const Generator3 g3_; | | const Generator3 g3_; | |
| const Generator4 g4_; | | const Generator4 g4_; | |
| const Generator5 g5_; | | const Generator5 g5_; | |
|
| }; | | }; // class CartesianProductHolder5 | |
| | | | |
| template <class Generator1, class Generator2, class Generator3, | | template <class Generator1, class Generator2, class Generator3, | |
| class Generator4, class Generator5, class Generator6> | | class Generator4, class Generator5, class Generator6> | |
| class CartesianProductHolder6 { | | class CartesianProductHolder6 { | |
| public: | | public: | |
| CartesianProductHolder6(const Generator1& g1, const Generator2& g2, | | CartesianProductHolder6(const Generator1& g1, const Generator2& g2, | |
| const Generator3& g3, const Generator4& g4, const Generator5& g5, | | const Generator3& g3, const Generator4& g4, const Generator5& g5, | |
| const Generator6& g6) | | const Generator6& g6) | |
| : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {} | | : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6) {} | |
| template <typename T1, typename T2, typename T3, typename T4, typename T5
, | | template <typename T1, typename T2, typename T3, typename T4, typename T5
, | |
| | | | |
| skipping to change at line 4393 | | skipping to change at line 4609 | |
| new CartesianProductGenerator6<T1, T2, T3, T4, T5, T6>( | | new CartesianProductGenerator6<T1, T2, T3, T4, T5, T6>( | |
| static_cast<ParamGenerator<T1> >(g1_), | | static_cast<ParamGenerator<T1> >(g1_), | |
| static_cast<ParamGenerator<T2> >(g2_), | | static_cast<ParamGenerator<T2> >(g2_), | |
| static_cast<ParamGenerator<T3> >(g3_), | | static_cast<ParamGenerator<T3> >(g3_), | |
| static_cast<ParamGenerator<T4> >(g4_), | | static_cast<ParamGenerator<T4> >(g4_), | |
| static_cast<ParamGenerator<T5> >(g5_), | | static_cast<ParamGenerator<T5> >(g5_), | |
| static_cast<ParamGenerator<T6> >(g6_))); | | static_cast<ParamGenerator<T6> >(g6_))); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const CartesianProductHolder6& other); | |
| | | | |
| const Generator1 g1_; | | const Generator1 g1_; | |
| const Generator2 g2_; | | const Generator2 g2_; | |
| const Generator3 g3_; | | const Generator3 g3_; | |
| const Generator4 g4_; | | const Generator4 g4_; | |
| const Generator5 g5_; | | const Generator5 g5_; | |
| const Generator6 g6_; | | const Generator6 g6_; | |
|
| }; | | }; // class CartesianProductHolder6 | |
| | | | |
| template <class Generator1, class Generator2, class Generator3, | | template <class Generator1, class Generator2, class Generator3, | |
| class Generator4, class Generator5, class Generator6, class Generator7> | | class Generator4, class Generator5, class Generator6, class Generator7> | |
| class CartesianProductHolder7 { | | class CartesianProductHolder7 { | |
| public: | | public: | |
| CartesianProductHolder7(const Generator1& g1, const Generator2& g2, | | CartesianProductHolder7(const Generator1& g1, const Generator2& g2, | |
| const Generator3& g3, const Generator4& g4, const Generator5& g5, | | const Generator3& g3, const Generator4& g4, const Generator5& g5, | |
| const Generator6& g6, const Generator7& g7) | | const Generator6& g6, const Generator7& g7) | |
| : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {} | | : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7) {} | |
| template <typename T1, typename T2, typename T3, typename T4, typename T5
, | | template <typename T1, typename T2, typename T3, typename T4, typename T5
, | |
| | | | |
| skipping to change at line 4425 | | skipping to change at line 4644 | |
| static_cast<ParamGenerator<T1> >(g1_), | | static_cast<ParamGenerator<T1> >(g1_), | |
| static_cast<ParamGenerator<T2> >(g2_), | | static_cast<ParamGenerator<T2> >(g2_), | |
| static_cast<ParamGenerator<T3> >(g3_), | | static_cast<ParamGenerator<T3> >(g3_), | |
| static_cast<ParamGenerator<T4> >(g4_), | | static_cast<ParamGenerator<T4> >(g4_), | |
| static_cast<ParamGenerator<T5> >(g5_), | | static_cast<ParamGenerator<T5> >(g5_), | |
| static_cast<ParamGenerator<T6> >(g6_), | | static_cast<ParamGenerator<T6> >(g6_), | |
| static_cast<ParamGenerator<T7> >(g7_))); | | static_cast<ParamGenerator<T7> >(g7_))); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const CartesianProductHolder7& other); | |
| | | | |
| const Generator1 g1_; | | const Generator1 g1_; | |
| const Generator2 g2_; | | const Generator2 g2_; | |
| const Generator3 g3_; | | const Generator3 g3_; | |
| const Generator4 g4_; | | const Generator4 g4_; | |
| const Generator5 g5_; | | const Generator5 g5_; | |
| const Generator6 g6_; | | const Generator6 g6_; | |
| const Generator7 g7_; | | const Generator7 g7_; | |
|
| }; | | }; // class CartesianProductHolder7 | |
| | | | |
| template <class Generator1, class Generator2, class Generator3, | | template <class Generator1, class Generator2, class Generator3, | |
| class Generator4, class Generator5, class Generator6, class Generator7, | | class Generator4, class Generator5, class Generator6, class Generator7, | |
| class Generator8> | | class Generator8> | |
| class CartesianProductHolder8 { | | class CartesianProductHolder8 { | |
| public: | | public: | |
| CartesianProductHolder8(const Generator1& g1, const Generator2& g2, | | CartesianProductHolder8(const Generator1& g1, const Generator2& g2, | |
| const Generator3& g3, const Generator4& g4, const Generator5& g5, | | const Generator3& g3, const Generator4& g4, const Generator5& g5, | |
| const Generator6& g6, const Generator7& g7, const Generator8& g8) | | const Generator6& g6, const Generator7& g7, const Generator8& g8) | |
| : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), | | : g1_(g1), g2_(g2), g3_(g3), g4_(g4), g5_(g5), g6_(g6), g7_(g7), | |
| | | | |
| skipping to change at line 4461 | | skipping to change at line 4683 | |
| static_cast<ParamGenerator<T2> >(g2_), | | static_cast<ParamGenerator<T2> >(g2_), | |
| static_cast<ParamGenerator<T3> >(g3_), | | static_cast<ParamGenerator<T3> >(g3_), | |
| static_cast<ParamGenerator<T4> >(g4_), | | static_cast<ParamGenerator<T4> >(g4_), | |
| static_cast<ParamGenerator<T5> >(g5_), | | static_cast<ParamGenerator<T5> >(g5_), | |
| static_cast<ParamGenerator<T6> >(g6_), | | static_cast<ParamGenerator<T6> >(g6_), | |
| static_cast<ParamGenerator<T7> >(g7_), | | static_cast<ParamGenerator<T7> >(g7_), | |
| static_cast<ParamGenerator<T8> >(g8_))); | | static_cast<ParamGenerator<T8> >(g8_))); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const CartesianProductHolder8& other); | |
| | | | |
| const Generator1 g1_; | | const Generator1 g1_; | |
| const Generator2 g2_; | | const Generator2 g2_; | |
| const Generator3 g3_; | | const Generator3 g3_; | |
| const Generator4 g4_; | | const Generator4 g4_; | |
| const Generator5 g5_; | | const Generator5 g5_; | |
| const Generator6 g6_; | | const Generator6 g6_; | |
| const Generator7 g7_; | | const Generator7 g7_; | |
| const Generator8 g8_; | | const Generator8 g8_; | |
|
| }; | | }; // class CartesianProductHolder8 | |
| | | | |
| template <class Generator1, class Generator2, class Generator3, | | template <class Generator1, class Generator2, class Generator3, | |
| class Generator4, class Generator5, class Generator6, class Generator7, | | class Generator4, class Generator5, class Generator6, class Generator7, | |
| class Generator8, class Generator9> | | class Generator8, class Generator9> | |
| class CartesianProductHolder9 { | | class CartesianProductHolder9 { | |
| public: | | public: | |
| CartesianProductHolder9(const Generator1& g1, const Generator2& g2, | | CartesianProductHolder9(const Generator1& g1, const Generator2& g2, | |
| const Generator3& g3, const Generator4& g4, const Generator5& g5, | | const Generator3& g3, const Generator4& g4, const Generator5& g5, | |
| const Generator6& g6, const Generator7& g7, const Generator8& g8, | | const Generator6& g6, const Generator7& g7, const Generator8& g8, | |
| const Generator9& g9) | | const Generator9& g9) | |
| | | | |
| skipping to change at line 4501 | | skipping to change at line 4726 | |
| static_cast<ParamGenerator<T3> >(g3_), | | static_cast<ParamGenerator<T3> >(g3_), | |
| static_cast<ParamGenerator<T4> >(g4_), | | static_cast<ParamGenerator<T4> >(g4_), | |
| static_cast<ParamGenerator<T5> >(g5_), | | static_cast<ParamGenerator<T5> >(g5_), | |
| static_cast<ParamGenerator<T6> >(g6_), | | static_cast<ParamGenerator<T6> >(g6_), | |
| static_cast<ParamGenerator<T7> >(g7_), | | static_cast<ParamGenerator<T7> >(g7_), | |
| static_cast<ParamGenerator<T8> >(g8_), | | static_cast<ParamGenerator<T8> >(g8_), | |
| static_cast<ParamGenerator<T9> >(g9_))); | | static_cast<ParamGenerator<T9> >(g9_))); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const CartesianProductHolder9& other); | |
| | | | |
| const Generator1 g1_; | | const Generator1 g1_; | |
| const Generator2 g2_; | | const Generator2 g2_; | |
| const Generator3 g3_; | | const Generator3 g3_; | |
| const Generator4 g4_; | | const Generator4 g4_; | |
| const Generator5 g5_; | | const Generator5 g5_; | |
| const Generator6 g6_; | | const Generator6 g6_; | |
| const Generator7 g7_; | | const Generator7 g7_; | |
| const Generator8 g8_; | | const Generator8 g8_; | |
| const Generator9 g9_; | | const Generator9 g9_; | |
|
| }; | | }; // class CartesianProductHolder9 | |
| | | | |
| template <class Generator1, class Generator2, class Generator3, | | template <class Generator1, class Generator2, class Generator3, | |
| class Generator4, class Generator5, class Generator6, class Generator7, | | class Generator4, class Generator5, class Generator6, class Generator7, | |
| class Generator8, class Generator9, class Generator10> | | class Generator8, class Generator9, class Generator10> | |
| class CartesianProductHolder10 { | | class CartesianProductHolder10 { | |
| public: | | public: | |
| CartesianProductHolder10(const Generator1& g1, const Generator2& g2, | | CartesianProductHolder10(const Generator1& g1, const Generator2& g2, | |
| const Generator3& g3, const Generator4& g4, const Generator5& g5, | | const Generator3& g3, const Generator4& g4, const Generator5& g5, | |
| const Generator6& g6, const Generator7& g7, const Generator8& g8, | | const Generator6& g6, const Generator7& g7, const Generator8& g8, | |
| const Generator9& g9, const Generator10& g10) | | const Generator9& g9, const Generator10& g10) | |
| | | | |
| skipping to change at line 4544 | | skipping to change at line 4772 | |
| static_cast<ParamGenerator<T4> >(g4_), | | static_cast<ParamGenerator<T4> >(g4_), | |
| static_cast<ParamGenerator<T5> >(g5_), | | static_cast<ParamGenerator<T5> >(g5_), | |
| static_cast<ParamGenerator<T6> >(g6_), | | static_cast<ParamGenerator<T6> >(g6_), | |
| static_cast<ParamGenerator<T7> >(g7_), | | static_cast<ParamGenerator<T7> >(g7_), | |
| static_cast<ParamGenerator<T8> >(g8_), | | static_cast<ParamGenerator<T8> >(g8_), | |
| static_cast<ParamGenerator<T9> >(g9_), | | static_cast<ParamGenerator<T9> >(g9_), | |
| static_cast<ParamGenerator<T10> >(g10_))); | | static_cast<ParamGenerator<T10> >(g10_))); | |
| } | | } | |
| | | | |
| private: | | private: | |
|
| | | // No implementation - assignment is unsupported. | |
| | | void operator=(const CartesianProductHolder10& other); | |
| | | | |
| const Generator1 g1_; | | const Generator1 g1_; | |
| const Generator2 g2_; | | const Generator2 g2_; | |
| const Generator3 g3_; | | const Generator3 g3_; | |
| const Generator4 g4_; | | const Generator4 g4_; | |
| const Generator5 g5_; | | const Generator5 g5_; | |
| const Generator6 g6_; | | const Generator6 g6_; | |
| const Generator7 g7_; | | const Generator7 g7_; | |
| const Generator8 g8_; | | const Generator8 g8_; | |
| const Generator9 g9_; | | const Generator9 g9_; | |
| const Generator10 g10_; | | const Generator10 g10_; | |
|
| }; | | }; // class CartesianProductHolder10 | |
| | | | |
| #endif // GTEST_HAS_COMBINE | | #endif // GTEST_HAS_COMBINE | |
| | | | |
| } // namespace internal | | } // namespace internal | |
| } // namespace testing | | } // namespace testing | |
| | | | |
| #endif // GTEST_HAS_PARAM_TEST | | #endif // GTEST_HAS_PARAM_TEST | |
| | | | |
| #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ | | #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PARAM_UTIL_GENERATED_H_ | |
| | | | |
End of changes. 95 change blocks. |
| 27 lines changed or deleted | | 258 lines changed or added | |
|
| gtest-port.h | | gtest-port.h | |
| | | | |
| skipping to change at line 61 | | skipping to change at line 61 | |
| // GTEST_HAS_PTHREAD - Define it to 1/0 to indicate that <pthread.
h> | | // GTEST_HAS_PTHREAD - Define it to 1/0 to indicate that <pthread.
h> | |
| // is/isn't available. | | // is/isn't available. | |
| // GTEST_HAS_RTTI - Define it to 1/0 to indicate that RTTI is/i
sn't | | // GTEST_HAS_RTTI - Define it to 1/0 to indicate that RTTI is/i
sn't | |
| // enabled. | | // enabled. | |
| // GTEST_HAS_STD_STRING - Define it to 1/0 to indicate that | | // GTEST_HAS_STD_STRING - Define it to 1/0 to indicate that | |
| // std::string does/doesn't work (Google Test
can | | // std::string does/doesn't work (Google Test
can | |
| // be used where std::string is unavailable). | | // be used where std::string is unavailable). | |
| // GTEST_HAS_STD_WSTRING - Define it to 1/0 to indicate that | | // GTEST_HAS_STD_WSTRING - Define it to 1/0 to indicate that | |
| // std::wstring does/doesn't work (Google Test
can | | // std::wstring does/doesn't work (Google Test
can | |
| // be used where std::wstring is unavailable). | | // be used where std::wstring is unavailable). | |
|
| // GTEST_HAS_TR1_TUPLE 1 - Define it to 1/0 to indicate tr1::tuple | | // GTEST_HAS_TR1_TUPLE - Define it to 1/0 to indicate tr1::tuple | |
| // is/isn't available. | | // is/isn't available. | |
|
| | | // GTEST_HAS_SEH - Define it to 1/0 to indicate whether the | |
| | | // compiler supports Microsoft's "Structured | |
| | | // Exception Handling". | |
| | | // GTEST_USE_OWN_TR1_TUPLE - Define it to 1/0 to indicate whether Google | |
| | | // Test's own tr1 tuple implementation should | |
| | | be | |
| | | // used. Unused when the user sets | |
| | | // GTEST_HAS_TR1_TUPLE to 0. | |
| | | | |
| // This header defines the following utilities: | | // This header defines the following utilities: | |
| // | | // | |
| // Macros indicating the current platform (defined to 1 if compiled on | | // Macros indicating the current platform (defined to 1 if compiled on | |
| // the given platform; otherwise undefined): | | // the given platform; otherwise undefined): | |
| // GTEST_OS_CYGWIN - Cygwin | | // GTEST_OS_CYGWIN - Cygwin | |
| // GTEST_OS_LINUX - Linux | | // GTEST_OS_LINUX - Linux | |
| // GTEST_OS_MAC - Mac OS X | | // GTEST_OS_MAC - Mac OS X | |
| // GTEST_OS_SOLARIS - Sun Solaris | | // GTEST_OS_SOLARIS - Sun Solaris | |
| // GTEST_OS_SYMBIAN - Symbian | | // GTEST_OS_SYMBIAN - Symbian | |
|
| // GTEST_OS_WINDOWS - Windows | | // GTEST_OS_WINDOWS - Windows (Desktop, MinGW, or Mobile) | |
| | | // GTEST_OS_WINDOWS_DESKTOP - Windows Desktop | |
| | | // GTEST_OS_WINDOWS_MINGW - MinGW | |
| | | // GTEST_OS_WINODWS_MOBILE - Windows Mobile | |
| // GTEST_OS_ZOS - z/OS | | // GTEST_OS_ZOS - z/OS | |
| // | | // | |
| // Among the platforms, Cygwin, Linux, Max OS X, and Windows have the | | // Among the platforms, Cygwin, Linux, Max OS X, and Windows have the | |
| // most stable support. Since core members of the Google Test project | | // most stable support. Since core members of the Google Test project | |
| // don't have access to other platforms, support for them may be less | | // don't have access to other platforms, support for them may be less | |
| // stable. If you notice any problems on your platform, please notify | | // stable. If you notice any problems on your platform, please notify | |
| // googletestframework@googlegroups.com (patches for fixing them are | | // googletestframework@googlegroups.com (patches for fixing them are | |
| // even more welcome!). | | // even more welcome!). | |
| // | | // | |
| // Note that it is possible that none of the GTEST_OS_* macros are defined. | | // Note that it is possible that none of the GTEST_OS_* macros are defined. | |
| | | | |
| skipping to change at line 99 | | skipping to change at line 109 | |
| // GTEST_HAS_DEATH_TEST - death tests | | // GTEST_HAS_DEATH_TEST - death tests | |
| // GTEST_HAS_PARAM_TEST - value-parameterized tests | | // GTEST_HAS_PARAM_TEST - value-parameterized tests | |
| // GTEST_HAS_TYPED_TEST - typed tests | | // GTEST_HAS_TYPED_TEST - typed tests | |
| // GTEST_HAS_TYPED_TEST_P - type-parameterized tests | | // GTEST_HAS_TYPED_TEST_P - type-parameterized tests | |
| // GTEST_USES_POSIX_RE - enhanced POSIX regex is used. | | // GTEST_USES_POSIX_RE - enhanced POSIX regex is used. | |
| // GTEST_USES_SIMPLE_RE - our own simple regex is used; | | // GTEST_USES_SIMPLE_RE - our own simple regex is used; | |
| // the above two are mutually exclusive. | | // the above two are mutually exclusive. | |
| // | | // | |
| // Macros for basic C++ coding: | | // Macros for basic C++ coding: | |
| // GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning. | | // GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning. | |
|
| // GTEST_ATTRIBUTE_UNUSED_ - declares that a class' instances don't have | | // GTEST_ATTRIBUTE_UNUSED_ - declares that a class' instances or a | |
| to | | // variable don't have to be used. | |
| // be used. | | | |
| // GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=. | | // GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=. | |
| // GTEST_MUST_USE_RESULT_ - declares that a function's result must be u
sed. | | // GTEST_MUST_USE_RESULT_ - declares that a function's result must be u
sed. | |
| // | | // | |
| // Synchronization: | | // Synchronization: | |
| // Mutex, MutexLock, ThreadLocal, GetThreadCount() | | // Mutex, MutexLock, ThreadLocal, GetThreadCount() | |
| // - synchronization primitives. | | // - synchronization primitives. | |
| // GTEST_IS_THREADSAFE - defined to 1 to indicate that the above | | // GTEST_IS_THREADSAFE - defined to 1 to indicate that the above | |
| // synchronization primitives have real implementat
ions | | // synchronization primitives have real implementat
ions | |
| // and Google Test is thread-safe; or 0 otherwise. | | // and Google Test is thread-safe; or 0 otherwise. | |
| // | | // | |
| | | | |
| skipping to change at line 150 | | skipping to change at line 160 | |
| // GTEST_DECLARE_*() - declares a flag. | | // GTEST_DECLARE_*() - declares a flag. | |
| // GTEST_DEFINE_*() - defines a flag. | | // GTEST_DEFINE_*() - defines a flag. | |
| // GetArgvs() - returns the command line as a vector of strings. | | // GetArgvs() - returns the command line as a vector of strings. | |
| // | | // | |
| // Environment variable utilities: | | // Environment variable utilities: | |
| // GetEnv() - gets the value of an environment variable. | | // GetEnv() - gets the value of an environment variable. | |
| // BoolFromGTestEnv() - parses a bool environment variable. | | // BoolFromGTestEnv() - parses a bool environment variable. | |
| // Int32FromGTestEnv() - parses an Int32 environment variable. | | // Int32FromGTestEnv() - parses an Int32 environment variable. | |
| // StringFromGTestEnv() - parses a string environment variable. | | // StringFromGTestEnv() - parses a string environment variable. | |
| | | | |
|
| | | #include <stddef.h> // For ptrdiff_t | |
| #include <stdlib.h> | | #include <stdlib.h> | |
| #include <stdio.h> | | #include <stdio.h> | |
|
| #include <iostream> // Used for GTEST_CHECK_ | | #include <string.h> | |
| | | #ifndef _WIN32_WCE | |
| | | #include <sys/stat.h> | |
| | | #endif // !_WIN32_WCE | |
| | | | |
| | | #include <iostream> // NOLINT | |
| | | | |
| #define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com" | | #define GTEST_DEV_EMAIL_ "googletestframework@@googlegroups.com" | |
| #define GTEST_FLAG_PREFIX_ "gtest_" | | #define GTEST_FLAG_PREFIX_ "gtest_" | |
| #define GTEST_FLAG_PREFIX_UPPER_ "GTEST_" | | #define GTEST_FLAG_PREFIX_UPPER_ "GTEST_" | |
| #define GTEST_NAME_ "Google Test" | | #define GTEST_NAME_ "Google Test" | |
| #define GTEST_PROJECT_URL_ "http://code.google.com/p/googletest/" | | #define GTEST_PROJECT_URL_ "http://code.google.com/p/googletest/" | |
| | | | |
| // Determines the version of gcc that is used to compile this. | | // Determines the version of gcc that is used to compile this. | |
| #ifdef __GNUC__ | | #ifdef __GNUC__ | |
| // 40302 means version 4.3.2. | | // 40302 means version 4.3.2. | |
| #define GTEST_GCC_VER_ \ | | #define GTEST_GCC_VER_ \ | |
| (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__) | | (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__) | |
| #endif // __GNUC__ | | #endif // __GNUC__ | |
| | | | |
| // Determines the platform on which Google Test is compiled. | | // Determines the platform on which Google Test is compiled. | |
| #ifdef __CYGWIN__ | | #ifdef __CYGWIN__ | |
| #define GTEST_OS_CYGWIN 1 | | #define GTEST_OS_CYGWIN 1 | |
|
| #elif __SYMBIAN32__ | | #elif defined __SYMBIAN32__ | |
| #define GTEST_OS_SYMBIAN 1 | | #define GTEST_OS_SYMBIAN 1 | |
|
| #elif defined _MSC_VER | | #elif defined _WIN32 | |
| // TODO(kenton@google.com): GTEST_OS_WINDOWS is currently used to mean | | | |
| // both "The OS is Windows" and "The compiler is MSVC". These | | | |
| // meanings really should be separated in order to better support | | | |
| // Windows compilers other than MSVC. | | | |
| #define GTEST_OS_WINDOWS 1 | | #define GTEST_OS_WINDOWS 1 | |
|
| | | #ifdef _WIN32_WCE | |
| | | #define GTEST_OS_WINDOWS_MOBILE 1 | |
| | | #elif defined(__MINGW__) || defined(__MINGW32__) | |
| | | #define GTEST_OS_WINDOWS_MINGW 1 | |
| | | #else | |
| | | #define GTEST_OS_WINDOWS_DESKTOP 1 | |
| | | #endif // _WIN32_WCE | |
| #elif defined __APPLE__ | | #elif defined __APPLE__ | |
| #define GTEST_OS_MAC 1 | | #define GTEST_OS_MAC 1 | |
| #elif defined __linux__ | | #elif defined __linux__ | |
| #define GTEST_OS_LINUX 1 | | #define GTEST_OS_LINUX 1 | |
| #elif defined __MVS__ | | #elif defined __MVS__ | |
| #define GTEST_OS_ZOS 1 | | #define GTEST_OS_ZOS 1 | |
| #elif defined(__sun) && defined(__SVR4) | | #elif defined(__sun) && defined(__SVR4) | |
| #define GTEST_OS_SOLARIS 1 | | #define GTEST_OS_SOLARIS 1 | |
|
| #endif // _MSC_VER | | #endif // __CYGWIN__ | |
| | | | |
|
| #if GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC | | #if GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_SYMBIAN | | |
| | | | \ | |
| | | GTEST_OS_SOLARIS | |
| | | | |
| // On some platforms, <regex.h> needs someone to define size_t, and | | // On some platforms, <regex.h> needs someone to define size_t, and | |
| // won't compile otherwise. We can #include it here as we already | | // won't compile otherwise. We can #include it here as we already | |
| // included <stdlib.h>, which is guaranteed to define size_t through | | // included <stdlib.h>, which is guaranteed to define size_t through | |
| // <stddef.h>. | | // <stddef.h>. | |
| #include <regex.h> // NOLINT | | #include <regex.h> // NOLINT | |
|
| | | #include <strings.h> // NOLINT | |
| | | #include <sys/types.h> // NOLINT | |
| | | #include <unistd.h> // NOLINT | |
| | | | |
| #define GTEST_USES_POSIX_RE 1 | | #define GTEST_USES_POSIX_RE 1 | |
| | | | |
|
| | | #elif GTEST_OS_WINDOWS | |
| | | | |
| | | #if !GTEST_OS_WINDOWS_MOBILE | |
| | | #include <direct.h> // NOLINT | |
| | | #include <io.h> // NOLINT | |
| | | #endif | |
| | | | |
| | | // <regex.h> is not available on Windows. Use our own simple regex | |
| | | // implementation instead. | |
| | | #define GTEST_USES_SIMPLE_RE 1 | |
| | | | |
| #else | | #else | |
| | | | |
| // <regex.h> may not be available on this platform. Use our own | | // <regex.h> may not be available on this platform. Use our own | |
| // simple regex implementation instead. | | // simple regex implementation instead. | |
| #define GTEST_USES_SIMPLE_RE 1 | | #define GTEST_USES_SIMPLE_RE 1 | |
| | | | |
|
| #endif // GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC | | #endif // GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC || | |
| | | // GTEST_OS_SYMBIAN || GTEST_OS_SOLARIS | |
| | | | |
| // Defines GTEST_HAS_EXCEPTIONS to 1 if exceptions are enabled, or 0 | | // Defines GTEST_HAS_EXCEPTIONS to 1 if exceptions are enabled, or 0 | |
| // otherwise. | | // otherwise. | |
| | | | |
|
| #ifdef _MSC_VER // Compiled by MSVC? | | #if defined(_MSC_VER) || defined(__BORLANDC__) | |
| | | // MSVC's and C++Builder's implementations of the STL use the _HAS_EXCEPTIO | |
| | | NS | |
| | | // macro to enable exceptions, so we'll do the same. | |
| // Assumes that exceptions are enabled by default. | | // Assumes that exceptions are enabled by default. | |
|
| #ifndef _HAS_EXCEPTIONS // MSVC uses this macro to enable exceptions. | | #ifndef _HAS_EXCEPTIONS | |
| #define _HAS_EXCEPTIONS 1 | | #define _HAS_EXCEPTIONS 1 | |
| #endif // _HAS_EXCEPTIONS | | #endif // _HAS_EXCEPTIONS | |
| #define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS | | #define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS | |
|
| #else // The compiler is not MSVC. | | #else // The compiler is not MSVC or C++Builder. | |
| // gcc defines __EXCEPTIONS to 1 iff exceptions are enabled. For | | // gcc defines __EXCEPTIONS to 1 iff exceptions are enabled. For | |
| // other compilers, we assume exceptions are disabled to be | | // other compilers, we assume exceptions are disabled to be | |
| // conservative. | | // conservative. | |
| #if defined(__GNUC__) && __EXCEPTIONS | | #if defined(__GNUC__) && __EXCEPTIONS | |
| #define GTEST_HAS_EXCEPTIONS 1 | | #define GTEST_HAS_EXCEPTIONS 1 | |
| #else | | #else | |
| #define GTEST_HAS_EXCEPTIONS 0 | | #define GTEST_HAS_EXCEPTIONS 0 | |
| #endif // defined(__GNUC__) && __EXCEPTIONS | | #endif // defined(__GNUC__) && __EXCEPTIONS | |
|
| #endif // _MSC_VER | | #endif // defined(_MSC_VER) || defined(__BORLANDC__) | |
| | | | |
| // Determines whether ::std::string and ::string are available. | | // Determines whether ::std::string and ::string are available. | |
| | | | |
| #ifndef GTEST_HAS_STD_STRING | | #ifndef GTEST_HAS_STD_STRING | |
| // The user didn't tell us whether ::std::string is available, so we | | // The user didn't tell us whether ::std::string is available, so we | |
| // need to figure it out. The only environment that we know | | // need to figure it out. The only environment that we know | |
| // ::std::string is not available is MSVC 7.1 or lower with exceptions | | // ::std::string is not available is MSVC 7.1 or lower with exceptions | |
| // disabled. | | // disabled. | |
| #if defined(_MSC_VER) && (_MSC_VER < 1400) && !GTEST_HAS_EXCEPTIONS | | #if defined(_MSC_VER) && (_MSC_VER < 1400) && !GTEST_HAS_EXCEPTIONS | |
| #define GTEST_HAS_STD_STRING 0 | | #define GTEST_HAS_STD_STRING 0 | |
| | | | |
| skipping to change at line 325 | | skipping to change at line 363 | |
| #endif // _MSC_VER | | #endif // _MSC_VER | |
| | | | |
| #endif // GTEST_HAS_RTTI | | #endif // GTEST_HAS_RTTI | |
| | | | |
| // Determines whether <pthread.h> is available. | | // Determines whether <pthread.h> is available. | |
| #ifndef GTEST_HAS_PTHREAD | | #ifndef GTEST_HAS_PTHREAD | |
| // The user didn't tell us, so we need to figure it out. | | // The user didn't tell us, so we need to figure it out. | |
| #define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC) | | #define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC) | |
| #endif // GTEST_HAS_PTHREAD | | #endif // GTEST_HAS_PTHREAD | |
| | | | |
|
| // Determines whether tr1/tuple is available. If you have tr1/tuple | | // Determines whether Google Test can use tr1/tuple. You can define | |
| // on your platform, define GTEST_HAS_TR1_TUPLE=1 for both the Google | | // this macro to 0 to prevent Google Test from using tuple (any | |
| // Test project and your tests. If you would like Google Test to detect | | // feature depending on tuple with be disabled in this mode). | |
| // tr1/tuple on your platform automatically, please open an issue | | | |
| // ticket at http://code.google.com/p/googletest. | | | |
| #ifndef GTEST_HAS_TR1_TUPLE | | #ifndef GTEST_HAS_TR1_TUPLE | |
|
| | | // The user didn't tell us not to do it, so we assume it's OK. | |
| | | #define GTEST_HAS_TR1_TUPLE 1 | |
| | | #endif // GTEST_HAS_TR1_TUPLE | |
| | | | |
| | | // Determines whether Google Test's own tr1 tuple implementation | |
| | | // should be used. | |
| | | #ifndef GTEST_USE_OWN_TR1_TUPLE | |
| // The user didn't tell us, so we need to figure it out. | | // The user didn't tell us, so we need to figure it out. | |
| | | | |
|
| // GCC provides <tr1/tuple> since 4.0.0. | | // We use our own tr1 tuple if we aren't sure the user has an | |
| | | // implementation of it already. At this time, GCC 4.0.0+ is the only | |
| | | // mainstream compiler that comes with a TR1 tuple implementation. | |
| | | // MSVC 2008 (9.0) provides TR1 tuple in a 323 MB Feature Pack | |
| | | // download, which we cannot assume the user has. MSVC 2010 isn't | |
| | | // released yet. | |
| #if defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000) | | #if defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000) | |
|
| #define GTEST_HAS_TR1_TUPLE 1 | | #define GTEST_USE_OWN_TR1_TUPLE 0 | |
| #else | | #else | |
|
| #define GTEST_HAS_TR1_TUPLE 0 | | #define GTEST_USE_OWN_TR1_TUPLE 1 | |
| #endif // __GNUC__ | | #endif // defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000) | |
| #endif // GTEST_HAS_TR1_TUPLE | | | |
| | | #endif // GTEST_USE_OWN_TR1_TUPLE | |
| | | | |
| // To avoid conditional compilation everywhere, we make it | | // To avoid conditional compilation everywhere, we make it | |
| // gtest-port.h's responsibility to #include the header implementing | | // gtest-port.h's responsibility to #include the header implementing | |
| // tr1/tuple. | | // tr1/tuple. | |
| #if GTEST_HAS_TR1_TUPLE | | #if GTEST_HAS_TR1_TUPLE | |
|
| #if defined(__GNUC__) | | | |
| // GCC implements tr1/tuple in the <tr1/tuple> header. This does not | | #if GTEST_USE_OWN_TR1_TUPLE | |
| // conform to the TR1 spec, which requires the header to be <tuple>. | | #include <gtest/internal/gtest-tuple.h> | |
| | | #elif GTEST_OS_SYMBIAN | |
| | | | |
| | | // On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to | |
| | | // use STLport's tuple implementation, which unfortunately doesn't | |
| | | // work as the copy of STLport distributed with Symbian is incomplete. | |
| | | // By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to | |
| | | // use its own tuple implementation. | |
| | | #ifdef BOOST_HAS_TR1_TUPLE | |
| | | #undef BOOST_HAS_TR1_TUPLE | |
| | | #endif // BOOST_HAS_TR1_TUPLE | |
| | | | |
| | | // This prevents <boost/tr1/detail/config.hpp>, which defines | |
| | | // BOOST_HAS_TR1_TUPLE, from being #included by Boost's <tuple>. | |
| | | #define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED | |
| | | #include <tuple> | |
| | | | |
| | | #elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000) | |
| | | // GCC 4.0+ implements tr1/tuple in the <tr1/tuple> header. This does | |
| | | // not conform to the TR1 spec, which requires the header to be <tuple>. | |
| | | | |
| | | #if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302 | |
| | | // Until version 4.3.2, gcc has a bug that causes <tr1/functional>, | |
| | | // which is #included by <tr1/tuple>, to not compile when RTTI is | |
| | | // disabled. _TR1_FUNCTIONAL is the header guard for | |
| | | // <tr1/functional>. Hence the following #define is a hack to prevent | |
| | | // <tr1/functional> from being included. | |
| | | #define _TR1_FUNCTIONAL 1 | |
| #include <tr1/tuple> | | #include <tr1/tuple> | |
|
| | | #undef _TR1_FUNCTIONAL // Allows the user to #include | |
| | | // <tr1/functional> if he chooses to. | |
| #else | | #else | |
|
| // If the compiler is not GCC, we assume the user is using a | | #include <tr1/tuple> | |
| | | #endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302 | |
| | | | |
| | | #else | |
| | | // If the compiler is not GCC 4.0+, we assume the user is using a | |
| // spec-conforming TR1 implementation. | | // spec-conforming TR1 implementation. | |
| #include <tuple> | | #include <tuple> | |
|
| #endif // __GNUC__ | | #endif // GTEST_USE_OWN_TR1_TUPLE | |
| | | | |
| #endif // GTEST_HAS_TR1_TUPLE | | #endif // GTEST_HAS_TR1_TUPLE | |
| | | | |
| // Determines whether clone(2) is supported. | | // Determines whether clone(2) is supported. | |
| // Usually it will only be available on Linux, excluding | | // Usually it will only be available on Linux, excluding | |
| // Linux on the Itanium architecture. | | // Linux on the Itanium architecture. | |
| // Also see http://linux.die.net/man/2/clone. | | // Also see http://linux.die.net/man/2/clone. | |
| #ifndef GTEST_HAS_CLONE | | #ifndef GTEST_HAS_CLONE | |
| // The user didn't tell us, so we need to figure it out. | | // The user didn't tell us, so we need to figure it out. | |
| | | | |
| #if GTEST_OS_LINUX && !defined(__ia64__) | | #if GTEST_OS_LINUX && !defined(__ia64__) | |
| | | | |
| skipping to change at line 379 | | skipping to change at line 462 | |
| #endif // GTEST_HAS_CLONE | | #endif // GTEST_HAS_CLONE | |
| | | | |
| // Determines whether to support death tests. | | // Determines whether to support death tests. | |
| // Google Test does not support death tests for VC 7.1 and earlier for | | // Google Test does not support death tests for VC 7.1 and earlier for | |
| // these reasons: | | // these reasons: | |
| // 1. std::vector does not build in VC 7.1 when exceptions are disabled. | | // 1. std::vector does not build in VC 7.1 when exceptions are disabled. | |
| // 2. std::string does not build in VC 7.1 when exceptions are disabled | | // 2. std::string does not build in VC 7.1 when exceptions are disabled | |
| // (this is covered by GTEST_HAS_STD_STRING guard). | | // (this is covered by GTEST_HAS_STD_STRING guard). | |
| // 3. abort() in a VC 7.1 application compiled as GUI in debug config | | // 3. abort() in a VC 7.1 application compiled as GUI in debug config | |
| // pops up a dialog window that cannot be suppressed programmatically. | | // pops up a dialog window that cannot be suppressed programmatically. | |
|
| #if GTEST_HAS_STD_STRING && (GTEST_OS_LINUX || \ | | #if GTEST_HAS_STD_STRING && \ | |
| GTEST_OS_MAC || \ | | (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_CYGWIN || \ | |
| GTEST_OS_CYGWIN || \ | | (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || GTEST_OS_WINDOWS_MIN | |
| (GTEST_OS_WINDOWS && _MSC_VER >= 1400)) | | GW) | |
| #define GTEST_HAS_DEATH_TEST 1 | | #define GTEST_HAS_DEATH_TEST 1 | |
|
| #include <vector> | | #include <vector> // NOLINT | |
| #endif | | #endif | |
| | | | |
| // Determines whether to support value-parameterized tests. | | // Determines whether to support value-parameterized tests. | |
| | | | |
| #if defined(__GNUC__) || (_MSC_VER >= 1400) | | #if defined(__GNUC__) || (_MSC_VER >= 1400) | |
| // TODO(vladl@google.com): get the implementation rid of vector and list | | // TODO(vladl@google.com): get the implementation rid of vector and list | |
| // to compile on MSVC 7.1. | | // to compile on MSVC 7.1. | |
| #define GTEST_HAS_PARAM_TEST 1 | | #define GTEST_HAS_PARAM_TEST 1 | |
| #endif // defined(__GNUC__) || (_MSC_VER >= 1400) | | #endif // defined(__GNUC__) || (_MSC_VER >= 1400) | |
| | | | |
| | | | |
| skipping to change at line 430 | | skipping to change at line 512 | |
| // if (gate) | | // if (gate) | |
| // ASSERT_*(condition) << "Some message"; | | // ASSERT_*(condition) << "Some message"; | |
| // | | // | |
| // The "switch (0) case 0:" idiom is used to suppress this. | | // The "switch (0) case 0:" idiom is used to suppress this. | |
| #ifdef __INTEL_COMPILER | | #ifdef __INTEL_COMPILER | |
| #define GTEST_AMBIGUOUS_ELSE_BLOCKER_ | | #define GTEST_AMBIGUOUS_ELSE_BLOCKER_ | |
| #else | | #else | |
| #define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: // NOLINT | | #define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: // NOLINT | |
| #endif | | #endif | |
| | | | |
|
| // Use this annotation at the end of a struct / class definition to | | // Use this annotation at the end of a struct/class definition to | |
| // prevent the compiler from optimizing away instances that are never | | // prevent the compiler from optimizing away instances that are never | |
| // used. This is useful when all interesting logic happens inside the | | // used. This is useful when all interesting logic happens inside the | |
| // c'tor and / or d'tor. Example: | | // c'tor and / or d'tor. Example: | |
| // | | // | |
| // struct Foo { | | // struct Foo { | |
| // Foo() { ... } | | // Foo() { ... } | |
| // } GTEST_ATTRIBUTE_UNUSED_; | | // } GTEST_ATTRIBUTE_UNUSED_; | |
|
| | | // | |
| | | // Also use it after a variable or parameter declaration to tell the | |
| | | // compiler the variable/parameter does not have to be used. | |
| #if defined(__GNUC__) && !defined(COMPILER_ICC) | | #if defined(__GNUC__) && !defined(COMPILER_ICC) | |
| #define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused)) | | #define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused)) | |
| #else | | #else | |
| #define GTEST_ATTRIBUTE_UNUSED_ | | #define GTEST_ATTRIBUTE_UNUSED_ | |
| #endif | | #endif | |
| | | | |
| // A macro to disallow the evil copy constructor and operator= functions | | // A macro to disallow the evil copy constructor and operator= functions | |
| // This should be used in the private: declarations for a class. | | // This should be used in the private: declarations for a class. | |
| #define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\ | | #define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\ | |
| type(const type &);\ | | type(const type &);\ | |
| | | | |
| skipping to change at line 461 | | skipping to change at line 546 | |
| // with this macro. The macro should be used on function declarations | | // with this macro. The macro should be used on function declarations | |
| // following the argument list: | | // following the argument list: | |
| // | | // | |
| // Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_; | | // Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_; | |
| #if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC
) | | #if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC
) | |
| #define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result)) | | #define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result)) | |
| #else | | #else | |
| #define GTEST_MUST_USE_RESULT_ | | #define GTEST_MUST_USE_RESULT_ | |
| #endif // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC | | #endif // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC | |
| | | | |
|
| | | // Determine whether the compiler supports Microsoft's Structured Exception | |
| | | // Handling. This is supported by several Windows compilers but generally | |
| | | // does not exist on any other system. | |
| | | #ifndef GTEST_HAS_SEH | |
| | | // The user didn't tell us, so we need to figure it out. | |
| | | | |
| | | #if defined(_MSC_VER) || defined(__BORLANDC__) | |
| | | // These two compilers are known to support SEH. | |
| | | #define GTEST_HAS_SEH 1 | |
| | | #else | |
| | | // Assume no SEH. | |
| | | #define GTEST_HAS_SEH 0 | |
| | | #endif | |
| | | | |
| | | #endif // GTEST_HAS_SEH | |
| | | | |
| namespace testing { | | namespace testing { | |
| | | | |
| class Message; | | class Message; | |
| | | | |
| namespace internal { | | namespace internal { | |
| | | | |
| class String; | | class String; | |
| | | | |
| // std::strstream is deprecated. However, we have to use it on | | // std::strstream is deprecated. However, we have to use it on | |
| // Windows as std::stringstream won't compile on Windows when | | // Windows as std::stringstream won't compile on Windows when | |
| // exceptions are disabled. We use std::stringstream on other | | // exceptions are disabled. We use std::stringstream on other | |
| // platforms to avoid compiler warnings there. | | // platforms to avoid compiler warnings there. | |
| #if GTEST_HAS_STD_STRING | | #if GTEST_HAS_STD_STRING | |
| typedef ::std::stringstream StrStream; | | typedef ::std::stringstream StrStream; | |
| #else | | #else | |
| typedef ::std::strstream StrStream; | | typedef ::std::strstream StrStream; | |
| #endif // GTEST_HAS_STD_STRING | | #endif // GTEST_HAS_STD_STRING | |
| | | | |
|
| | | // A helper for suppressing warnings on constant condition. It just | |
| | | // returns 'condition'. | |
| | | bool IsTrue(bool condition); | |
| | | | |
| // Defines scoped_ptr. | | // Defines scoped_ptr. | |
| | | | |
| // This implementation of scoped_ptr is PARTIAL - it only contains | | // This implementation of scoped_ptr is PARTIAL - it only contains | |
| // enough stuff to satisfy Google Test's need. | | // enough stuff to satisfy Google Test's need. | |
| template <typename T> | | template <typename T> | |
| class scoped_ptr { | | class scoped_ptr { | |
| public: | | public: | |
| explicit scoped_ptr(T* p = NULL) : ptr_(p) {} | | explicit scoped_ptr(T* p = NULL) : ptr_(p) {} | |
| ~scoped_ptr() { reset(); } | | ~scoped_ptr() { reset(); } | |
| | | | |
| | | | |
| skipping to change at line 501 | | skipping to change at line 606 | |
| T* get() const { return ptr_; } | | T* get() const { return ptr_; } | |
| | | | |
| T* release() { | | T* release() { | |
| T* const ptr = ptr_; | | T* const ptr = ptr_; | |
| ptr_ = NULL; | | ptr_ = NULL; | |
| return ptr; | | return ptr; | |
| } | | } | |
| | | | |
| void reset(T* p = NULL) { | | void reset(T* p = NULL) { | |
| if (p != ptr_) { | | if (p != ptr_) { | |
|
| if (sizeof(T) > 0) { // Makes sure T is a complete type. | | if (IsTrue(sizeof(T) > 0)) { // Makes sure T is a complete type. | |
| delete ptr_; | | delete ptr_; | |
| } | | } | |
| ptr_ = p; | | ptr_ = p; | |
| } | | } | |
| } | | } | |
| private: | | private: | |
| T* ptr_; | | T* ptr_; | |
| | | | |
| GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr); | | GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr); | |
| }; | | }; | |
| | | | |
| skipping to change at line 582 | | skipping to change at line 687 | |
| regex_t full_regex_; // For FullMatch(). | | regex_t full_regex_; // For FullMatch(). | |
| regex_t partial_regex_; // For PartialMatch(). | | regex_t partial_regex_; // For PartialMatch(). | |
| #else // GTEST_USES_SIMPLE_RE | | #else // GTEST_USES_SIMPLE_RE | |
| const char* full_pattern_; // For FullMatch(); | | const char* full_pattern_; // For FullMatch(); | |
| #endif | | #endif | |
| | | | |
| GTEST_DISALLOW_COPY_AND_ASSIGN_(RE); | | GTEST_DISALLOW_COPY_AND_ASSIGN_(RE); | |
| }; | | }; | |
| | | | |
| // Defines logging utilities: | | // Defines logging utilities: | |
|
| // GTEST_LOG_() - logs messages at the specified severity level. | | // GTEST_LOG_(severity) - logs messages at the specified severity level. | |
| | | The | |
| | | // message itself is streamed into the macro. | |
| // LogToStderr() - directs all log messages to stderr. | | // LogToStderr() - directs all log messages to stderr. | |
| // FlushInfoLog() - flushes informational log messages. | | // FlushInfoLog() - flushes informational log messages. | |
| | | | |
| enum GTestLogSeverity { | | enum GTestLogSeverity { | |
| GTEST_INFO, | | GTEST_INFO, | |
| GTEST_WARNING, | | GTEST_WARNING, | |
| GTEST_ERROR, | | GTEST_ERROR, | |
| GTEST_FATAL | | GTEST_FATAL | |
| }; | | }; | |
| | | | |
|
| void GTestLog(GTestLogSeverity severity, const char* file, | | // Formats log entry severity, provides a stream object for streaming the | |
| int line, const char* msg); | | // log message, and terminates the message with a newline when going out of | |
| | | // scope. | |
| | | class GTestLog { | |
| | | public: | |
| | | GTestLog(GTestLogSeverity severity, const char* file, int line); | |
| | | | |
|
| #define GTEST_LOG_(severity, msg)\ | | // Flushes the buffers and, if severity is GTEST_FATAL, aborts the progra | |
| ::testing::internal::GTestLog(\ | | m. | |
| ::testing::internal::GTEST_##severity, __FILE__, __LINE__, \ | | ~GTestLog(); | |
| (::testing::Message() << (msg)).GetString().c_str()) | | | |
| | | ::std::ostream& GetStream() { return ::std::cerr; } | |
| | | | |
| | | private: | |
| | | const GTestLogSeverity severity_; | |
| | | | |
| | | GTEST_DISALLOW_COPY_AND_ASSIGN_(GTestLog); | |
| | | }; | |
| | | | |
| | | #define GTEST_LOG_(severity) \ | |
| | | ::testing::internal::GTestLog(::testing::internal::GTEST_##severity, \ | |
| | | __FILE__, __LINE__).GetStream() | |
| | | | |
| inline void LogToStderr() {} | | inline void LogToStderr() {} | |
| inline void FlushInfoLog() { fflush(NULL); } | | inline void FlushInfoLog() { fflush(NULL); } | |
| | | | |
| // Defines the stderr capturer: | | // Defines the stderr capturer: | |
| // CaptureStderr - starts capturing stderr. | | // CaptureStderr - starts capturing stderr. | |
| // GetCapturedStderr - stops capturing stderr and returns the captured st
ring. | | // GetCapturedStderr - stops capturing stderr and returns the captured st
ring. | |
| | | | |
|
| #if GTEST_HAS_STD_STRING | | | |
| void CaptureStderr(); | | void CaptureStderr(); | |
|
| ::std::string GetCapturedStderr(); | | String GetCapturedStderr(); | |
| #endif // GTEST_HAS_STD_STRING | | | |
| | | | |
| #if GTEST_HAS_DEATH_TEST | | #if GTEST_HAS_DEATH_TEST | |
| | | | |
| // A copy of all command line arguments. Set by InitGoogleTest(). | | // A copy of all command line arguments. Set by InitGoogleTest(). | |
| extern ::std::vector<String> g_argvs; | | extern ::std::vector<String> g_argvs; | |
| | | | |
| // GTEST_HAS_DEATH_TEST implies we have ::std::string. | | // GTEST_HAS_DEATH_TEST implies we have ::std::string. | |
| const ::std::vector<String>& GetArgvs(); | | const ::std::vector<String>& GetArgvs(); | |
| | | | |
| #endif // GTEST_HAS_DEATH_TEST | | #endif // GTEST_HAS_DEATH_TEST | |
| | | | |
| skipping to change at line 661 | | skipping to change at line 779 | |
| ThreadLocal() : value_() {} | | ThreadLocal() : value_() {} | |
| explicit ThreadLocal(const T& value) : value_(value) {} | | explicit ThreadLocal(const T& value) : value_(value) {} | |
| T* pointer() { return &value_; } | | T* pointer() { return &value_; } | |
| const T* pointer() const { return &value_; } | | const T* pointer() const { return &value_; } | |
| const T& get() const { return value_; } | | const T& get() const { return value_; } | |
| void set(const T& value) { value_ = value; } | | void set(const T& value) { value_ = value; } | |
| private: | | private: | |
| T value_; | | T value_; | |
| }; | | }; | |
| | | | |
|
| // There's no portable way to detect the number of threads, so we just | | // Returns the number of threads running in the process, or 0 to indicate t | |
| // return 0 to indicate that we cannot detect it. | | hat | |
| inline size_t GetThreadCount() { return 0; } | | // we cannot detect it. | |
| | | size_t GetThreadCount(); | |
| | | | |
| // The above synchronization primitives have dummy implementations. | | // The above synchronization primitives have dummy implementations. | |
| // Therefore Google Test is not thread-safe. | | // Therefore Google Test is not thread-safe. | |
| #define GTEST_IS_THREADSAFE 0 | | #define GTEST_IS_THREADSAFE 0 | |
| | | | |
| #if defined(__SYMBIAN32__) || defined(__IBMCPP__) | | #if defined(__SYMBIAN32__) || defined(__IBMCPP__) | |
| | | | |
| // Passing non-POD classes through ellipsis (...) crashes the ARM | | // Passing non-POD classes through ellipsis (...) crashes the ARM | |
| // compiler. The Nokia Symbian and the IBM XL C/C++ compiler try to | | // compiler. The Nokia Symbian and the IBM XL C/C++ compiler try to | |
| // instantiate a copy constructor for objects passed through ellipsis | | // instantiate a copy constructor for objects passed through ellipsis | |
| | | | |
| skipping to change at line 704 | | skipping to change at line 822 | |
| typedef bool_constant<true> true_type; | | typedef bool_constant<true> true_type; | |
| | | | |
| template <typename T> | | template <typename T> | |
| struct is_pointer : public false_type {}; | | struct is_pointer : public false_type {}; | |
| | | | |
| template <typename T> | | template <typename T> | |
| struct is_pointer<T*> : public true_type {}; | | struct is_pointer<T*> : public true_type {}; | |
| | | | |
| #if GTEST_OS_WINDOWS | | #if GTEST_OS_WINDOWS | |
| #define GTEST_PATH_SEP_ "\\" | | #define GTEST_PATH_SEP_ "\\" | |
|
| | | // The biggest signed integer type the compiler supports. | |
| | | typedef __int64 BiggestInt; | |
| #else | | #else | |
| #define GTEST_PATH_SEP_ "/" | | #define GTEST_PATH_SEP_ "/" | |
|
| | | typedef long long BiggestInt; // NOLINT | |
| #endif // GTEST_OS_WINDOWS | | #endif // GTEST_OS_WINDOWS | |
| | | | |
|
| // Defines BiggestInt as the biggest signed integer type the compiler | | // The testing::internal::posix namespace holds wrappers for common | |
| // supports. | | // POSIX functions. These wrappers hide the differences between | |
| | | // Windows/MSVC and POSIX systems. Since some compilers define these | |
| | | // standard functions as macros, the wrapper cannot have the same name | |
| | | // as the wrapped function. | |
| | | | |
| | | namespace posix { | |
| | | | |
| | | // Functions with a different name on Windows. | |
| | | | |
| #if GTEST_OS_WINDOWS | | #if GTEST_OS_WINDOWS | |
|
| typedef __int64 BiggestInt; | | | |
| | | typedef struct _stat StatStruct; | |
| | | | |
| | | #ifdef __BORLANDC__ | |
| | | inline int IsATTY(int fd) { return isatty(fd); } | |
| | | inline int StrCaseCmp(const char* s1, const char* s2) { | |
| | | return stricmp(s1, s2); | |
| | | } | |
| | | inline char* StrDup(const char* src) { return strdup(src); } | |
| | | #else // !__BORLANDC__ | |
| | | #if GTEST_OS_WINDOWS_MOBILE | |
| | | inline int IsATTY(int /* fd */) { return 0; } | |
| #else | | #else | |
|
| typedef long long BiggestInt; // NOLINT | | inline int IsATTY(int fd) { return _isatty(fd); } | |
| | | #endif // GTEST_OS_WINDOWS_MOBILE | |
| | | inline int StrCaseCmp(const char* s1, const char* s2) { | |
| | | return _stricmp(s1, s2); | |
| | | } | |
| | | inline char* StrDup(const char* src) { return _strdup(src); } | |
| | | #endif // __BORLANDC__ | |
| | | | |
| | | #if GTEST_OS_WINDOWS_MOBILE | |
| | | inline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)) | |
| | | ; } | |
| | | // Stat(), RmDir(), and IsDir() are not needed on Windows CE at this | |
| | | // time and thus not defined there. | |
| | | #else | |
| | | inline int FileNo(FILE* file) { return _fileno(file); } | |
| | | inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf | |
| | | ); } | |
| | | inline int RmDir(const char* dir) { return _rmdir(dir); } | |
| | | inline bool IsDir(const StatStruct& st) { | |
| | | return (_S_IFDIR & st.st_mode) != 0; | |
| | | } | |
| | | #endif // GTEST_OS_WINDOWS_MOBILE | |
| | | | |
| | | #else | |
| | | | |
| | | typedef struct stat StatStruct; | |
| | | | |
| | | inline int FileNo(FILE* file) { return fileno(file); } | |
| | | inline int IsATTY(int fd) { return isatty(fd); } | |
| | | inline int Stat(const char* path, StatStruct* buf) { return stat(path, buf) | |
| | | ; } | |
| | | inline int StrCaseCmp(const char* s1, const char* s2) { | |
| | | return strcasecmp(s1, s2); | |
| | | } | |
| | | inline char* StrDup(const char* src) { return strdup(src); } | |
| | | inline int RmDir(const char* dir) { return rmdir(dir); } | |
| | | inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); } | |
| | | | |
| #endif // GTEST_OS_WINDOWS | | #endif // GTEST_OS_WINDOWS | |
| | | | |
|
| | | // Functions deprecated by MSVC 8.0. | |
| | | | |
| | | #ifdef _MSC_VER | |
| | | // Temporarily disable warning 4996 (deprecated function). | |
| | | #pragma warning(push) | |
| | | #pragma warning(disable:4996) | |
| | | #endif | |
| | | | |
| | | inline const char* StrNCpy(char* dest, const char* src, size_t n) { | |
| | | return strncpy(dest, src, n); | |
| | | } | |
| | | | |
| | | // ChDir(), FReopen(), FDOpen(), Read(), Write(), Close(), and | |
| | | // StrError() aren't needed on Windows CE at this time and thus not | |
| | | // defined there. | |
| | | | |
| | | #if !GTEST_OS_WINDOWS_MOBILE | |
| | | inline int ChDir(const char* dir) { return chdir(dir); } | |
| | | #endif | |
| | | inline FILE* FOpen(const char* path, const char* mode) { | |
| | | return fopen(path, mode); | |
| | | } | |
| | | #if !GTEST_OS_WINDOWS_MOBILE | |
| | | inline FILE *FReopen(const char* path, const char* mode, FILE* stream) { | |
| | | return freopen(path, mode, stream); | |
| | | } | |
| | | inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); } | |
| | | #endif | |
| | | inline int FClose(FILE* fp) { return fclose(fp); } | |
| | | #if !GTEST_OS_WINDOWS_MOBILE | |
| | | inline int Read(int fd, void* buf, unsigned int count) { | |
| | | return static_cast<int>(read(fd, buf, count)); | |
| | | } | |
| | | inline int Write(int fd, const void* buf, unsigned int count) { | |
| | | return static_cast<int>(write(fd, buf, count)); | |
| | | } | |
| | | inline int Close(int fd) { return close(fd); } | |
| | | inline const char* StrError(int errnum) { return strerror(errnum); } | |
| | | #endif | |
| | | inline const char* GetEnv(const char* name) { | |
| | | #if GTEST_OS_WINDOWS_MOBILE | |
| | | // We are on Windows CE, which has no environment variables. | |
| | | return NULL; | |
| | | #elif defined(__BORLANDC__) | |
| | | // Environment variables which we programmatically clear will be set to t | |
| | | he | |
| | | // empty string rather than unset (NULL). Handle that case. | |
| | | const char* const env = getenv(name); | |
| | | return (env != NULL && env[0] != '\0') ? env : NULL; | |
| | | #else | |
| | | return getenv(name); | |
| | | #endif | |
| | | } | |
| | | | |
| | | #ifdef _MSC_VER | |
| | | #pragma warning(pop) // Restores the warning state. | |
| | | #endif | |
| | | | |
| | | #if GTEST_OS_WINDOWS_MOBILE | |
| | | // Windows CE has no C library. The abort() function is used in | |
| | | // several places in Google Test. This implementation provides a reasonable | |
| | | // imitation of standard behaviour. | |
| | | void Abort(); | |
| | | #else | |
| | | inline void Abort() { abort(); } | |
| | | #endif // GTEST_OS_WINDOWS_MOBILE | |
| | | | |
| | | } // namespace posix | |
| | | | |
| // The maximum number a BiggestInt can represent. This definition | | // The maximum number a BiggestInt can represent. This definition | |
| // works no matter BiggestInt is represented in one's complement or | | // works no matter BiggestInt is represented in one's complement or | |
| // two's complement. | | // two's complement. | |
| // | | // | |
| // We cannot rely on numeric_limits in STL, as __int64 and long long | | // We cannot rely on numeric_limits in STL, as __int64 and long long | |
| // are not part of standard C++ and numeric_limits doesn't need to be | | // are not part of standard C++ and numeric_limits doesn't need to be | |
| // defined for them. | | // defined for them. | |
| const BiggestInt kMaxBiggestInt = | | const BiggestInt kMaxBiggestInt = | |
| ~(static_cast<BiggestInt>(1) << (8*sizeof(BiggestInt) - 1)); | | ~(static_cast<BiggestInt>(1) << (8*sizeof(BiggestInt) - 1)); | |
| | | | |
| | | | |
| skipping to change at line 786 | | skipping to change at line 1028 | |
| | | | |
| // Integer types of known sizes. | | // Integer types of known sizes. | |
| typedef TypeWithSize<4>::Int Int32; | | typedef TypeWithSize<4>::Int Int32; | |
| typedef TypeWithSize<4>::UInt UInt32; | | typedef TypeWithSize<4>::UInt UInt32; | |
| typedef TypeWithSize<8>::Int Int64; | | typedef TypeWithSize<8>::Int Int64; | |
| typedef TypeWithSize<8>::UInt UInt64; | | typedef TypeWithSize<8>::UInt UInt64; | |
| typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseco
nds. | | typedef TypeWithSize<8>::Int TimeInMillis; // Represents time in milliseco
nds. | |
| | | | |
| // Utilities for command line flags and environment variables. | | // Utilities for command line flags and environment variables. | |
| | | | |
|
| // A wrapper for getenv() that works on Linux, Windows, and Mac OS. | | | |
| inline const char* GetEnv(const char* name) { | | | |
| #ifdef _WIN32_WCE // We are on Windows CE. | | | |
| // CE has no environment variables. | | | |
| return NULL; | | | |
| #elif GTEST_OS_WINDOWS // We are on Windows proper. | | | |
| // MSVC 8 deprecates getenv(), so we want to suppress warning 4996 | | | |
| // (deprecated function) there. | | | |
| #pragma warning(push) // Saves the current warning state. | | | |
| #pragma warning(disable:4996) // Temporarily disables warning 4996. | | | |
| return getenv(name); | | | |
| #pragma warning(pop) // Restores the warning state. | | | |
| #else // We are on Linux or Mac OS. | | | |
| return getenv(name); | | | |
| #endif | | | |
| } | | | |
| | | | |
| #ifdef _WIN32_WCE | | | |
| // Windows CE has no C library. The abort() function is used in | | | |
| // several places in Google Test. This implementation provides a reasonable | | | |
| // imitation of standard behaviour. | | | |
| void abort(); | | | |
| #else | | | |
| inline void abort() { ::abort(); } | | | |
| #endif // _WIN32_WCE | | | |
| | | | |
| // INTERNAL IMPLEMENTATION - DO NOT USE. | | // INTERNAL IMPLEMENTATION - DO NOT USE. | |
| // | | // | |
| // GTEST_CHECK_ is an all-mode assert. It aborts the program if the conditi
on | | // GTEST_CHECK_ is an all-mode assert. It aborts the program if the conditi
on | |
| // is not satisfied. | | // is not satisfied. | |
| // Synopsys: | | // Synopsys: | |
| // GTEST_CHECK_(boolean_condition); | | // GTEST_CHECK_(boolean_condition); | |
| // or | | // or | |
| // GTEST_CHECK_(boolean_condition) << "Additional message"; | | // GTEST_CHECK_(boolean_condition) << "Additional message"; | |
| // | | // | |
| // This checks the condition and if the condition is not satisfied | | // This checks the condition and if the condition is not satisfied | |
| // it prints message about the condition violation, including the | | // it prints message about the condition violation, including the | |
| // condition itself, plus additional message streamed into it, if any, | | // condition itself, plus additional message streamed into it, if any, | |
| // and then it aborts the program. It aborts the program irrespective of | | // and then it aborts the program. It aborts the program irrespective of | |
| // whether it is built in the debug mode or not. | | // whether it is built in the debug mode or not. | |
|
| class GTestCheckProvider { | | | |
| public: | | | |
| GTestCheckProvider(const char* condition, const char* file, int line) { | | | |
| FormatFileLocation(file, line); | | | |
| ::std::cerr << " ERROR: Condition " << condition << " failed. "; | | | |
| } | | | |
| ~GTestCheckProvider() { | | | |
| ::std::cerr << ::std::endl; | | | |
| abort(); | | | |
| } | | | |
| void FormatFileLocation(const char* file, int line) { | | | |
| if (file == NULL) | | | |
| file = "unknown file"; | | | |
| if (line < 0) { | | | |
| ::std::cerr << file << ":"; | | | |
| } else { | | | |
| #if _MSC_VER | | | |
| ::std::cerr << file << "(" << line << "):"; | | | |
| #else | | | |
| ::std::cerr << file << ":" << line << ":"; | | | |
| #endif | | | |
| } | | | |
| } | | | |
| ::std::ostream& GetStream() { return ::std::cerr; } | | | |
| }; | | | |
| #define GTEST_CHECK_(condition) \ | | #define GTEST_CHECK_(condition) \ | |
| GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ | | GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ | |
|
| if (condition) \ | | if (::testing::internal::IsTrue(condition)) \ | |
| ; \ | | ; \ | |
| else \ | | else \ | |
|
| ::testing::internal::GTestCheckProvider(\ | | GTEST_LOG_(FATAL) << "Condition " #condition " failed. " | |
| #condition, __FILE__, __LINE__).GetStream() | | | |
| | | | |
| // Macro for referencing flags. | | // Macro for referencing flags. | |
| #define GTEST_FLAG(name) FLAGS_gtest_##name | | #define GTEST_FLAG(name) FLAGS_gtest_##name | |
| | | | |
| // Macros for declaring flags. | | // Macros for declaring flags. | |
| #define GTEST_DECLARE_bool_(name) extern bool GTEST_FLAG(name) | | #define GTEST_DECLARE_bool_(name) extern bool GTEST_FLAG(name) | |
| #define GTEST_DECLARE_int32_(name) \ | | #define GTEST_DECLARE_int32_(name) \ | |
| extern ::testing::internal::Int32 GTEST_FLAG(name) | | extern ::testing::internal::Int32 GTEST_FLAG(name) | |
| #define GTEST_DECLARE_string_(name) \ | | #define GTEST_DECLARE_string_(name) \ | |
| extern ::testing::internal::String GTEST_FLAG(name) | | extern ::testing::internal::String GTEST_FLAG(name) | |
| | | | |
End of changes. 50 change blocks. |
| 112 lines changed or deleted | | 312 lines changed or added | |
|
| gtest.h | | gtest.h | |
| | | | |
| skipping to change at line 54 | | skipping to change at line 54 | |
| // to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user | | // to CHANGE WITHOUT NOTICE. Therefore DO NOT DEPEND ON IT in a user | |
| // program! | | // program! | |
| // | | // | |
| // Acknowledgment: Google Test borrowed the idea of automatic test | | // Acknowledgment: Google Test borrowed the idea of automatic test | |
| // registration from Barthelemy Dagenais' (barthelemy@prologique.com) | | // registration from Barthelemy Dagenais' (barthelemy@prologique.com) | |
| // easyUnit framework. | | // easyUnit framework. | |
| | | | |
| #ifndef GTEST_INCLUDE_GTEST_GTEST_H_ | | #ifndef GTEST_INCLUDE_GTEST_GTEST_H_ | |
| #define GTEST_INCLUDE_GTEST_GTEST_H_ | | #define GTEST_INCLUDE_GTEST_GTEST_H_ | |
| | | | |
|
| // The following platform macros are used throughout Google Test: | | | |
| // _WIN32_WCE Windows CE (set in project files) | | | |
| // | | | |
| // Note that even though _MSC_VER and _WIN32_WCE really indicate a compiler | | | |
| // and a Win32 implementation, respectively, we use them to indicate the | | | |
| // combination of compiler - Win 32 API - C library, since the code current | | | |
| ly | | | |
| // only supports: | | | |
| // Windows proper with Visual C++ and MS C library (_MSC_VER && !_WIN32_WCE | | | |
| ) and | | | |
| // Windows Mobile with Visual C++ and no C library (_WIN32_WCE). | | | |
| | | | |
| #include <limits> | | #include <limits> | |
| #include <gtest/internal/gtest-internal.h> | | #include <gtest/internal/gtest-internal.h> | |
| #include <gtest/internal/gtest-string.h> | | #include <gtest/internal/gtest-string.h> | |
| #include <gtest/gtest-death-test.h> | | #include <gtest/gtest-death-test.h> | |
| #include <gtest/gtest-message.h> | | #include <gtest/gtest-message.h> | |
| #include <gtest/gtest-param-test.h> | | #include <gtest/gtest-param-test.h> | |
| #include <gtest/gtest_prod.h> | | #include <gtest/gtest_prod.h> | |
| #include <gtest/gtest-test-part.h> | | #include <gtest/gtest-test-part.h> | |
| #include <gtest/gtest-typed-test.h> | | #include <gtest/gtest-typed-test.h> | |
| | | | |
| | | | |
| skipping to change at line 129 | | skipping to change at line 119 | |
| GTEST_DECLARE_bool_(list_tests); | | GTEST_DECLARE_bool_(list_tests); | |
| | | | |
| // This flag controls whether Google Test emits a detailed XML report to a
file | | // This flag controls whether Google Test emits a detailed XML report to a
file | |
| // in addition to its normal textual output. | | // in addition to its normal textual output. | |
| GTEST_DECLARE_string_(output); | | GTEST_DECLARE_string_(output); | |
| | | | |
| // This flags control whether Google Test prints the elapsed time for each | | // This flags control whether Google Test prints the elapsed time for each | |
| // test. | | // test. | |
| GTEST_DECLARE_bool_(print_time); | | GTEST_DECLARE_bool_(print_time); | |
| | | | |
|
| | | // This flag specifies the random number seed. | |
| | | GTEST_DECLARE_int32_(random_seed); | |
| | | | |
| // This flag sets how many times the tests are repeated. The default value | | // This flag sets how many times the tests are repeated. The default value | |
| // is 1. If the value is -1 the tests are repeating forever. | | // is 1. If the value is -1 the tests are repeating forever. | |
| GTEST_DECLARE_int32_(repeat); | | GTEST_DECLARE_int32_(repeat); | |
| | | | |
| // This flag controls whether Google Test includes Google Test internal | | // This flag controls whether Google Test includes Google Test internal | |
| // stack frames in failure stack traces. | | // stack frames in failure stack traces. | |
| GTEST_DECLARE_bool_(show_internal_stack_frames); | | GTEST_DECLARE_bool_(show_internal_stack_frames); | |
| | | | |
|
| | | // When this flag is specified, tests' order is randomized on every iterati | |
| | | on. | |
| | | GTEST_DECLARE_bool_(shuffle); | |
| | | | |
| // This flag specifies the maximum number of stack frames to be | | // This flag specifies the maximum number of stack frames to be | |
| // printed in a failure message. | | // printed in a failure message. | |
| GTEST_DECLARE_int32_(stack_trace_depth); | | GTEST_DECLARE_int32_(stack_trace_depth); | |
| | | | |
| // When this flag is specified, a failed assertion will throw an | | // When this flag is specified, a failed assertion will throw an | |
| // exception if exceptions are enabled, or exit the program with a | | // exception if exceptions are enabled, or exit the program with a | |
| // non-zero code otherwise. | | // non-zero code otherwise. | |
| GTEST_DECLARE_bool_(throw_on_failure); | | GTEST_DECLARE_bool_(throw_on_failure); | |
| | | | |
| // The upper limit for valid stack trace depths. | | // The upper limit for valid stack trace depths. | |
| const int kMaxStackTraceDepth = 100; | | const int kMaxStackTraceDepth = 100; | |
| | | | |
| namespace internal { | | namespace internal { | |
| | | | |
|
| | | class AssertHelper; | |
| | | class DefaultGlobalTestPartResultReporter; | |
| | | class ExecDeathTest; | |
| | | class NoExecDeathTest; | |
| | | class FinalSuccessChecker; | |
| class GTestFlagSaver; | | class GTestFlagSaver; | |
|
| | | class TestInfoImpl; | |
| | | class TestResultAccessor; | |
| | | class TestEventListenersAccessor; | |
| | | class TestEventRepeater; | |
| | | class WindowsDeathTest; | |
| | | class UnitTestImpl* GetUnitTestImpl(); | |
| | | void ReportFailureInUnknownLocation(TestPartResult::Type result_type, | |
| | | const String& message); | |
| | | class PrettyUnitTestResultPrinter; | |
| | | class XmlUnitTestResultPrinter; | |
| | | | |
| // Converts a streamable value to a String. A NULL pointer is | | // Converts a streamable value to a String. A NULL pointer is | |
| // converted to "(null)". When the input value is a ::string, | | // converted to "(null)". When the input value is a ::string, | |
| // ::std::string, ::wstring, or ::std::wstring object, each NUL | | // ::std::string, ::wstring, or ::std::wstring object, each NUL | |
| // character in it is replaced with "\\0". | | // character in it is replaced with "\\0". | |
| // Declared in gtest-internal.h but defined here, so that it has access | | // Declared in gtest-internal.h but defined here, so that it has access | |
| // to the definition of the Message class, required by the ARM | | // to the definition of the Message class, required by the ARM | |
| // compiler. | | // compiler. | |
| template <typename T> | | template <typename T> | |
| String StreamableToString(const T& streamable) { | | String StreamableToString(const T& streamable) { | |
| | | | |
| skipping to change at line 282 | | skipping to change at line 293 | |
| // | | // | |
| // Google Test will call Foo::TearDownTestCase() after running the last | | // Google Test will call Foo::TearDownTestCase() after running the last | |
| // test in test case Foo. Hence a sub-class can define its own | | // test in test case Foo. Hence a sub-class can define its own | |
| // TearDownTestCase() method to shadow the one defined in the super | | // TearDownTestCase() method to shadow the one defined in the super | |
| // class. | | // class. | |
| static void TearDownTestCase() {} | | static void TearDownTestCase() {} | |
| | | | |
| // Returns true iff the current test has a fatal failure. | | // Returns true iff the current test has a fatal failure. | |
| static bool HasFatalFailure(); | | static bool HasFatalFailure(); | |
| | | | |
|
| | | // Returns true iff the current test has a non-fatal failure. | |
| | | static bool HasNonfatalFailure(); | |
| | | | |
| | | // Returns true iff the current test has a (either fatal or | |
| | | // non-fatal) failure. | |
| | | static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure | |
| | | (); } | |
| | | | |
| // Logs a property for the current test. Only the last value for a given | | // Logs a property for the current test. Only the last value for a given | |
| // key is remembered. | | // key is remembered. | |
| // These are public static so they can be called from utility functions | | // These are public static so they can be called from utility functions | |
| // that are not members of the test fixture. | | // that are not members of the test fixture. | |
| // The arguments are const char* instead strings, as Google Test is used | | // The arguments are const char* instead strings, as Google Test is used | |
| // on platforms where string doesn't compile. | | // on platforms where string doesn't compile. | |
| // | | // | |
| // Note that a driving consideration for these RecordProperty methods | | // Note that a driving consideration for these RecordProperty methods | |
| // was to produce xml output suited to the Greenspan charting utility, | | // was to produce xml output suited to the Greenspan charting utility, | |
| // which at present will only chart values that fit in a 32-bit int. It | | // which at present will only chart values that fit in a 32-bit int. It | |
| | | | |
| skipping to change at line 349 | | skipping to change at line 367 | |
| // | | // | |
| // If you see an error about overriding the following function or | | // If you see an error about overriding the following function or | |
| // about it being private, you have mis-spelled SetUp() as Setup(). | | // about it being private, you have mis-spelled SetUp() as Setup(). | |
| struct Setup_should_be_spelled_SetUp {}; | | struct Setup_should_be_spelled_SetUp {}; | |
| virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; } | | virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; } | |
| | | | |
| // We disallow copying Tests. | | // We disallow copying Tests. | |
| GTEST_DISALLOW_COPY_AND_ASSIGN_(Test); | | GTEST_DISALLOW_COPY_AND_ASSIGN_(Test); | |
| }; | | }; | |
| | | | |
|
| | | typedef internal::TimeInMillis TimeInMillis; | |
| | | | |
| | | // A copyable object representing a user specified test property which can | |
| | | be | |
| | | // output as a key/value string pair. | |
| | | // | |
| | | // Don't inherit from TestProperty as its destructor is not virtual. | |
| | | class TestProperty { | |
| | | public: | |
| | | // C'tor. TestProperty does NOT have a default constructor. | |
| | | // Always use this constructor (with parameters) to create a | |
| | | // TestProperty object. | |
| | | TestProperty(const char* key, const char* value) : | |
| | | key_(key), value_(value) { | |
| | | } | |
| | | | |
| | | // Gets the user supplied key. | |
| | | const char* key() const { | |
| | | return key_.c_str(); | |
| | | } | |
| | | | |
| | | // Gets the user supplied value. | |
| | | const char* value() const { | |
| | | return value_.c_str(); | |
| | | } | |
| | | | |
| | | // Sets a new value, overriding the one supplied in the constructor. | |
| | | void SetValue(const char* new_value) { | |
| | | value_ = new_value; | |
| | | } | |
| | | | |
| | | private: | |
| | | // The key supplied by the user. | |
| | | internal::String key_; | |
| | | // The value supplied by the user. | |
| | | internal::String value_; | |
| | | }; | |
| | | | |
| | | // The result of a single Test. This includes a list of | |
| | | // TestPartResults, a list of TestProperties, a count of how many | |
| | | // death tests there are in the Test, and how much time it took to run | |
| | | // the Test. | |
| | | // | |
| | | // TestResult is not copyable. | |
| | | class TestResult { | |
| | | public: | |
| | | // Creates an empty TestResult. | |
| | | TestResult(); | |
| | | | |
| | | // D'tor. Do not inherit from TestResult. | |
| | | ~TestResult(); | |
| | | | |
| | | // Gets the number of all test parts. This is the sum of the number | |
| | | // of successful test parts and the number of failed test parts. | |
| | | int total_part_count() const; | |
| | | | |
| | | // Returns the number of the test properties. | |
| | | int test_property_count() const; | |
| | | | |
| | | // Returns true iff the test passed (i.e. no test part failed). | |
| | | bool Passed() const { return !Failed(); } | |
| | | | |
| | | // Returns true iff the test failed. | |
| | | bool Failed() const; | |
| | | | |
| | | // Returns true iff the test fatally failed. | |
| | | bool HasFatalFailure() const; | |
| | | | |
| | | // Returns true iff the test has a non-fatal failure. | |
| | | bool HasNonfatalFailure() const; | |
| | | | |
| | | // Returns the elapsed time, in milliseconds. | |
| | | TimeInMillis elapsed_time() const { return elapsed_time_; } | |
| | | | |
| | | // Returns the i-th test part result among all the results. i can range | |
| | | // from 0 to test_property_count() - 1. If i is not in that range, aborts | |
| | | // the program. | |
| | | const TestPartResult& GetTestPartResult(int i) const; | |
| | | | |
| | | // Returns the i-th test property. i can range from 0 to | |
| | | // test_property_count() - 1. If i is not in that range, aborts the | |
| | | // program. | |
| | | const TestProperty& GetTestProperty(int i) const; | |
| | | | |
| | | private: | |
| | | friend class TestInfo; | |
| | | friend class UnitTest; | |
| | | friend class internal::DefaultGlobalTestPartResultReporter; | |
| | | friend class internal::ExecDeathTest; | |
| | | friend class internal::TestInfoImpl; | |
| | | friend class internal::TestResultAccessor; | |
| | | friend class internal::UnitTestImpl; | |
| | | friend class internal::WindowsDeathTest; | |
| | | | |
| | | // Gets the vector of TestPartResults. | |
| | | const internal::Vector<TestPartResult>& test_part_results() const { | |
| | | return *test_part_results_; | |
| | | } | |
| | | | |
| | | // Gets the vector of TestProperties. | |
| | | const internal::Vector<TestProperty>& test_properties() const { | |
| | | return *test_properties_; | |
| | | } | |
| | | | |
| | | // Sets the elapsed time. | |
| | | void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; } | |
| | | | |
| | | // Adds a test property to the list. The property is validated and may ad | |
| | | d | |
| | | // a non-fatal failure if invalid (e.g., if it conflicts with reserved | |
| | | // key names). If a property is already recorded for the same key, the | |
| | | // value will be updated, rather than storing multiple values for the sam | |
| | | e | |
| | | // key. | |
| | | void RecordProperty(const TestProperty& test_property); | |
| | | | |
| | | // Adds a failure if the key is a reserved attribute of Google Test | |
| | | // testcase tags. Returns true if the property is valid. | |
| | | // TODO(russr): Validate attribute names are legal and human readable. | |
| | | static bool ValidateTestProperty(const TestProperty& test_property); | |
| | | | |
| | | // Adds a test part result to the list. | |
| | | void AddTestPartResult(const TestPartResult& test_part_result); | |
| | | | |
| | | // Returns the death test count. | |
| | | int death_test_count() const { return death_test_count_; } | |
| | | | |
| | | // Increments the death test count, returning the new count. | |
| | | int increment_death_test_count() { return ++death_test_count_; } | |
| | | | |
| | | // Clears the test part results. | |
| | | void ClearTestPartResults(); | |
| | | | |
| | | // Clears the object. | |
| | | void Clear(); | |
| | | | |
| | | // Protects mutable state of the property vector and of owned | |
| | | // properties, whose values may be updated. | |
| | | internal::Mutex test_properites_mutex_; | |
| | | | |
| | | // The vector of TestPartResults | |
| | | internal::scoped_ptr<internal::Vector<TestPartResult> > test_part_results | |
| | | _; | |
| | | // The vector of TestProperties | |
| | | internal::scoped_ptr<internal::Vector<TestProperty> > test_properties_; | |
| | | // Running count of death tests. | |
| | | int death_test_count_; | |
| | | // The elapsed time, in milliseconds. | |
| | | TimeInMillis elapsed_time_; | |
| | | | |
| | | // We disallow copying TestResult. | |
| | | GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult); | |
| | | }; // class TestResult | |
| | | | |
| // A TestInfo object stores the following information about a test: | | // A TestInfo object stores the following information about a test: | |
| // | | // | |
| // Test case name | | // Test case name | |
| // Test name | | // Test name | |
| // Whether the test should be run | | // Whether the test should be run | |
| // A function pointer that creates the test object when invoked | | // A function pointer that creates the test object when invoked | |
| // Test result | | // Test result | |
| // | | // | |
| // The constructor of TestInfo registers itself with the UnitTest | | // The constructor of TestInfo registers itself with the UnitTest | |
| // singleton such that the RUN_ALL_TESTS() macro knows which tests to | | // singleton such that the RUN_ALL_TESTS() macro knows which tests to | |
| | | | |
| skipping to change at line 378 | | skipping to change at line 546 | |
| | | | |
| // Returns the test name. | | // Returns the test name. | |
| const char* name() const; | | const char* name() const; | |
| | | | |
| // Returns the test case comment. | | // Returns the test case comment. | |
| const char* test_case_comment() const; | | const char* test_case_comment() const; | |
| | | | |
| // Returns the test comment. | | // Returns the test comment. | |
| const char* comment() const; | | const char* comment() const; | |
| | | | |
|
| // Returns true if this test should run. | | // Returns true if this test should run, that is if the test is not disab | |
| | | led | |
| | | // (or it is disabled but the also_run_disabled_tests flag has been speci | |
| | | fied) | |
| | | // and its full name matches the user-specified filter. | |
| // | | // | |
| // Google Test allows the user to filter the tests by their full names. | | // Google Test allows the user to filter the tests by their full names. | |
| // The full name of a test Bar in test case Foo is defined as | | // The full name of a test Bar in test case Foo is defined as | |
| // "Foo.Bar". Only the tests that match the filter will run. | | // "Foo.Bar". Only the tests that match the filter will run. | |
| // | | // | |
| // A filter is a colon-separated list of glob (not regex) patterns, | | // A filter is a colon-separated list of glob (not regex) patterns, | |
| // optionally followed by a '-' and a colon-separated list of | | // optionally followed by a '-' and a colon-separated list of | |
| // negative patterns (tests to exclude). A test is run if it | | // negative patterns (tests to exclude). A test is run if it | |
| // matches one of the positive patterns and does not match any of | | // matches one of the positive patterns and does not match any of | |
| // the negative patterns. | | // the negative patterns. | |
| // | | // | |
| // For example, *A*:Foo.* is a filter that matches any string that | | // For example, *A*:Foo.* is a filter that matches any string that | |
| // contains the character 'A' or starts with "Foo.". | | // contains the character 'A' or starts with "Foo.". | |
| bool should_run() const; | | bool should_run() const; | |
| | | | |
| // Returns the result of the test. | | // Returns the result of the test. | |
|
| const internal::TestResult* result() const; | | const TestResult* result() const; | |
| | | | |
| private: | | private: | |
| #if GTEST_HAS_DEATH_TEST | | #if GTEST_HAS_DEATH_TEST | |
| friend class internal::DefaultDeathTestFactory; | | friend class internal::DefaultDeathTestFactory; | |
| #endif // GTEST_HAS_DEATH_TEST | | #endif // GTEST_HAS_DEATH_TEST | |
|
| friend class internal::TestInfoImpl; | | | |
| friend class internal::UnitTestImpl; | | | |
| friend class Test; | | friend class Test; | |
| friend class TestCase; | | friend class TestCase; | |
|
| | | friend class internal::TestInfoImpl; | |
| | | friend class internal::UnitTestImpl; | |
| friend TestInfo* internal::MakeAndRegisterTestInfo( | | friend TestInfo* internal::MakeAndRegisterTestInfo( | |
| const char* test_case_name, const char* name, | | const char* test_case_name, const char* name, | |
| const char* test_case_comment, const char* comment, | | const char* test_case_comment, const char* comment, | |
| internal::TypeId fixture_class_id, | | internal::TypeId fixture_class_id, | |
| Test::SetUpTestCaseFunc set_up_tc, | | Test::SetUpTestCaseFunc set_up_tc, | |
| Test::TearDownTestCaseFunc tear_down_tc, | | Test::TearDownTestCaseFunc tear_down_tc, | |
| internal::TestFactoryBase* factory); | | internal::TestFactoryBase* factory); | |
| | | | |
|
| | | // Returns true if this test matches the user-specified filter. | |
| | | bool matches_filter() const; | |
| | | | |
| // Increments the number of death tests encountered in this test so | | // Increments the number of death tests encountered in this test so | |
| // far. | | // far. | |
| int increment_death_test_count(); | | int increment_death_test_count(); | |
| | | | |
| // Accessors for the implementation object. | | // Accessors for the implementation object. | |
| internal::TestInfoImpl* impl() { return impl_; } | | internal::TestInfoImpl* impl() { return impl_; } | |
| const internal::TestInfoImpl* impl() const { return impl_; } | | const internal::TestInfoImpl* impl() const { return impl_; } | |
| | | | |
| // Constructs a TestInfo object. The newly constructed instance assumes | | // Constructs a TestInfo object. The newly constructed instance assumes | |
| // ownership of the factory object. | | // ownership of the factory object. | |
| | | | |
| skipping to change at line 433 | | skipping to change at line 607 | |
| const char* test_case_comment, const char* comment, | | const char* test_case_comment, const char* comment, | |
| internal::TypeId fixture_class_id, | | internal::TypeId fixture_class_id, | |
| internal::TestFactoryBase* factory); | | internal::TestFactoryBase* factory); | |
| | | | |
| // An opaque implementation object. | | // An opaque implementation object. | |
| internal::TestInfoImpl* impl_; | | internal::TestInfoImpl* impl_; | |
| | | | |
| GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo); | | GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo); | |
| }; | | }; | |
| | | | |
|
| | | // A test case, which consists of a vector of TestInfos. | |
| | | // | |
| | | // TestCase is not copyable. | |
| | | class TestCase { | |
| | | public: | |
| | | // Creates a TestCase with the given name. | |
| | | // | |
| | | // TestCase does NOT have a default constructor. Always use this | |
| | | // constructor to create a TestCase object. | |
| | | // | |
| | | // Arguments: | |
| | | // | |
| | | // name: name of the test case | |
| | | // set_up_tc: pointer to the function that sets up the test case | |
| | | // tear_down_tc: pointer to the function that tears down the test case | |
| | | TestCase(const char* name, const char* comment, | |
| | | Test::SetUpTestCaseFunc set_up_tc, | |
| | | Test::TearDownTestCaseFunc tear_down_tc); | |
| | | | |
| | | // Destructor of TestCase. | |
| | | virtual ~TestCase(); | |
| | | | |
| | | // Gets the name of the TestCase. | |
| | | const char* name() const { return name_.c_str(); } | |
| | | | |
| | | // Returns the test case comment. | |
| | | const char* comment() const { return comment_.c_str(); } | |
| | | | |
| | | // Returns true if any test in this test case should run. | |
| | | bool should_run() const { return should_run_; } | |
| | | | |
| | | // Gets the number of successful tests in this test case. | |
| | | int successful_test_count() const; | |
| | | | |
| | | // Gets the number of failed tests in this test case. | |
| | | int failed_test_count() const; | |
| | | | |
| | | // Gets the number of disabled tests in this test case. | |
| | | int disabled_test_count() const; | |
| | | | |
| | | // Get the number of tests in this test case that should run. | |
| | | int test_to_run_count() const; | |
| | | | |
| | | // Gets the number of all tests in this test case. | |
| | | int total_test_count() const; | |
| | | | |
| | | // Returns true iff the test case passed. | |
| | | bool Passed() const { return !Failed(); } | |
| | | | |
| | | // Returns true iff the test case failed. | |
| | | bool Failed() const { return failed_test_count() > 0; } | |
| | | | |
| | | // Returns the elapsed time, in milliseconds. | |
| | | TimeInMillis elapsed_time() const { return elapsed_time_; } | |
| | | | |
| | | // Returns the i-th test among all the tests. i can range from 0 to | |
| | | // total_test_count() - 1. If i is not in that range, returns NULL. | |
| | | const TestInfo* GetTestInfo(int i) const; | |
| | | | |
| | | private: | |
| | | friend class Test; | |
| | | friend class internal::UnitTestImpl; | |
| | | | |
| | | // Gets the (mutable) vector of TestInfos in this TestCase. | |
| | | internal::Vector<TestInfo*>& test_info_list() { return *test_info_list_; | |
| | | } | |
| | | | |
| | | // Gets the (immutable) vector of TestInfos in this TestCase. | |
| | | const internal::Vector<TestInfo *> & test_info_list() const { | |
| | | return *test_info_list_; | |
| | | } | |
| | | | |
| | | // Returns the i-th test among all the tests. i can range from 0 to | |
| | | // total_test_count() - 1. If i is not in that range, returns NULL. | |
| | | TestInfo* GetMutableTestInfo(int i); | |
| | | | |
| | | // Sets the should_run member. | |
| | | void set_should_run(bool should) { should_run_ = should; } | |
| | | | |
| | | // Adds a TestInfo to this test case. Will delete the TestInfo upon | |
| | | // destruction of the TestCase object. | |
| | | void AddTestInfo(TestInfo * test_info); | |
| | | | |
| | | // Clears the results of all tests in this test case. | |
| | | void ClearResult(); | |
| | | | |
| | | // Clears the results of all tests in the given test case. | |
| | | static void ClearTestCaseResult(TestCase* test_case) { | |
| | | test_case->ClearResult(); | |
| | | } | |
| | | | |
| | | // Runs every test in this TestCase. | |
| | | void Run(); | |
| | | | |
| | | // Returns true iff test passed. | |
| | | static bool TestPassed(const TestInfo * test_info); | |
| | | | |
| | | // Returns true iff test failed. | |
| | | static bool TestFailed(const TestInfo * test_info); | |
| | | | |
| | | // Returns true iff test is disabled. | |
| | | static bool TestDisabled(const TestInfo * test_info); | |
| | | | |
| | | // Returns true if the given test should run. | |
| | | static bool ShouldRunTest(const TestInfo *test_info); | |
| | | | |
| | | // Shuffles the tests in this test case. | |
| | | void ShuffleTests(internal::Random* random); | |
| | | | |
| | | // Restores the test order to before the first shuffle. | |
| | | void UnshuffleTests(); | |
| | | | |
| | | // Name of the test case. | |
| | | internal::String name_; | |
| | | // Comment on the test case. | |
| | | internal::String comment_; | |
| | | // The vector of TestInfos in their original order. It owns the | |
| | | // elements in the vector. | |
| | | const internal::scoped_ptr<internal::Vector<TestInfo*> > test_info_list_; | |
| | | // Provides a level of indirection for the test list to allow easy | |
| | | // shuffling and restoring the test order. The i-th element in this | |
| | | // vector is the index of the i-th test in the shuffled test list. | |
| | | const internal::scoped_ptr<internal::Vector<int> > test_indices_; | |
| | | // Pointer to the function that sets up the test case. | |
| | | Test::SetUpTestCaseFunc set_up_tc_; | |
| | | // Pointer to the function that tears down the test case. | |
| | | Test::TearDownTestCaseFunc tear_down_tc_; | |
| | | // True iff any test in this test case should run. | |
| | | bool should_run_; | |
| | | // Elapsed time, in milliseconds. | |
| | | TimeInMillis elapsed_time_; | |
| | | | |
| | | // We disallow copying TestCases. | |
| | | GTEST_DISALLOW_COPY_AND_ASSIGN_(TestCase); | |
| | | }; | |
| | | | |
| // An Environment object is capable of setting up and tearing down an | | // An Environment object is capable of setting up and tearing down an | |
| // environment. The user should subclass this to define his own | | // environment. The user should subclass this to define his own | |
| // environment(s). | | // environment(s). | |
| // | | // | |
| // An Environment object does the set-up and tear-down in virtual | | // An Environment object does the set-up and tear-down in virtual | |
| // methods SetUp() and TearDown() instead of the constructor and the | | // methods SetUp() and TearDown() instead of the constructor and the | |
| // destructor, as: | | // destructor, as: | |
| // | | // | |
| // 1. You cannot safely throw from a destructor. This is a problem | | // 1. You cannot safely throw from a destructor. This is a problem | |
| // as in some cases Google Test is used where exceptions are enabled,
and | | // as in some cases Google Test is used where exceptions are enabled,
and | |
| | | | |
| skipping to change at line 464 | | skipping to change at line 773 | |
| | | | |
| // Override this to define how to tear down the environment. | | // Override this to define how to tear down the environment. | |
| virtual void TearDown() {} | | virtual void TearDown() {} | |
| private: | | private: | |
| // If you see an error about overriding the following function or | | // If you see an error about overriding the following function or | |
| // about it being private, you have mis-spelled SetUp() as Setup(). | | // about it being private, you have mis-spelled SetUp() as Setup(). | |
| struct Setup_should_be_spelled_SetUp {}; | | struct Setup_should_be_spelled_SetUp {}; | |
| virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; } | | virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; } | |
| }; | | }; | |
| | | | |
|
| // A UnitTest consists of a list of TestCases. | | // The interface for tracing execution of tests. The methods are organized | |
| | | in | |
| | | // the order the corresponding events are fired. | |
| | | class TestEventListener { | |
| | | public: | |
| | | virtual ~TestEventListener() {} | |
| | | | |
| | | // Fired before any test activity starts. | |
| | | virtual void OnTestProgramStart(const UnitTest& unit_test) = 0; | |
| | | | |
| | | // Fired before each iteration of tests starts. There may be more than | |
| | | // one iteration if GTEST_FLAG(repeat) is set. iteration is the iteration | |
| | | // index, starting from 0. | |
| | | virtual void OnTestIterationStart(const UnitTest& unit_test, | |
| | | int iteration) = 0; | |
| | | | |
| | | // Fired before environment set-up for each iteration of tests starts. | |
| | | virtual void OnEnvironmentsSetUpStart(const UnitTest& unit_test) = 0; | |
| | | | |
| | | // Fired after environment set-up for each iteration of tests ends. | |
| | | virtual void OnEnvironmentsSetUpEnd(const UnitTest& unit_test) = 0; | |
| | | | |
| | | // Fired before the test case starts. | |
| | | virtual void OnTestCaseStart(const TestCase& test_case) = 0; | |
| | | | |
| | | // Fired before the test starts. | |
| | | virtual void OnTestStart(const TestInfo& test_info) = 0; | |
| | | | |
| | | // Fired after a failed assertion or a SUCCESS(). | |
| | | virtual void OnTestPartResult(const TestPartResult& test_part_result) = 0 | |
| | | ; | |
| | | | |
| | | // Fired after the test ends. | |
| | | virtual void OnTestEnd(const TestInfo& test_info) = 0; | |
| | | | |
| | | // Fired after the test case ends. | |
| | | virtual void OnTestCaseEnd(const TestCase& test_case) = 0; | |
| | | | |
| | | // Fired before environment tear-down for each iteration of tests starts. | |
| | | virtual void OnEnvironmentsTearDownStart(const UnitTest& unit_test) = 0; | |
| | | | |
| | | // Fired after environment tear-down for each iteration of tests ends. | |
| | | virtual void OnEnvironmentsTearDownEnd(const UnitTest& unit_test) = 0; | |
| | | | |
| | | // Fired after each iteration of tests finishes. | |
| | | virtual void OnTestIterationEnd(const UnitTest& unit_test, | |
| | | int iteration) = 0; | |
| | | | |
| | | // Fired after all test activities have ended. | |
| | | virtual void OnTestProgramEnd(const UnitTest& unit_test) = 0; | |
| | | }; | |
| | | | |
| | | // The convenience class for users who need to override just one or two | |
| | | // methods and are not concerned that a possible change to a signature of | |
| | | // the methods they override will not be caught during the build. For | |
| | | // comments about each method please see the definition of TestEventListene | |
| | | r | |
| | | // above. | |
| | | class EmptyTestEventListener : public TestEventListener { | |
| | | public: | |
| | | virtual void OnTestProgramStart(const UnitTest& /*unit_test*/) {} | |
| | | virtual void OnTestIterationStart(const UnitTest& /*unit_test*/, | |
| | | int /*iteration*/) {} | |
| | | virtual void OnEnvironmentsSetUpStart(const UnitTest& /*unit_test*/) {} | |
| | | virtual void OnEnvironmentsSetUpEnd(const UnitTest& /*unit_test*/) {} | |
| | | virtual void OnTestCaseStart(const TestCase& /*test_case*/) {} | |
| | | virtual void OnTestStart(const TestInfo& /*test_info*/) {} | |
| | | virtual void OnTestPartResult(const TestPartResult& /*test_part_result*/) | |
| | | {} | |
| | | virtual void OnTestEnd(const TestInfo& /*test_info*/) {} | |
| | | virtual void OnTestCaseEnd(const TestCase& /*test_case*/) {} | |
| | | virtual void OnEnvironmentsTearDownStart(const UnitTest& /*unit_test*/) { | |
| | | } | |
| | | virtual void OnEnvironmentsTearDownEnd(const UnitTest& /*unit_test*/) {} | |
| | | virtual void OnTestIterationEnd(const UnitTest& /*unit_test*/, | |
| | | int /*iteration*/) {} | |
| | | virtual void OnTestProgramEnd(const UnitTest& /*unit_test*/) {} | |
| | | }; | |
| | | | |
| | | // TestEventListeners lets users add listeners to track events in Google Te | |
| | | st. | |
| | | class TestEventListeners { | |
| | | public: | |
| | | TestEventListeners(); | |
| | | ~TestEventListeners(); | |
| | | | |
| | | // Appends an event listener to the end of the list. Google Test assumes | |
| | | // the ownership of the listener (i.e. it will delete the listener when | |
| | | // the test program finishes). | |
| | | void Append(TestEventListener* listener); | |
| | | | |
| | | // Removes the given event listener from the list and returns it. It the | |
| | | n | |
| | | // becomes the caller's responsibility to delete the listener. Returns | |
| | | // NULL if the listener is not found in the list. | |
| | | TestEventListener* Release(TestEventListener* listener); | |
| | | | |
| | | // Returns the standard listener responsible for the default console | |
| | | // output. Can be removed from the listeners list to shut down default | |
| | | // console output. Note that removing this object from the listener list | |
| | | // with Release transfers its ownership to the caller and makes this | |
| | | // function return NULL the next time. | |
| | | TestEventListener* default_result_printer() const { | |
| | | return default_result_printer_; | |
| | | } | |
| | | | |
| | | // Returns the standard listener responsible for the default XML output | |
| | | // controlled by the --gtest_output=xml flag. Can be removed from the | |
| | | // listeners list by users who want to shut down the default XML output | |
| | | // controlled by this flag and substitute it with custom one. Note that | |
| | | // removing this object from the listener list with Release transfers its | |
| | | // ownership to the caller and makes this function return NULL the next | |
| | | // time. | |
| | | TestEventListener* default_xml_generator() const { | |
| | | return default_xml_generator_; | |
| | | } | |
| | | | |
| | | private: | |
| | | friend class TestCase; | |
| | | friend class internal::DefaultGlobalTestPartResultReporter; | |
| | | friend class internal::NoExecDeathTest; | |
| | | friend class internal::TestEventListenersAccessor; | |
| | | friend class internal::TestInfoImpl; | |
| | | friend class internal::UnitTestImpl; | |
| | | | |
| | | // Returns repeater that broadcasts the TestEventListener events to all | |
| | | // subscribers. | |
| | | TestEventListener* repeater(); | |
| | | | |
| | | // Sets the default_result_printer attribute to the provided listener. | |
| | | // The listener is also added to the listener list and previous | |
| | | // default_result_printer is removed from it and deleted. The listener ca | |
| | | n | |
| | | // also be NULL in which case it will not be added to the list. Does | |
| | | // nothing if the previous and the current listener objects are the same. | |
| | | void SetDefaultResultPrinter(TestEventListener* listener); | |
| | | | |
| | | // Sets the default_xml_generator attribute to the provided listener. Th | |
| | | e | |
| | | // listener is also added to the listener list and previous | |
| | | // default_xml_generator is removed from it and deleted. The listener can | |
| | | // also be NULL in which case it will not be added to the list. Does | |
| | | // nothing if the previous and the current listener objects are the same. | |
| | | void SetDefaultXmlGenerator(TestEventListener* listener); | |
| | | | |
| | | // Controls whether events will be forwarded by the repeater to the | |
| | | // listeners in the list. | |
| | | bool EventForwardingEnabled() const; | |
| | | void SuppressEventForwarding(); | |
| | | | |
| | | // The actual list of listeners. | |
| | | internal::TestEventRepeater* repeater_; | |
| | | // Listener responsible for the standard result output. | |
| | | TestEventListener* default_result_printer_; | |
| | | // Listener responsible for the creation of the XML output file. | |
| | | TestEventListener* default_xml_generator_; | |
| | | | |
| | | // We disallow copying TestEventListeners. | |
| | | GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventListeners); | |
| | | }; | |
| | | | |
| | | // A UnitTest consists of a vector of TestCases. | |
| // | | // | |
| // This is a singleton class. The only instance of UnitTest is | | // This is a singleton class. The only instance of UnitTest is | |
| // created when UnitTest::GetInstance() is first called. This | | // created when UnitTest::GetInstance() is first called. This | |
| // instance is never deleted. | | // instance is never deleted. | |
| // | | // | |
| // UnitTest is not copyable. | | // UnitTest is not copyable. | |
| // | | // | |
| // This class is thread-safe as long as the methods are called | | // This class is thread-safe as long as the methods are called | |
| // according to their specification. | | // according to their specification. | |
| class UnitTest { | | class UnitTest { | |
| public: | | public: | |
| // Gets the singleton UnitTest object. The first time this method | | // Gets the singleton UnitTest object. The first time this method | |
| // is called, a UnitTest object is constructed and returned. | | // is called, a UnitTest object is constructed and returned. | |
| // Consecutive calls will return the same object. | | // Consecutive calls will return the same object. | |
| static UnitTest* GetInstance(); | | static UnitTest* GetInstance(); | |
| | | | |
|
| // Registers and returns a global test environment. When a test | | | |
| // program is run, all global test environments will be set-up in | | | |
| // the order they were registered. After all tests in the program | | | |
| // have finished, all global test environments will be torn-down in | | | |
| // the *reverse* order they were registered. | | | |
| // | | | |
| // The UnitTest object takes ownership of the given environment. | | | |
| // | | | |
| // This method can only be called from the main thread. | | | |
| Environment* AddEnvironment(Environment* env); | | | |
| | | | |
| // Adds a TestPartResult to the current TestResult object. All | | | |
| // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc) | | | |
| // eventually call this to report their results. The user code | | | |
| // should use the assertion macros instead of calling this directly. | | | |
| // | | | |
| // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. | | | |
| void AddTestPartResult(TestPartResultType result_type, | | | |
| const char* file_name, | | | |
| int line_number, | | | |
| const internal::String& message, | | | |
| const internal::String& os_stack_trace); | | | |
| | | | |
| // Adds a TestProperty to the current TestResult object. If the result al | | | |
| ready | | | |
| // contains a property with the same key, the value will be updated. | | | |
| void RecordPropertyForCurrentTest(const char* key, const char* value); | | | |
| | | | |
| // Runs all tests in this UnitTest object and prints the result. | | // Runs all tests in this UnitTest object and prints the result. | |
| // Returns 0 if successful, or 1 otherwise. | | // Returns 0 if successful, or 1 otherwise. | |
| // | | // | |
| // This method can only be called from the main thread. | | // This method can only be called from the main thread. | |
| // | | // | |
| // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. | | // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. | |
| int Run() GTEST_MUST_USE_RESULT_; | | int Run() GTEST_MUST_USE_RESULT_; | |
| | | | |
| // Returns the working directory when the first TEST() or TEST_F() | | // Returns the working directory when the first TEST() or TEST_F() | |
| // was executed. The UnitTest object owns the string. | | // was executed. The UnitTest object owns the string. | |
| const char* original_working_dir() const; | | const char* original_working_dir() const; | |
| | | | |
| // Returns the TestCase object for the test that's currently running, | | // Returns the TestCase object for the test that's currently running, | |
| // or NULL if no test is running. | | // or NULL if no test is running. | |
| const TestCase* current_test_case() const; | | const TestCase* current_test_case() const; | |
| | | | |
| // Returns the TestInfo object for the test that's currently running, | | // Returns the TestInfo object for the test that's currently running, | |
| // or NULL if no test is running. | | // or NULL if no test is running. | |
| const TestInfo* current_test_info() const; | | const TestInfo* current_test_info() const; | |
| | | | |
|
| | | // Returns the random seed used at the start of the current test run. | |
| | | int random_seed() const; | |
| | | | |
| #if GTEST_HAS_PARAM_TEST | | #if GTEST_HAS_PARAM_TEST | |
| // Returns the ParameterizedTestCaseRegistry object used to keep track of | | // Returns the ParameterizedTestCaseRegistry object used to keep track of | |
| // value-parameterized tests and instantiate and register them. | | // value-parameterized tests and instantiate and register them. | |
|
| | | // | |
| | | // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM. | |
| internal::ParameterizedTestCaseRegistry& parameterized_test_registry(); | | internal::ParameterizedTestCaseRegistry& parameterized_test_registry(); | |
| #endif // GTEST_HAS_PARAM_TEST | | #endif // GTEST_HAS_PARAM_TEST | |
| | | | |
|
| | | // Gets the number of successful test cases. | |
| | | int successful_test_case_count() const; | |
| | | | |
| | | // Gets the number of failed test cases. | |
| | | int failed_test_case_count() const; | |
| | | | |
| | | // Gets the number of all test cases. | |
| | | int total_test_case_count() const; | |
| | | | |
| | | // Gets the number of all test cases that contain at least one test | |
| | | // that should run. | |
| | | int test_case_to_run_count() const; | |
| | | | |
| | | // Gets the number of successful tests. | |
| | | int successful_test_count() const; | |
| | | | |
| | | // Gets the number of failed tests. | |
| | | int failed_test_count() const; | |
| | | | |
| | | // Gets the number of disabled tests. | |
| | | int disabled_test_count() const; | |
| | | | |
| | | // Gets the number of all tests. | |
| | | int total_test_count() const; | |
| | | | |
| | | // Gets the number of tests that should run. | |
| | | int test_to_run_count() const; | |
| | | | |
| | | // Gets the elapsed time, in milliseconds. | |
| | | TimeInMillis elapsed_time() const; | |
| | | | |
| | | // Returns true iff the unit test passed (i.e. all test cases passed). | |
| | | bool Passed() const; | |
| | | | |
| | | // Returns true iff the unit test failed (i.e. some test case failed | |
| | | // or something outside of all tests failed). | |
| | | bool Failed() const; | |
| | | | |
| | | // Gets the i-th test case among all the test cases. i can range from 0 t | |
| | | o | |
| | | // total_test_case_count() - 1. If i is not in that range, returns NULL. | |
| | | const TestCase* GetTestCase(int i) const; | |
| | | | |
| | | // Returns the list of event listeners that can be used to track events | |
| | | // inside Google Test. | |
| | | TestEventListeners& listeners(); | |
| | | | |
| | | private: | |
| | | // Registers and returns a global test environment. When a test | |
| | | // program is run, all global test environments will be set-up in | |
| | | // the order they were registered. After all tests in the program | |
| | | // have finished, all global test environments will be torn-down in | |
| | | // the *reverse* order they were registered. | |
| | | // | |
| | | // The UnitTest object takes ownership of the given environment. | |
| | | // | |
| | | // This method can only be called from the main thread. | |
| | | Environment* AddEnvironment(Environment* env); | |
| | | | |
| | | // Adds a TestPartResult to the current TestResult object. All | |
| | | // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc) | |
| | | // eventually call this to report their results. The user code | |
| | | // should use the assertion macros instead of calling this directly. | |
| | | void AddTestPartResult(TestPartResult::Type result_type, | |
| | | const char* file_name, | |
| | | int line_number, | |
| | | const internal::String& message, | |
| | | const internal::String& os_stack_trace); | |
| | | | |
| | | // Adds a TestProperty to the current TestResult object. If the result al | |
| | | ready | |
| | | // contains a property with the same key, the value will be updated. | |
| | | void RecordPropertyForCurrentTest(const char* key, const char* value); | |
| | | | |
| | | // Gets the i-th test case among all the test cases. i can range from 0 t | |
| | | o | |
| | | // total_test_case_count() - 1. If i is not in that range, returns NULL. | |
| | | TestCase* GetMutableTestCase(int i); | |
| | | | |
| // Accessors for the implementation object. | | // Accessors for the implementation object. | |
| internal::UnitTestImpl* impl() { return impl_; } | | internal::UnitTestImpl* impl() { return impl_; } | |
| const internal::UnitTestImpl* impl() const { return impl_; } | | const internal::UnitTestImpl* impl() const { return impl_; } | |
|
| private: | | | |
| // ScopedTrace is a friend as it needs to modify the per-thread | | // These classes and funcions are friends as they need to access private | |
| // trace stack, which is a private member of UnitTest. | | // members of UnitTest. | |
| | | friend class Test; | |
| | | friend class internal::AssertHelper; | |
| friend class internal::ScopedTrace; | | friend class internal::ScopedTrace; | |
|
| | | friend Environment* AddGlobalTestEnvironment(Environment* env); | |
| | | friend internal::UnitTestImpl* internal::GetUnitTestImpl(); | |
| | | friend void internal::ReportFailureInUnknownLocation( | |
| | | TestPartResult::Type result_type, | |
| | | const internal::String& message); | |
| | | | |
| // Creates an empty UnitTest. | | // Creates an empty UnitTest. | |
| UnitTest(); | | UnitTest(); | |
| | | | |
| // D'tor | | // D'tor | |
| virtual ~UnitTest(); | | virtual ~UnitTest(); | |
| | | | |
| // Pushes a trace defined by SCOPED_TRACE() on to the per-thread | | // Pushes a trace defined by SCOPED_TRACE() on to the per-thread | |
| // Google Test trace stack. | | // Google Test trace stack. | |
| void PushGTestTrace(const internal::TraceInfo& trace); | | void PushGTestTrace(const internal::TraceInfo& trace); | |
| | | | |
| skipping to change at line 930 | | skipping to change at line 1452 | |
| const char* abs_error_expr, | | const char* abs_error_expr, | |
| double val1, | | double val1, | |
| double val2, | | double val2, | |
| double abs_error); | | double abs_error); | |
| | | | |
| // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. | | // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. | |
| // A class that enables one to stream messages to assertion macros | | // A class that enables one to stream messages to assertion macros | |
| class AssertHelper { | | class AssertHelper { | |
| public: | | public: | |
| // Constructor. | | // Constructor. | |
|
| AssertHelper(TestPartResultType type, const char* file, int line, | | AssertHelper(TestPartResult::Type type, | |
| | | const char* file, | |
| | | int line, | |
| const char* message); | | const char* message); | |
|
| | | ~AssertHelper(); | |
| | | | |
| // Message assignment is a semantic trick to enable assertion | | // Message assignment is a semantic trick to enable assertion | |
| // streaming; see the GTEST_MESSAGE_ macro below. | | // streaming; see the GTEST_MESSAGE_ macro below. | |
| void operator=(const Message& message) const; | | void operator=(const Message& message) const; | |
|
| | | | |
| private: | | private: | |
|
| TestPartResultType const type_; | | // We put our data in a struct so that the size of the AssertHelper class | |
| const char* const file_; | | can | |
| int const line_; | | // be as small as possible. This is important because gcc is incapable o | |
| String const message_; | | f | |
| | | // re-using stack space even for temporary variables, so every EXPECT_EQ | |
| | | // reserves stack space for another AssertHelper. | |
| | | struct AssertHelperData { | |
| | | AssertHelperData(TestPartResult::Type t, | |
| | | const char* srcfile, | |
| | | int line_num, | |
| | | const char* msg) | |
| | | : type(t), file(srcfile), line(line_num), message(msg) { } | |
| | | | |
| | | TestPartResult::Type const type; | |
| | | const char* const file; | |
| | | int const line; | |
| | | String const message; | |
| | | | |
| | | private: | |
| | | GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData); | |
| | | }; | |
| | | | |
| | | AssertHelperData* const data_; | |
| | | | |
| GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper); | | GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper); | |
| }; | | }; | |
| | | | |
| } // namespace internal | | } // namespace internal | |
| | | | |
| #if GTEST_HAS_PARAM_TEST | | #if GTEST_HAS_PARAM_TEST | |
| // The abstract base class that all value-parameterized tests inherit from. | | // The abstract base class that all value-parameterized tests inherit from. | |
| // | | // | |
| // This class adds support for accessing the test parameter value via | | // This class adds support for accessing the test parameter value via | |
| | | | |
End of changes. 24 change blocks. |
| 53 lines changed or deleted | | 617 lines changed or added | |
|