// Copyright 2007, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Google Mock - a framework for writing C++ mock classes. // // The ACTION* family of macros can be used in a namespace scope to // define custom actions easily. The syntax: // // ACTION(name) { statements; } // // will define an action with the given name that executes the // statements. The value returned by the statements will be used as // the return value of the action. Inside the statements, you can // refer to the K-th (0-based) argument of the mock function by // 'argK', and refer to its type by 'argK_type'. For example: // // ACTION(IncrementArg1) { // arg1_type temp = arg1; // return ++(*temp); // } // // allows you to write // // ...WillOnce(IncrementArg1()); // // You can also refer to the entire argument tuple and its type by // 'args' and 'args_type', and refer to the mock function type and its // return type by 'function_type' and 'return_type'. // // Note that you don't need to specify the types of the mock function // arguments. However rest assured that your code is still type-safe: // you'll get a compiler error if *arg1 doesn't support the ++ // operator, or if the type of ++(*arg1) isn't compatible with the // mock function's return type, for example. // // Sometimes you'll want to parameterize the action. For that you can use // another macro: // // ACTION_P(name, param_name) { statements; } // // For example: // // ACTION_P(Add, n) { return arg0 + n; } // // will allow you to write: // // ...WillOnce(Add(5)); // // Note that you don't need to provide the type of the parameter // either. If you need to reference the type of a parameter named // 'foo', you can write 'foo_type'. For example, in the body of // ACTION_P(Add, n) above, you can write 'n_type' to refer to the type // of 'n'. // // We also provide ACTION_P2, ACTION_P3, ..., up to ACTION_P10 to support // multi-parameter actions. // // For the purpose of typing, you can view // // ACTION_Pk(Foo, p1, ..., pk) { ... } // // as shorthand for // // template <typename p1_type, ..., typename pk_type> // FooActionPk<p1_type, ..., pk_type> Foo(p1_type p1, ..., pk_type pk) { ... } // // In particular, you can provide the template type arguments // explicitly when invoking Foo(), as in Foo<long, bool>(5, false); // although usually you can rely on the compiler to infer the types // for you automatically. You can assign the result of expression // Foo(p1, ..., pk) to a variable of type FooActionPk<p1_type, ..., // pk_type>. This can be useful when composing actions. // // You can also overload actions with different numbers of parameters: // // ACTION_P(Plus, a) { ... } // ACTION_P2(Plus, a, b) { ... } // // While it's tempting to always use the ACTION* macros when defining // a new action, you should also consider implementing ActionInterface // or using MakePolymorphicAction() instead, especially if you need to // use the action a lot. While these approaches require more work, // they give you more control on the types of the mock function // arguments and the action parameters, which in general leads to // better compiler error messages that pay off in the long run. They // also allow overloading actions based on parameter types (as opposed // to just based on the number of parameters). // // CAVEAT: // // ACTION*() can only be used in a namespace scope as templates cannot be // declared inside of a local class. // Users can, however, define any local functors (e.g. a lambda) that // can be used as actions. // // MORE INFORMATION: // // To learn more about using these macros, please search for 'ACTION' on // https://github.com/google/googletest/blob/main/docs/gmock_cook_book.md // IWYU pragma: private, include "gmock/gmock.h" // IWYU pragma: friend gmock/.* #ifndef GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ #define GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ #ifndef _WIN32_WCE #include <errno.h> #endif #include <algorithm> #include <functional> #include <memory> #include <string> #include <tuple> #include <type_traits> #include <utility> #include "gmock/internal/gmock-internal-utils.h" #include "gmock/internal/gmock-port.h" #include "gmock/internal/gmock-pp.h" GTEST_DISABLE_MSC_WARNINGS_PUSH_(…) namespace testing { // To implement an action Foo, define: // 1. a class FooAction that implements the ActionInterface interface, and // 2. a factory function that creates an Action object from a // const FooAction*. // // The two-level delegation design follows that of Matcher, providing // consistency for extension developers. It also eases ownership // management as Action objects can now be copied like plain values. internal // namespace internal // Specialized for function types below. template <typename F> class OnceAction; // An action that can only be used once. // // This is accepted by WillOnce, which doesn't require the underlying action to // be copy-constructible (only move-constructible), and promises to invoke it as // an rvalue reference. This allows the action to work with move-only types like // std::move_only_function in a type-safe manner. // // For example: // // // Assume we have some API that needs to accept a unique pointer to some // // non-copyable object Foo. // void AcceptUniquePointer(std::unique_ptr<Foo> foo); // // // We can define an action that provides a Foo to that API. Because It // // has to give away its unique pointer, it must not be called more than // // once, so its call operator is &&-qualified. // struct ProvideFoo { // std::unique_ptr<Foo> foo; // // void operator()() && { // AcceptUniquePointer(std::move(Foo)); // } // }; // // // This action can be used with WillOnce. // EXPECT_CALL(mock, Call) // .WillOnce(ProvideFoo{std::make_unique<Foo>(...)}); // // // But a call to WillRepeatedly will fail to compile. This is correct, // // since the action cannot correctly be used repeatedly. // EXPECT_CALL(mock, Call) // .WillRepeatedly(ProvideFoo{std::make_unique<Foo>(...)}); // // A less-contrived example would be an action that returns an arbitrary type, // whose &&-qualified call operator is capable of dealing with move-only types. OnceAction<Result (Args...)>; // When an unexpected function call is encountered, Google Mock will // let it return a default value if the user has specified one for its // return type, or if the return type has a built-in default value; // otherwise Google Mock won't know what value to return and will have // to abort the process. // // The DefaultValue<T> class allows a user to specify the // default value for a type T that is both copyable and publicly // destructible (i.e. anything that can be used as a function return // type). The usage is: // // // Sets the default value for type T to be foo. // DefaultValue<T>::Set(foo); template <typename T> class DefaultValue { … }; // This partial specialization allows a user to set default values for // reference types. DefaultValue<T &>; // This specialization allows DefaultValue<void>::Get() to // compile. template <> class DefaultValue<void> { … }; // Points to the user-set default value for type T. template <typename T> typename DefaultValue<T>::ValueProducer* DefaultValue<T>::producer_ = …; // Points to the user-set default value for type T&. template <typename T> T* DefaultValue<T&>::address_ = …; // Implement this interface to define an action for function type F. template <typename F> class ActionInterface { … }; template <typename F> class Action; // An Action<R(Args...)> is a copyable and IMMUTABLE (except by assignment) // object that represents an action to be taken when a mock function of type // R(Args...) is called. The implementation of Action<T> is just a // std::shared_ptr to const ActionInterface<T>. Don't inherit from Action! You // can view an object implementing ActionInterface<F> as a concrete action // (including its current state), and an Action<F> object as a handle to it. Action<R (Args...)>; // The PolymorphicAction class template makes it easy to implement a // polymorphic action (i.e. an action that can be used in mock // functions of than one type, e.g. Return()). // // To define a polymorphic action, a user first provides a COPYABLE // implementation class that has a Perform() method template: // // class FooAction { // public: // template <typename Result, typename ArgumentTuple> // Result Perform(const ArgumentTuple& args) const { // // Processes the arguments and returns a result, using // // std::get<N>(args) to get the N-th (0-based) argument in the tuple. // } // ... // }; // // Then the user creates the polymorphic action using // MakePolymorphicAction(object) where object has type FooAction. See // the definition of Return(void) and SetArgumentPointee<N>(value) for // complete examples. template <typename Impl> class PolymorphicAction { … }; // Creates an Action from its implementation and returns it. The // created Action object owns the implementation. template <typename F> Action<F> MakeAction(ActionInterface<F>* impl) { … } // Creates a polymorphic action from its implementation. This is // easier to use than the PolymorphicAction<Impl> constructor as it // doesn't require you to explicitly write the template argument, e.g. // // MakePolymorphicAction(foo); // vs // PolymorphicAction<TypeOfFoo>(foo); template <typename Impl> inline PolymorphicAction<Impl> MakePolymorphicAction(const Impl& impl) { … } namespace internal { // Helper struct to specialize ReturnAction to execute a move instead of a copy // on return. Useful for move-only types, but could be used on any type. template <typename T> struct ByMoveWrapper { … }; // The general implementation of Return(R). Specializations follow below. template <typename R> class ReturnAction final { … }; // A specialization of ReturnAction<R> when R is ByMoveWrapper<T> for some T. // // This version applies the type system-defeating hack of moving from T even in // the const call operator, checking at runtime that it isn't called more than // once, since the user has declared their intent to do so by using ByMove. ReturnAction<ByMoveWrapper<T>>; // Implements the ReturnNull() action. class ReturnNullAction { … }; // Implements the Return() action. class ReturnVoidAction { … }; // Implements the polymorphic ReturnRef(x) action, which can be used // in any function that returns a reference to the type of x, // regardless of the argument types. template <typename T> class ReturnRefAction { … }; // Implements the polymorphic ReturnRefOfCopy(x) action, which can be // used in any function that returns a reference to the type of x, // regardless of the argument types. template <typename T> class ReturnRefOfCopyAction { … }; // Implements the polymorphic ReturnRoundRobin(v) action, which can be // used in any function that returns the element_type of v. template <typename T> class ReturnRoundRobinAction { … }; // Implements the polymorphic DoDefault() action. class DoDefaultAction { … }; // Implements the Assign action to set a given pointer referent to a // particular value. template <typename T1, typename T2> class AssignAction { … }; #ifndef GTEST_OS_WINDOWS_MOBILE // Implements the SetErrnoAndReturn action to simulate return from // various system calls and libc functions. template <typename T> class SetErrnoAndReturnAction { … }; #endif // !GTEST_OS_WINDOWS_MOBILE // Implements the SetArgumentPointee<N>(x) action for any function // whose N-th argument (0-based) is a pointer to x's type. template <size_t N, typename A, typename = void> struct SetArgumentPointeeAction { … }; // Implements the Invoke(object_ptr, &Class::Method) action. template <class Class, typename MethodPtr> struct InvokeMethodAction { … }; // Implements the InvokeWithoutArgs(f) action. The template argument // FunctionImpl is the implementation type of f, which can be either a // function pointer or a functor. InvokeWithoutArgs(f) can be used as an // Action<F> as long as f's type is compatible with F. template <typename FunctionImpl> struct InvokeWithoutArgsAction { … }; // Implements the InvokeWithoutArgs(object_ptr, &Class::Method) action. template <class Class, typename MethodPtr> struct InvokeMethodWithoutArgsAction { … }; // Implements the IgnoreResult(action) action. template <typename A> class IgnoreResultAction { … }; template <typename InnerAction, size_t... I> struct WithArgsAction { … }; template <typename... Actions> class DoAllAction; // Base case: only a single action. DoAllAction<FinalAction>; // Recursive case: support N actions by calling the initial action and then // calling through to the base class containing N-1 actions. DoAllAction<InitialAction, OtherActions...>; template <typename T, typename... Params> struct ReturnNewAction { … }; template <size_t k> struct ReturnArgAction { … }; template <size_t k, typename Ptr> struct SaveArgAction { … }; template <size_t k, typename Ptr> struct SaveArgPointeeAction { … }; template <size_t k, typename T> struct SetArgRefereeAction { … }; template <size_t k, typename I1, typename I2> struct SetArrayArgumentAction { … }; template <size_t k> struct DeleteArgAction { … }; template <typename Ptr> struct ReturnPointeeAction { … }; #if GTEST_HAS_EXCEPTIONS template <typename T> struct ThrowAction { T exception; // We use a conversion operator to adapt to any return type. template <typename R, typename... Args> operator Action<R(Args...)>() const { // NOLINT T copy = exception; return [copy](Args...) -> R { throw copy; }; } }; #endif // GTEST_HAS_EXCEPTIONS } // namespace internal // An Unused object can be implicitly constructed from ANY value. // This is handy when defining actions that ignore some or all of the // mock function arguments. For example, given // // MOCK_METHOD3(Foo, double(const string& label, double x, double y)); // MOCK_METHOD3(Bar, double(int index, double x, double y)); // // instead of // // double DistanceToOriginWithLabel(const string& label, double x, double y) { // return sqrt(x*x + y*y); // } // double DistanceToOriginWithIndex(int index, double x, double y) { // return sqrt(x*x + y*y); // } // ... // EXPECT_CALL(mock, Foo("abc", _, _)) // .WillOnce(Invoke(DistanceToOriginWithLabel)); // EXPECT_CALL(mock, Bar(5, _, _)) // .WillOnce(Invoke(DistanceToOriginWithIndex)); // // you could write // // // We can declare any uninteresting argument as Unused. // double DistanceToOrigin(Unused, double x, double y) { // return sqrt(x*x + y*y); // } // ... // EXPECT_CALL(mock, Foo("abc", _, _)).WillOnce(Invoke(DistanceToOrigin)); // EXPECT_CALL(mock, Bar(5, _, _)).WillOnce(Invoke(DistanceToOrigin)); Unused; // Creates an action that does actions a1, a2, ..., sequentially in // each invocation. All but the last action will have a readonly view of the // arguments. template <typename... Action> internal::DoAllAction<typename std::decay<Action>::type...> DoAll( Action&&... 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 <size_t k, typename InnerAction> internal::WithArgsAction<typename std::decay<InnerAction>::type, k> WithArg( InnerAction&& action) { … } // WithArgs<N1, N2, ..., Nk>(an_action) creates an action that passes // the selected arguments of the mock function to an_action and // performs it. It serves as an adaptor between actions with // different argument lists. template <size_t k, size_t... ks, typename InnerAction> internal::WithArgsAction<typename std::decay<InnerAction>::type, k, ks...> WithArgs(InnerAction&& action) { … } // 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> internal::WithArgsAction<typename std::decay<InnerAction>::type> WithoutArgs( InnerAction&& action) { … } // Creates an action that returns a value. // // The returned type can be used with a mock function returning a non-void, // non-reference type U as follows: // // * If R is convertible to U and U is move-constructible, then the action can // be used with WillOnce. // // * If const R& is convertible to U and U is copy-constructible, then the // action can be used with both WillOnce and WillRepeatedly. // // The mock expectation contains the R value from which the U return value is // constructed (a move/copy of the argument to Return). This means that the R // value will survive at least until the mock object's expectations are cleared // or the mock object is destroyed, meaning that U can safely be a // reference-like type such as std::string_view: // // // The mock function returns a view of a copy of the string fed to // // Return. The view is valid even after the action is performed. // MockFunction<std::string_view()> mock; // EXPECT_CALL(mock, Call).WillOnce(Return(std::string("taco"))); // const std::string_view result = mock.AsStdFunction()(); // EXPECT_EQ("taco", result); // template <typename R> internal::ReturnAction<R> Return(R value) { … } // Creates an action that returns NULL. inline PolymorphicAction<internal::ReturnNullAction> ReturnNull() { … } // Creates an action that returns from a void function. inline PolymorphicAction<internal::ReturnVoidAction> Return() { … } // Creates an action that returns the reference to a variable. template <typename R> inline internal::ReturnRefAction<R> ReturnRef(R& x) { … } // Prevent using ReturnRef on reference to temporary. template <typename R, R* = nullptr> internal::ReturnRefAction<R> ReturnRef(R&&) = delete; // Creates an action that returns the reference to a copy of the // argument. The copy is created when the action is constructed and // lives as long as the action. template <typename R> inline internal::ReturnRefOfCopyAction<R> ReturnRefOfCopy(const R& x) { … } // DEPRECATED: use Return(x) directly with WillOnce. // // Modifies the parent action (a Return() action) to perform a move of the // argument instead of a copy. // Return(ByMove()) actions can only be executed once and will assert this // invariant. template <typename R> internal::ByMoveWrapper<R> ByMove(R x) { … } // Creates an action that returns an element of `vals`. Calling this action will // repeatedly return the next value from `vals` until it reaches the end and // will restart from the beginning. template <typename T> internal::ReturnRoundRobinAction<T> ReturnRoundRobin(std::vector<T> vals) { … } // Creates an action that returns an element of `vals`. Calling this action will // repeatedly return the next value from `vals` until it reaches the end and // will restart from the beginning. template <typename T> internal::ReturnRoundRobinAction<T> ReturnRoundRobin( std::initializer_list<T> vals) { … } // Creates an action that does the default action for the give mock function. inline internal::DoDefaultAction DoDefault() { … } // Creates an action that sets the variable pointed by the N-th // (0-based) function argument to 'value'. template <size_t N, typename T> internal::SetArgumentPointeeAction<N, T> SetArgPointee(T value) { … } // The following version is DEPRECATED. template <size_t N, typename T> internal::SetArgumentPointeeAction<N, T> SetArgumentPointee(T value) { … } // Creates an action that sets a pointer referent to a given value. template <typename T1, typename T2> PolymorphicAction<internal::AssignAction<T1, T2>> Assign(T1* ptr, T2 val) { … } #ifndef GTEST_OS_WINDOWS_MOBILE // Creates an action that sets errno and returns the appropriate error. template <typename T> PolymorphicAction<internal::SetErrnoAndReturnAction<T>> SetErrnoAndReturn( int errval, T result) { … } #endif // !GTEST_OS_WINDOWS_MOBILE // Various overloads for Invoke(). // Legacy function. // Actions can now be implicitly constructed from callables. No need to create // wrapper objects. // This function exists for backwards compatibility. template <typename FunctionImpl> typename std::decay<FunctionImpl>::type Invoke(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> internal::InvokeMethodAction<Class, MethodPtr> Invoke(Class* obj_ptr, MethodPtr method_ptr) { … } // Creates an action that invokes 'function_impl' with no argument. template <typename FunctionImpl> internal::InvokeWithoutArgsAction<typename std::decay<FunctionImpl>::type> InvokeWithoutArgs(FunctionImpl function_impl) { … } // Creates an action that invokes the given method on the given object // with no argument. template <class Class, typename MethodPtr> internal::InvokeMethodWithoutArgsAction<Class, MethodPtr> InvokeWithoutArgs( Class* obj_ptr, MethodPtr method_ptr) { … } // Creates an action that performs an_action and throws away its // result. In other words, it changes the return type of an_action to // void. an_action MUST NOT return void, or the code won't compile. template <typename A> inline internal::IgnoreResultAction<A> IgnoreResult(const A& an_action) { … } // 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) // // N.B. ByRef is redundant with std::ref, std::cref and std::reference_wrapper. // However, it may still be used for consistency with ByMove(). template <typename T> inline ::std::reference_wrapper<T> ByRef(T& l_value) { … } // 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. template <typename T, typename... Params> internal::ReturnNewAction<T, typename std::decay<Params>::type...> ReturnNew( Params&&... params) { … } // Action ReturnArg<k>() returns the k-th argument of the mock function. template <size_t k> internal::ReturnArgAction<k> ReturnArg() { … } // Action SaveArg<k>(pointer) saves the k-th (0-based) argument of the // mock function to *pointer. template <size_t k, typename Ptr> internal::SaveArgAction<k, Ptr> SaveArg(Ptr pointer) { … } // Action SaveArgPointee<k>(pointer) saves the value pointed to // by the k-th (0-based) argument of the mock function to *pointer. template <size_t k, typename Ptr> internal::SaveArgPointeeAction<k, Ptr> SaveArgPointee(Ptr pointer) { … } // Action SetArgReferee<k>(value) assigns 'value' to the variable // referenced by the k-th (0-based) argument of the mock function. template <size_t k, typename T> internal::SetArgRefereeAction<k, typename std::decay<T>::type> SetArgReferee( T&& value) { … } // Action SetArrayArgument<k>(first, last) copies the elements in // source range [first, last) to the array pointed to by the k-th // (0-based) argument, which can be either a pointer or an // iterator. The action does not take ownership of the elements in the // source range. template <size_t k, typename I1, typename I2> internal::SetArrayArgumentAction<k, I1, I2> SetArrayArgument(I1 first, I2 last) { … } // Action DeleteArg<k>() deletes the k-th (0-based) argument of the mock // function. template <size_t k> internal::DeleteArgAction<k> DeleteArg() { … } // This action returns the value pointed to by 'pointer'. template <typename Ptr> internal::ReturnPointeeAction<Ptr> ReturnPointee(Ptr pointer) { … } // Action Throw(exception) can be used in a mock function of any type // to throw the given exception. Any copyable value can be thrown. #if GTEST_HAS_EXCEPTIONS template <typename T> internal::ThrowAction<typename std::decay<T>::type> Throw(T&& exception) { return {std::forward<T>(exception)}; } #endif // GTEST_HAS_EXCEPTIONS namespace internal { // A macro from the ACTION* family (defined later in gmock-generated-actions.h) // 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 // function. For example, if such an action only uses the second // argument, it can be used in any mock function that takes >= 2 // arguments where the type of the second argument is compatible. // // Therefore, the action implementation must be prepared to take more // arguments than it needs. The ExcessiveArg type is used to // represent those excessive arguments. In order to keep the compiler // error messages tractable, we define it in the testing namespace // instead of testing::internal. However, this is an INTERNAL TYPE // and subject to change without notice, so a user MUST NOT USE THIS // TYPE DIRECTLY. struct ExcessiveArg { … }; // Builds an implementation of an Action<> for some particular signature, using // a class defined by an ACTION* macro. template <typename F, typename Impl> struct ActionImpl; template <typename Impl> struct ImplBase { … }; ActionImpl<R (Args...), Impl>; // Stores a default-constructed Impl as part of the Action<>'s // std::function<>. The Impl should be trivial to copy. template <typename F, typename Impl> ::testing::Action<F> MakeAction() { … } // Stores just the one given instance of Impl. template <typename F, typename Impl> ::testing::Action<F> MakeAction(std::shared_ptr<Impl> impl) { … } #define GMOCK_INTERNAL_ARG_UNUSED(i, data, el) … #define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_ … #define GMOCK_INTERNAL_ARG(i, data, el) … #define GMOCK_ACTION_ARG_TYPES_AND_NAMES_ … #define GMOCK_INTERNAL_TEMPLATE_ARG(i, data, el) … #define GMOCK_ACTION_TEMPLATE_ARGS_NAMES_ … #define GMOCK_INTERNAL_TYPENAME_PARAM(i, data, param) … #define GMOCK_ACTION_TYPENAME_PARAMS_(params) … #define GMOCK_INTERNAL_TYPE_PARAM(i, data, param) … #define GMOCK_ACTION_TYPE_PARAMS_(params) … #define GMOCK_INTERNAL_TYPE_GVALUE_PARAM(i, data, param) … #define GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params) … #define GMOCK_INTERNAL_GVALUE_PARAM(i, data, param) … #define GMOCK_ACTION_GVALUE_PARAMS_(params) … #define GMOCK_INTERNAL_INIT_PARAM(i, data, param) … #define GMOCK_ACTION_INIT_PARAMS_(params) … #define GMOCK_INTERNAL_FIELD_PARAM(i, data, param) … #define GMOCK_ACTION_FIELD_PARAMS_(params) … #define GMOCK_INTERNAL_ACTION(name, full_name, params) … } // namespace internal // Similar to GMOCK_INTERNAL_ACTION, but no bound parameters are stored. #define ACTION(name) … #define ACTION_P(name, ...) … #define ACTION_P2(name, ...) … #define ACTION_P3(name, ...) … #define ACTION_P4(name, ...) … #define ACTION_P5(name, ...) … #define ACTION_P6(name, ...) … #define ACTION_P7(name, ...) … #define ACTION_P8(name, ...) … #define ACTION_P9(name, ...) … #define ACTION_P10(name, ...) … } // namespace testing GTEST_DISABLE_MSC_WARNINGS_POP_(…) // 4100 #endif // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_