Sacado Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Namespaces | Macros | Typedefs | Functions
gmock-actions.h File Reference
#include <errno.h>
#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"
Include dependency graph for gmock-actions.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  testing::internal::BuiltInDefaultValueGetter< T, kDefaultConstructible >
 
struct  testing::internal::BuiltInDefaultValueGetter< T, false >
 
class  testing::internal::BuiltInDefaultValue< T >
 
class  testing::internal::BuiltInDefaultValue< const T >
 
class  testing::internal::BuiltInDefaultValue< T * >
 
class  testing::DefaultValue< T >
 
class  testing::DefaultValue< T >::ValueProducer
 
class  testing::DefaultValue< T >::FixedValueProducer
 
class  testing::DefaultValue< T >::FactoryValueProducer
 
class  testing::DefaultValue< T & >
 
class  testing::DefaultValue< void >
 
class  testing::ActionInterface< F >
 
class  testing::Action< F >
 
struct  testing::Action< F >::ActionAdapter
 
struct  testing::Action< F >::IgnoreArgs< FunctionImpl >
 
class  testing::PolymorphicAction< Impl >
 
class  testing::PolymorphicAction< Impl >::MonomorphicImpl< F >
 
struct  testing::internal::ByMoveWrapper< T >
 
class  testing::internal::ReturnAction< R >
 
class  testing::internal::ReturnAction< R >::Impl< R_, F >
 
class  testing::internal::ReturnAction< R >::Impl< ByMoveWrapper< R_ >, F >
 
class  testing::internal::ReturnNullAction
 
class  testing::internal::ReturnVoidAction
 
class  testing::internal::ReturnRefAction< T >
 
class  testing::internal::ReturnRefAction< T >::Impl< F >
 
class  testing::internal::ReturnRefOfCopyAction< T >
 
class  testing::internal::ReturnRefOfCopyAction< T >::Impl< F >
 
class  testing::internal::ReturnRoundRobinAction< T >
 
struct  testing::internal::ReturnRoundRobinAction< T >::State
 
class  testing::internal::DoDefaultAction
 
class  testing::internal::AssignAction< T1, T2 >
 
class  testing::internal::SetErrnoAndReturnAction< T >
 
struct  testing::internal::SetArgumentPointeeAction< N, A, typename >
 
struct  testing::internal::InvokeMethodAction< Class, MethodPtr >
 
struct  testing::internal::InvokeWithoutArgsAction< FunctionImpl >
 
struct  testing::internal::InvokeMethodWithoutArgsAction< Class, MethodPtr >
 
class  testing::internal::IgnoreResultAction< A >
 
class  testing::internal::IgnoreResultAction< A >::Impl< F >
 
struct  testing::internal::WithArgsAction< InnerAction, I >
 
struct  testing::internal::DoAllAction< Actions >
 
struct  testing::internal::ReturnNewAction< T, Params >
 
struct  testing::internal::ExcessiveArg
 
class  testing::internal::ActionHelper< Result, Impl >
 
class  testing::internal::ActionImpl< Derived >
 
class  testing::internal::ActionImpl< Derived< Ts...> >
 
struct  testing::internal::invoke_argument::AdlTag
 

Namespaces

 testing
 
 testing::internal
 
 testing::internal::invoke_argument
 

Macros

#define GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_(type, value)
 
#define GMOCK_INTERNAL_ARG_UNUSED(i, data, el)   , const arg##i##_type& arg##i GTEST_ATTRIBUTE_UNUSED_
 
#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_
 
#define GMOCK_INTERNAL_ARG(i, data, el)   , const arg##i##_type& arg##i
 
#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_   const args_type& args GMOCK_PP_REPEAT(GMOCK_INTERNAL_ARG, , 10)
 
#define GMOCK_INTERNAL_TEMPLATE_ARG(i, data, el)   , typename arg##i##_type
 
#define GMOCK_ACTION_TEMPLATE_ARGS_NAMES_   GMOCK_PP_TAIL(GMOCK_PP_REPEAT(GMOCK_INTERNAL_TEMPLATE_ARG, , 10))
 
#define GMOCK_INTERNAL_TYPENAME_PARAM(i, data, param)   , typename param##_type
 
#define GMOCK_ACTION_TYPENAME_PARAMS_(params)   GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_TYPENAME_PARAM, , params))
 
#define GMOCK_INTERNAL_TYPE_PARAM(i, data, param)   , param##_type
 
#define GMOCK_ACTION_TYPE_PARAMS_(params)   GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_TYPE_PARAM, , params))
 
#define GMOCK_INTERNAL_TYPE_GVALUE_PARAM(i, data, param)   , param##_type gmock_p##i
 
#define GMOCK_ACTION_TYPE_GVALUE_PARAMS_(params)   GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_TYPE_GVALUE_PARAM, , params))
 
#define GMOCK_INTERNAL_GVALUE_PARAM(i, data, param)   , std::forward<param##_type>(gmock_p##i)
 
#define GMOCK_ACTION_GVALUE_PARAMS_(params)   GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_GVALUE_PARAM, , params))
 
#define GMOCK_INTERNAL_INIT_PARAM(i, data, param)   , param(::std::forward<param##_type>(gmock_p##i))
 
#define GMOCK_ACTION_INIT_PARAMS_(params)   GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_INIT_PARAM, , params))
 
#define GMOCK_INTERNAL_FIELD_PARAM(i, data, param)   param##_type param;
 
#define GMOCK_ACTION_FIELD_PARAMS_(params)   GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_FIELD_PARAM, , params)
 
#define GMOCK_INTERNAL_ACTION(name, full_name, params)
 
#define ACTION(name)
 
#define ACTION_P(name,...)   GMOCK_INTERNAL_ACTION(name, name##ActionP, (__VA_ARGS__))
 
#define ACTION_P2(name,...)   GMOCK_INTERNAL_ACTION(name, name##ActionP2, (__VA_ARGS__))
 
#define ACTION_P3(name,...)   GMOCK_INTERNAL_ACTION(name, name##ActionP3, (__VA_ARGS__))
 
#define ACTION_P4(name,...)   GMOCK_INTERNAL_ACTION(name, name##ActionP4, (__VA_ARGS__))
 
#define ACTION_P5(name,...)   GMOCK_INTERNAL_ACTION(name, name##ActionP5, (__VA_ARGS__))
 
#define ACTION_P6(name,...)   GMOCK_INTERNAL_ACTION(name, name##ActionP6, (__VA_ARGS__))
 
#define ACTION_P7(name,...)   GMOCK_INTERNAL_ACTION(name, name##ActionP7, (__VA_ARGS__))
 
#define ACTION_P8(name,...)   GMOCK_INTERNAL_ACTION(name, name##ActionP8, (__VA_ARGS__))
 
#define ACTION_P9(name,...)   GMOCK_INTERNAL_ACTION(name, name##ActionP9, (__VA_ARGS__))
 
#define ACTION_P10(name,...)   GMOCK_INTERNAL_ACTION(name, name##ActionP10, (__VA_ARGS__))
 

Typedefs

template<typename P , typename Q >
using testing::internal::disjunction = typename::std::conditional< P::value, P, Q >::type
 
typedef internal::IgnoredValue testing::Unused
 

Functions

 testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (void,)
 
 testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (::std::string,"")
 
 testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (bool, false)
 
 testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (unsigned char, '\0')
 
 testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (signed char, '\0')
 
 testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (char, '\0')
 
 testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (unsigned short, 0U)
 
 testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (signed short, 0)
 
 testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (unsigned long, 0UL)
 
 testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (signed long, 0L)
 
 testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (unsigned long long, 0)
 
 testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (signed long long, 0)
 
 testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (float, 0)
 
 testing::internal::GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (double, 0)
 
template<typename F >
Action< Ftesting::MakeAction (ActionInterface< F > *impl)
 
template<typename Impl >
PolymorphicAction< Impl > testing::MakePolymorphicAction (const Impl &impl)
 
template<typename... Action>
internal::DoAllAction
< typename std::decay< Action >
::type...> 
testing::DoAll (Action &&...action)
 
template<size_t k, typename InnerAction >
internal::WithArgsAction
< typename std::decay
< InnerAction >::type, k > 
testing::WithArg (InnerAction &&action)
 
template<size_t k, size_t... ks, typename InnerAction >
internal::WithArgsAction
< typename std::decay
< InnerAction >::type, k,
ks...> 
testing::WithArgs (InnerAction &&action)
 
template<typename InnerAction >
internal::WithArgsAction
< typename std::decay
< InnerAction >::type > 
testing::WithoutArgs (InnerAction &&action)
 
template<typename R >
internal::ReturnAction< Rtesting::Return (R value)
 
PolymorphicAction
< internal::ReturnNullAction > 
testing::ReturnNull ()
 
PolymorphicAction
< internal::ReturnVoidAction > 
testing::Return ()
 
template<typename R >
internal::ReturnRefAction< Rtesting::ReturnRef (R &x)
 
template<typename R , R * = nullptr>
internal::ReturnRefAction< Rtesting::ReturnRef (R &&)=delete
 
template<typename R >
internal::ReturnRefOfCopyAction
< R
testing::ReturnRefOfCopy (const R &x)
 
template<typename R >
internal::ByMoveWrapper< Rtesting::ByMove (R x)
 
template<typename T >
internal::ReturnRoundRobinAction
< T
testing::ReturnRoundRobin (std::vector< T > vals)
 
template<typename T >
internal::ReturnRoundRobinAction
< T
testing::ReturnRoundRobin (std::initializer_list< T > vals)
 
internal::DoDefaultAction testing::DoDefault ()
 
template<size_t N, typename T >
internal::SetArgumentPointeeAction
< N, T
testing::SetArgPointee (T value)
 
template<size_t N, typename T >
internal::SetArgumentPointeeAction
< N, T
testing::SetArgumentPointee (T value)
 
template<typename T1 , typename T2 >
PolymorphicAction
< internal::AssignAction< T1,
T2 > > 
testing::Assign (T1 *ptr, T2 val)
 
template<typename T >
PolymorphicAction
< internal::SetErrnoAndReturnAction
< T > > 
testing::SetErrnoAndReturn (int errval, T result)
 
template<typename FunctionImpl >
std::decay< FunctionImpl >::type testing::Invoke (FunctionImpl &&function_impl)
 
template<class Class , typename MethodPtr >
internal::InvokeMethodAction
< Class, MethodPtr > 
testing::Invoke (Class *obj_ptr, MethodPtr method_ptr)
 
template<typename FunctionImpl >
internal::InvokeWithoutArgsAction
< typename std::decay
< FunctionImpl >::type > 
testing::InvokeWithoutArgs (FunctionImpl function_impl)
 
template<class Class , typename MethodPtr >
internal::InvokeMethodWithoutArgsAction
< Class, MethodPtr > 
testing::InvokeWithoutArgs (Class *obj_ptr, MethodPtr method_ptr)
 
template<typename A >
internal::IgnoreResultAction< Atesting::IgnoreResult (const A &an_action)
 
template<typename T >
inline::std::reference_wrapper< Ttesting::ByRef (T &l_value)
 
template<typename T , typename... Params>
internal::ReturnNewAction< T,
typename std::decay< Params >
::type...> 
testing::ReturnNew (Params &&...params)
 
template<typename F , typename... Args>
auto testing::internal::invoke_argument::InvokeArgumentAdl (AdlTag, F f, Args...args) -> decltype(f(args...))
 

Macro Definition Documentation

#define GMOCK_DEFINE_DEFAULT_ACTION_FOR_RETURN_TYPE_ (   type,
  value 
)
Value:
template <> \
class BuiltInDefaultValue<type> { \
public: \
static bool Exists() { return true; } \
static type Get() { return value; } \
}
int value

Definition at line 229 of file gmock-actions.h.

#define GMOCK_INTERNAL_ARG_UNUSED (   i,
  data,
  el 
)    , const arg##i##_type& arg##i GTEST_ATTRIBUTE_UNUSED_

Definition at line 1408 of file gmock-actions.h.

#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_
Value:
const args_type& args GTEST_ATTRIBUTE_UNUSED_ GMOCK_PP_REPEAT( \
#define GTEST_ATTRIBUTE_UNUSED_
Definition: gtest-port.h:665
#define GMOCK_INTERNAL_ARG_UNUSED(i, data, el)
#define GMOCK_PP_REPEAT(_Macro, _Data, _N)
Definition: gmock-pp.h:139

Definition at line 1410 of file gmock-actions.h.

#define GMOCK_INTERNAL_ARG (   i,
  data,
  el 
)    , const arg##i##_type& arg##i

Definition at line 1414 of file gmock-actions.h.

#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_   const args_type& args GMOCK_PP_REPEAT(GMOCK_INTERNAL_ARG, , 10)

Definition at line 1415 of file gmock-actions.h.

#define GMOCK_INTERNAL_TEMPLATE_ARG (   i,
  data,
  el 
)    , typename arg##i##_type

Definition at line 1418 of file gmock-actions.h.

#define GMOCK_ACTION_TEMPLATE_ARGS_NAMES_   GMOCK_PP_TAIL(GMOCK_PP_REPEAT(GMOCK_INTERNAL_TEMPLATE_ARG, , 10))

Definition at line 1419 of file gmock-actions.h.

#define GMOCK_INTERNAL_TYPENAME_PARAM (   i,
  data,
  param 
)    , typename param##_type

Definition at line 1422 of file gmock-actions.h.

#define GMOCK_ACTION_TYPENAME_PARAMS_ (   params)    GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_TYPENAME_PARAM, , params))

Definition at line 1423 of file gmock-actions.h.

#define GMOCK_INTERNAL_TYPE_PARAM (   i,
  data,
  param 
)    , param##_type

Definition at line 1426 of file gmock-actions.h.

#define GMOCK_ACTION_TYPE_PARAMS_ (   params)    GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_TYPE_PARAM, , params))

Definition at line 1427 of file gmock-actions.h.

#define GMOCK_INTERNAL_TYPE_GVALUE_PARAM (   i,
  data,
  param 
)    , param##_type gmock_p##i

Definition at line 1430 of file gmock-actions.h.

#define GMOCK_ACTION_TYPE_GVALUE_PARAMS_ (   params)    GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_TYPE_GVALUE_PARAM, , params))

Definition at line 1432 of file gmock-actions.h.

#define GMOCK_INTERNAL_GVALUE_PARAM (   i,
  data,
  param 
)    , std::forward<param##_type>(gmock_p##i)

Definition at line 1435 of file gmock-actions.h.

#define GMOCK_ACTION_GVALUE_PARAMS_ (   params)    GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_GVALUE_PARAM, , params))

Definition at line 1437 of file gmock-actions.h.

#define GMOCK_INTERNAL_INIT_PARAM (   i,
  data,
  param 
)    , param(::std::forward<param##_type>(gmock_p##i))

Definition at line 1440 of file gmock-actions.h.

#define GMOCK_ACTION_INIT_PARAMS_ (   params)    GMOCK_PP_TAIL(GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_INIT_PARAM, , params))

Definition at line 1442 of file gmock-actions.h.

#define GMOCK_INTERNAL_FIELD_PARAM (   i,
  data,
  param 
)    param##_type param;

Definition at line 1445 of file gmock-actions.h.

#define GMOCK_ACTION_FIELD_PARAMS_ (   params)    GMOCK_PP_FOR_EACH(GMOCK_INTERNAL_FIELD_PARAM, , params)

Definition at line 1446 of file gmock-actions.h.

#define GMOCK_INTERNAL_ACTION (   name,
  full_name,
  params 
)

Definition at line 1449 of file gmock-actions.h.

#define ACTION (   name)
Value:
class name##Action : public ::testing::internal::ActionImpl<name##Action> { \
\
public: \
using base_type::base_type; \
template <typename F> \
class gmock_Impl : public ::testing::ActionInterface<F> { \
public: \
typedef F function_type; \
typedef typename ::testing::internal::Function<F>::Result return_type; \
typedef \
typename ::testing::internal::Function<F>::ArgumentTuple args_type; \
gmock_Impl() {} \
return_type Perform(const args_type& args) override { \
return ::testing::internal::ActionHelper<return_type, \
gmock_Impl>::Perform(this, \
args); \
} \
template <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_> \
return_type gmock_PerformImpl(GMOCK_ACTION_ARG_TYPES_AND_NAMES_) const; \
}; \
}; \
inline name##Action name() { return name##Action(); } \
template <typename F> \
template <GMOCK_ACTION_TEMPLATE_ARGS_NAMES_> \
typename ::testing::internal::Function<F>::Result \
name##Action::gmock_Impl<F>::gmock_PerformImpl( \
#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_UNUSED_
#define GMOCK_ACTION_ARG_TYPES_AND_NAMES_

Definition at line 1492 of file gmock-actions.h.

#define ACTION_P (   name,
  ... 
)    GMOCK_INTERNAL_ACTION(name, name##ActionP, (__VA_ARGS__))

Definition at line 1522 of file gmock-actions.h.

#define ACTION_P2 (   name,
  ... 
)    GMOCK_INTERNAL_ACTION(name, name##ActionP2, (__VA_ARGS__))

Definition at line 1525 of file gmock-actions.h.

#define ACTION_P3 (   name,
  ... 
)    GMOCK_INTERNAL_ACTION(name, name##ActionP3, (__VA_ARGS__))

Definition at line 1528 of file gmock-actions.h.

#define ACTION_P4 (   name,
  ... 
)    GMOCK_INTERNAL_ACTION(name, name##ActionP4, (__VA_ARGS__))

Definition at line 1531 of file gmock-actions.h.

#define ACTION_P5 (   name,
  ... 
)    GMOCK_INTERNAL_ACTION(name, name##ActionP5, (__VA_ARGS__))

Definition at line 1534 of file gmock-actions.h.

#define ACTION_P6 (   name,
  ... 
)    GMOCK_INTERNAL_ACTION(name, name##ActionP6, (__VA_ARGS__))

Definition at line 1537 of file gmock-actions.h.

#define ACTION_P7 (   name,
  ... 
)    GMOCK_INTERNAL_ACTION(name, name##ActionP7, (__VA_ARGS__))

Definition at line 1540 of file gmock-actions.h.

#define ACTION_P8 (   name,
  ... 
)    GMOCK_INTERNAL_ACTION(name, name##ActionP8, (__VA_ARGS__))

Definition at line 1543 of file gmock-actions.h.

#define ACTION_P9 (   name,
  ... 
)    GMOCK_INTERNAL_ACTION(name, name##ActionP9, (__VA_ARGS__))

Definition at line 1546 of file gmock-actions.h.

#define ACTION_P10 (   name,
  ... 
)    GMOCK_INTERNAL_ACTION(name, name##ActionP10, (__VA_ARGS__))

Definition at line 1549 of file gmock-actions.h.