tesseract v5.3.3.20231005
testing::gmock_more_actions_test Namespace Reference

Namespaces

namespace  action_test
 

Classes

class  BoolResetter
 
class  DeletionTester
 
class  Foo
 
struct  GiantTemplate
 
struct  SumOf5Functor
 
struct  SumOf6Functor
 
class  TenArgConstructorClass
 
struct  UnaryFunctor
 

Functions

short Short (short n)
 
char Char (char ch)
 
int Nullary ()
 
bool Unary (int x)
 
bool ByConstRef (const std::string &s)
 
bool ReferencesGlobalDouble (const double &x)
 
const char * Binary (const char *input, short n)
 
int Ternary (int x, char y, short z)
 
int SumOf4 (int a, int b, int c, int d)
 
int SumOfFirst2 (int a, int b, Unused, Unused)
 
int SumOf5 (int a, int b, int c, int d, int e)
 
int SumOf6 (int a, int b, int c, int d, int e, int f)
 
std::string Concat7 (const char *s1, const char *s2, const char *s3, const char *s4, const char *s5, const char *s6, const char *s7)
 
std::string Concat8 (const char *s1, const char *s2, const char *s3, const char *s4, const char *s5, const char *s6, const char *s7, const char *s8)
 
std::string Concat9 (const char *s1, const char *s2, const char *s3, const char *s4, const char *s5, const char *s6, const char *s7, const char *s8, const char *s9)
 
std::string Concat10 (const char *s1, const char *s2, const char *s3, const char *s4, const char *s5, const char *s6, const char *s7, const char *s8, const char *s9, const char *s10)
 
 TEST (InvokeTest, Nullary)
 
 TEST (InvokeTest, Unary)
 
 TEST (InvokeTest, Binary)
 
 TEST (InvokeTest, Ternary)
 
 TEST (InvokeTest, FunctionThatTakes4Arguments)
 
 TEST (InvokeTest, FunctionThatTakes5Arguments)
 
 TEST (InvokeTest, FunctionThatTakes6Arguments)
 
const char * CharPtr (const char *s)
 
 TEST (InvokeTest, FunctionThatTakes7Arguments)
 
 TEST (InvokeTest, FunctionThatTakes8Arguments)
 
 TEST (InvokeTest, FunctionThatTakes9Arguments)
 
 TEST (InvokeTest, FunctionThatTakes10Arguments)
 
 TEST (InvokeTest, FunctionWithUnusedParameters)
 
 TEST (InvokeTest, MethodWithUnusedParameters)
 
 TEST (InvokeTest, Functor)
 
 TEST (InvokeTest, FunctionWithCompatibleType)
 
 TEST (InvokeMethodTest, Nullary)
 
 TEST (InvokeMethodTest, Unary)
 
 TEST (InvokeMethodTest, Binary)
 
 TEST (InvokeMethodTest, Ternary)
 
 TEST (InvokeMethodTest, MethodThatTakes4Arguments)
 
 TEST (InvokeMethodTest, MethodThatTakes5Arguments)
 
 TEST (InvokeMethodTest, MethodThatTakes6Arguments)
 
 TEST (InvokeMethodTest, MethodThatTakes7Arguments)
 
 TEST (InvokeMethodTest, MethodThatTakes8Arguments)
 
 TEST (InvokeMethodTest, MethodThatTakes9Arguments)
 
 TEST (InvokeMethodTest, MethodThatTakes10Arguments)
 
 TEST (InvokeMethodTest, MethodWithCompatibleType)
 
 TEST (WithoutArgsTest, NoArg)
 
 TEST (WithArgTest, OneArg)
 
 TEST (ReturnArgActionTest, WorksForOneArgIntArg0)
 
 TEST (ReturnArgActionTest, WorksForMultiArgBoolArg0)
 
 TEST (ReturnArgActionTest, WorksForMultiArgStringArg2)
 
 TEST (SaveArgActionTest, WorksForSameType)
 
 TEST (SaveArgActionTest, WorksForCompatibleType)
 
 TEST (SaveArgPointeeActionTest, WorksForSameType)
 
 TEST (SaveArgPointeeActionTest, WorksForCompatibleType)
 
 TEST (SetArgRefereeActionTest, WorksForSameType)
 
 TEST (SetArgRefereeActionTest, WorksForCompatibleType)
 
 TEST (SetArgRefereeActionTest, WorksWithExtraArguments)
 
 TEST (DeleteArgActionTest, OneArg)
 
 TEST (DeleteArgActionTest, TenArgs)
 
 TEST (SetArrayArgumentTest, SetsTheNthArray)
 
 TEST (SetArrayArgumentTest, SetsTheNthArrayWithEmptyRange)
 
 TEST (SetArrayArgumentTest, SetsTheNthArrayWithConvertibleType)
 
 TEST (SetArrayArgumentTest, SetsTheNthArrayWithIteratorArgument)
 
 TEST (ReturnPointeeTest, Works)
 
 TEST (InvokeArgumentTest, Function0)
 
 TEST (InvokeArgumentTest, Functor1)
 
 TEST (InvokeArgumentTest, Function5)
 
 TEST (InvokeArgumentTest, Functor5)
 
 TEST (InvokeArgumentTest, Function6)
 
 TEST (InvokeArgumentTest, Functor6)
 
 TEST (InvokeArgumentTest, Function7)
 
 TEST (InvokeArgumentTest, Function8)
 
 TEST (InvokeArgumentTest, Function9)
 
 TEST (InvokeArgumentTest, Function10)
 
 TEST (InvokeArgumentTest, ByPointerFunction)
 
 TEST (InvokeArgumentTest, FunctionWithCStringLiteral)
 
 TEST (InvokeArgumentTest, ByConstReferenceFunction)
 
 TEST (InvokeArgumentTest, ByExplicitConstReferenceFunction)
 
 TEST (DoAllTest, TwoActions)
 
 TEST (DoAllTest, ThreeActions)
 
 TEST (DoAllTest, FourActions)
 
 TEST (DoAllTest, FiveActions)
 
 TEST (DoAllTest, SixActions)
 
 TEST (DoAllTest, SevenActions)
 
 TEST (DoAllTest, EightActions)
 
 TEST (DoAllTest, NineActions)
 
 TEST (DoAllTest, TenActions)
 
 TEST (DoAllTest, NoArgs)
 
 TEST (DoAllTest, MoveOnlyArgs)
 
 TEST (DoAllTest, ImplicitlyConvertsActionArguments)
 
 ACTION (Return5)
 
 TEST (ActionMacroTest, WorksWhenNotReferencingArguments)
 
 ACTION (IncrementArg1)
 
 TEST (ActionMacroTest, WorksWhenReturningVoid)
 
 ACTION (IncrementArg2)
 
 TEST (ActionMacroTest, CanReferenceArgumentType)
 
 ACTION (Sum2)
 
 TEST (ActionMacroTest, CanReferenceArgumentTuple)
 
 ACTION (InvokeDummy)
 
 TEST (ActionMacroTest, CanReferenceMockFunctionType)
 
 ACTION (InvokeDummy2)
 
 TEST (ActionMacroTest, CanReferenceMockFunctionReturnType)
 
 ACTION (ReturnAddrOfConstBoolReferenceArg)
 
 TEST (ActionMacroTest, WorksForConstReferenceArg)
 
 ACTION (ReturnAddrOfIntReferenceArg)
 
 TEST (ActionMacroTest, WorksForNonConstReferenceArg)
 
 TEST (ActionMacroTest, WorksInNamespace)
 
 ACTION (PlusTwo)
 
 TEST (ActionMacroTest, WorksForDifferentArgumentNumbers)
 
 ACTION_P (Plus, n)
 
 TEST (ActionPMacroTest, DefinesParameterizedAction)
 
 ACTION_P (TypedPlus, n)
 
 TEST (ActionPMacroTest, CanReferenceArgumentAndParameterTypes)
 
 TEST (ActionPMacroTest, WorksInCompatibleMockFunction)
 
 ACTION (OverloadedAction)
 
 ACTION_P (OverloadedAction, default_value)
 
 ACTION_P2 (OverloadedAction, true_value, false_value)
 
 TEST (ActionMacroTest, CanDefineOverloadedActions)
 
 ACTION_P3 (Plus, m, n, k)
 
 TEST (ActionPnMacroTest, WorksFor3Parameters)
 
 ACTION_P4 (Plus, p0, p1, p2, p3)
 
 TEST (ActionPnMacroTest, WorksFor4Parameters)
 
 ACTION_P5 (Plus, p0, p1, p2, p3, p4)
 
 TEST (ActionPnMacroTest, WorksFor5Parameters)
 
 ACTION_P6 (Plus, p0, p1, p2, p3, p4, p5)
 
 TEST (ActionPnMacroTest, WorksFor6Parameters)
 
 ACTION_P7 (Plus, p0, p1, p2, p3, p4, p5, p6)
 
 TEST (ActionPnMacroTest, WorksFor7Parameters)
 
 ACTION_P8 (Plus, p0, p1, p2, p3, p4, p5, p6, p7)
 
 TEST (ActionPnMacroTest, WorksFor8Parameters)
 
 ACTION_P9 (Plus, p0, p1, p2, p3, p4, p5, p6, p7, p8)
 
 TEST (ActionPnMacroTest, WorksFor9Parameters)
 
 ACTION_P10 (Plus, p0, p1, p2, p3, p4, p5, p6, p7, p8, last_param)
 
 TEST (ActionPnMacroTest, WorksFor10Parameters)
 
 ACTION_P2 (PadArgument, prefix, suffix)
 
 TEST (ActionPnMacroTest, SimpleTypePromotion)
 
 ACTION_P3 (ConcatImpl, a, b, c)
 
template<typename T1 , typename T2 >
ConcatImplActionP3< std::string, T1, T2Concat (const std::string &a, T1 b, T2 c)
 
template<typename T1 , typename T2 >
ConcatImplActionP3< T1, int, T2Concat (T1 a, int b, T2 c)
 
 TEST (ActionPnMacroTest, CanPartiallyRestrictParameterTypes)
 
 ACTION (DoFoo)
 
 ACTION_P (DoFoo, p)
 
 ACTION_P2 (DoFoo, p0, p1)
 
 TEST (ActionPnMacroTest, TypesAreCorrect)
 
 ACTION_P (Plus1, x)
 
 ACTION_P2 (Plus2, x, y)
 
 ACTION_P3 (Plus3, x, y, z)
 
 ACTION_P10 (Plus10, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9)
 
 TEST (ActionPnMacroTest, CanExplicitlyInstantiateWithReferenceTypes)
 
 ACTION_TEMPLATE (CreateNew, HAS_1_TEMPLATE_PARAMS(typename, T), AND_0_VALUE_PARAMS())
 
 TEST (ActionTemplateTest, WorksWithoutValueParam)
 
 ACTION_TEMPLATE (CreateNew, HAS_1_TEMPLATE_PARAMS(typename, T), AND_1_VALUE_PARAMS(a0))
 
 TEST (ActionTemplateTest, WorksWithValueParams)
 
 ACTION_TEMPLATE (MyDeleteArg, HAS_1_TEMPLATE_PARAMS(int, k), AND_0_VALUE_PARAMS())
 
 TEST (ActionTemplateTest, WorksForIntegralTemplateParams)
 
 ACTION_TEMPLATE (ReturnSmartPointer, HAS_1_TEMPLATE_PARAMS(template< typename Pointee > class, Pointer), AND_1_VALUE_PARAMS(pointee))
 
 TEST (ActionTemplateTest, WorksForTemplateTemplateParameters)
 
 ACTION_TEMPLATE (ReturnGiant, HAS_10_TEMPLATE_PARAMS(typename, T1, typename, T2, typename, T3, int, k4, bool, k5, unsigned int, k6, class, T7, class, T8, class, T9, template< typename T > class, T10), AND_1_VALUE_PARAMS(value))
 
 TEST (ActionTemplateTest, WorksFor10TemplateParameters)
 
 ACTION_TEMPLATE (ReturnSum, HAS_1_TEMPLATE_PARAMS(typename, Number), AND_10_VALUE_PARAMS(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10))
 
 TEST (ActionTemplateTest, WorksFor10ValueParameters)
 
 ACTION (ReturnSum)
 
 ACTION_P (ReturnSum, x)
 
 ACTION_TEMPLATE (ReturnSum, HAS_1_TEMPLATE_PARAMS(typename, Number), AND_2_VALUE_PARAMS(v1, v2))
 
 ACTION_TEMPLATE (ReturnSum, HAS_1_TEMPLATE_PARAMS(typename, Number), AND_3_VALUE_PARAMS(v1, v2, v3))
 
 ACTION_TEMPLATE (ReturnSum, HAS_2_TEMPLATE_PARAMS(typename, Number, int, k), AND_4_VALUE_PARAMS(v1, v2, v3, v4))
 
 TEST (ActionTemplateTest, CanBeOverloadedOnNumberOfValueParameters)
 

Variables

bool g_done = false
 
const double g_double = 0
 

Function Documentation

◆ ACTION() [1/12]

testing::gmock_more_actions_test::ACTION ( DoFoo  )

Definition at line 1329 of file gmock-more-actions_test.cc.

1329{}

◆ ACTION() [2/12]

testing::gmock_more_actions_test::ACTION ( IncrementArg1  )

Definition at line 1002 of file gmock-more-actions_test.cc.

1002{ (*arg1)++; }

◆ ACTION() [3/12]

testing::gmock_more_actions_test::ACTION ( IncrementArg2  )

Definition at line 1013 of file gmock-more-actions_test.cc.

1013 {
1014 StaticAssertTypeEq<int*, arg2_type>();
1015 arg2_type temp = arg2;
1016 (*temp)++;
1017}

◆ ACTION() [4/12]

testing::gmock_more_actions_test::ACTION ( InvokeDummy  )

Definition at line 1048 of file gmock-more-actions_test.cc.

1048 {
1049 StaticAssertTypeEq<int(bool), function_type>();
1050 function_type* fp = &Dummy;
1051 return (*fp)(true);
1052}

◆ ACTION() [5/12]

testing::gmock_more_actions_test::ACTION ( InvokeDummy2  )

Definition at line 1062 of file gmock-more-actions_test.cc.

1062 {
1063 StaticAssertTypeEq<int, return_type>();
1064 return_type result = Dummy(true);
1065 return result;
1066}

◆ ACTION() [6/12]

testing::gmock_more_actions_test::ACTION ( OverloadedAction  )

Definition at line 1154 of file gmock-more-actions_test.cc.

1154{ return arg0 ? arg1 : "hello"; }

◆ ACTION() [7/12]

testing::gmock_more_actions_test::ACTION ( PlusTwo  )

Definition at line 1110 of file gmock-more-actions_test.cc.

1110{ return arg0 + 2; }

◆ ACTION() [8/12]

testing::gmock_more_actions_test::ACTION ( Return5  )

Definition at line 991 of file gmock-more-actions_test.cc.

991{ return 5; }

◆ ACTION() [9/12]

testing::gmock_more_actions_test::ACTION ( ReturnAddrOfConstBoolReferenceArg  )

Definition at line 1075 of file gmock-more-actions_test.cc.

1075 {
1076 StaticAssertTypeEq<const bool&, arg1_type>();
1077 return &arg1;
1078}

◆ ACTION() [10/12]

testing::gmock_more_actions_test::ACTION ( ReturnAddrOfIntReferenceArg  )

Definition at line 1087 of file gmock-more-actions_test.cc.

1087 {
1088 StaticAssertTypeEq<int&, arg0_type>();
1089 return &arg0;
1090}

◆ ACTION() [11/12]

testing::gmock_more_actions_test::ACTION ( ReturnSum  )

Definition at line 1514 of file gmock-more-actions_test.cc.

1514{ return 0; }

◆ ACTION() [12/12]

testing::gmock_more_actions_test::ACTION ( Sum2  )

Definition at line 1028 of file gmock-more-actions_test.cc.

1028 {
1029 StaticAssertTypeEq<std::tuple<int, char, int*>, args_type>();
1030 args_type args_copy = args;
1031 return std::get<0>(args_copy) + std::get<1>(args_copy);
1032}

◆ ACTION_P() [1/6]

testing::gmock_more_actions_test::ACTION_P ( DoFoo  ,
p   
)

Definition at line 1330 of file gmock-more-actions_test.cc.

1330{}

◆ ACTION_P() [2/6]

testing::gmock_more_actions_test::ACTION_P ( OverloadedAction  ,
default_value   
)

Definition at line 1156 of file gmock-more-actions_test.cc.

1156 {
1157 return arg0 ? arg1 : default_value;
1158}

◆ ACTION_P() [3/6]

testing::gmock_more_actions_test::ACTION_P ( Plus  ,
 
)

Definition at line 1122 of file gmock-more-actions_test.cc.

1122{ return arg0 + n; }

◆ ACTION_P() [4/6]

testing::gmock_more_actions_test::ACTION_P ( Plus1  ,
x   
)

Definition at line 1373 of file gmock-more-actions_test.cc.

1373{ return x; }

◆ ACTION_P() [5/6]

testing::gmock_more_actions_test::ACTION_P ( ReturnSum  ,
x   
)

Definition at line 1516 of file gmock-more-actions_test.cc.

1516{ return x; }

◆ ACTION_P() [6/6]

testing::gmock_more_actions_test::ACTION_P ( TypedPlus  ,
 
)

Definition at line 1131 of file gmock-more-actions_test.cc.

1131 {
1132 arg0_type t1 = arg0;
1133 n_type t2 = n;
1134 return t1 + t2;
1135}

◆ ACTION_P10() [1/2]

testing::gmock_more_actions_test::ACTION_P10 ( Plus  ,
p0  ,
p1  ,
p2  ,
p3  ,
p4  ,
p5  ,
p6  ,
p7  ,
p8  ,
last_param   
)

Definition at line 1246 of file gmock-more-actions_test.cc.

1246 {
1247 arg0_type t0 = arg0;
1248 last_param_type t9 = last_param;
1249 return t0 + p0 + p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8 + t9;
1250}

◆ ACTION_P10() [2/2]

testing::gmock_more_actions_test::ACTION_P10 ( Plus10  ,
a0  ,
a1  ,
a2  ,
a3  ,
a4  ,
a5  ,
a6  ,
a7  ,
a8  ,
a9   
)

Definition at line 1376 of file gmock-more-actions_test.cc.

1376 {
1377 return a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9;
1378}

◆ ACTION_P2() [1/4]

testing::gmock_more_actions_test::ACTION_P2 ( DoFoo  ,
p0  ,
p1   
)

Definition at line 1331 of file gmock-more-actions_test.cc.

1331{}

◆ ACTION_P2() [2/4]

testing::gmock_more_actions_test::ACTION_P2 ( OverloadedAction  ,
true_value  ,
false_value   
)

Definition at line 1160 of file gmock-more-actions_test.cc.

1160 {
1161 return arg0 ? true_value : false_value;
1162}

◆ ACTION_P2() [3/4]

testing::gmock_more_actions_test::ACTION_P2 ( PadArgument  ,
prefix  ,
suffix   
)

Definition at line 1260 of file gmock-more-actions_test.cc.

1260 {
1261 // The following lines promote the two parameters to desired types.
1262 std::string prefix_str(prefix);
1263 char suffix_char = static_cast<char>(suffix);
1264 return prefix_str + arg0 + suffix_char;
1265}

◆ ACTION_P2() [4/4]

testing::gmock_more_actions_test::ACTION_P2 ( Plus2  ,
x  ,
y   
)

Definition at line 1374 of file gmock-more-actions_test.cc.

1374{ return x + y; }
const double y

◆ ACTION_P3() [1/3]

testing::gmock_more_actions_test::ACTION_P3 ( ConcatImpl  ,
,
,
 
)

Definition at line 1281 of file gmock-more-actions_test.cc.

1281 {
1282 std::stringstream ss;
1283 ss << a << b << c;
1284 return ss.str();
1285}

◆ ACTION_P3() [2/3]

testing::gmock_more_actions_test::ACTION_P3 ( Plus  ,
,
,
 
)

Definition at line 1182 of file gmock-more-actions_test.cc.

1182{ return arg0 + m + n + k; }

◆ ACTION_P3() [3/3]

testing::gmock_more_actions_test::ACTION_P3 ( Plus3  ,
x  ,
y  ,
z   
)

Definition at line 1375 of file gmock-more-actions_test.cc.

1375{ return x + y + z; }
Uncopyable z

◆ ACTION_P4()

testing::gmock_more_actions_test::ACTION_P4 ( Plus  ,
p0  ,
p1  ,
p2  ,
p3   
)

Definition at line 1194 of file gmock-more-actions_test.cc.

1194{ return arg0 + p0 + p1 + p2 + p3; }

◆ ACTION_P5()

testing::gmock_more_actions_test::ACTION_P5 ( Plus  ,
p0  ,
p1  ,
p2  ,
p3  ,
p4   
)

Definition at line 1201 of file gmock-more-actions_test.cc.

1201{ return arg0 + p0 + p1 + p2 + p3 + p4; }

◆ ACTION_P6()

testing::gmock_more_actions_test::ACTION_P6 ( Plus  ,
p0  ,
p1  ,
p2  ,
p3  ,
p4  ,
p5   
)

Definition at line 1208 of file gmock-more-actions_test.cc.

1208 {
1209 return arg0 + p0 + p1 + p2 + p3 + p4 + p5;
1210}

◆ ACTION_P7()

testing::gmock_more_actions_test::ACTION_P7 ( Plus  ,
p0  ,
p1  ,
p2  ,
p3  ,
p4  ,
p5  ,
p6   
)

Definition at line 1217 of file gmock-more-actions_test.cc.

1217 {
1218 return arg0 + p0 + p1 + p2 + p3 + p4 + p5 + p6;
1219}

◆ ACTION_P8()

testing::gmock_more_actions_test::ACTION_P8 ( Plus  ,
p0  ,
p1  ,
p2  ,
p3  ,
p4  ,
p5  ,
p6  ,
p7   
)

Definition at line 1226 of file gmock-more-actions_test.cc.

1226 {
1227 return arg0 + p0 + p1 + p2 + p3 + p4 + p5 + p6 + p7;
1228}

◆ ACTION_P9()

testing::gmock_more_actions_test::ACTION_P9 ( Plus  ,
p0  ,
p1  ,
p2  ,
p3  ,
p4  ,
p5  ,
p6  ,
p7  ,
p8   
)

Definition at line 1236 of file gmock-more-actions_test.cc.

1236 {
1237 return arg0 + p0 + p1 + p2 + p3 + p4 + p5 + p6 + p7 + p8;
1238}

◆ ACTION_TEMPLATE() [1/9]

testing::gmock_more_actions_test::ACTION_TEMPLATE ( CreateNew  ,
HAS_1_TEMPLATE_PARAMS(typename, T)  ,
AND_0_VALUE_PARAMS()   
)

Definition at line 1409 of file gmock-more-actions_test.cc.

1410 {
1411 return new T;
1412}

◆ ACTION_TEMPLATE() [2/9]

testing::gmock_more_actions_test::ACTION_TEMPLATE ( CreateNew  ,
HAS_1_TEMPLATE_PARAMS(typename, T)  ,
AND_1_VALUE_PARAMS(a0)   
)

Definition at line 1421 of file gmock-more-actions_test.cc.

1422 {
1423 return new T(a0);
1424}

◆ ACTION_TEMPLATE() [3/9]

testing::gmock_more_actions_test::ACTION_TEMPLATE ( MyDeleteArg  ,
HAS_1_TEMPLATE_PARAMS(int, k)  ,
AND_0_VALUE_PARAMS()   
)

Definition at line 1434 of file gmock-more-actions_test.cc.

1435 {
1436 delete std::get<k>(args);
1437}

◆ ACTION_TEMPLATE() [4/9]

testing::gmock_more_actions_test::ACTION_TEMPLATE ( ReturnGiant  ,
HAS_10_TEMPLATE_PARAMS(typename, T1, typename, T2, typename, T3, int, k4, bool, k5, unsigned int, k6, class, T7, class, T8, class, T9, template< typename T > class, T10)  ,
AND_1_VALUE_PARAMS(value  
)

Definition at line 1482 of file gmock-more-actions_test.cc.

1487 {
1488 return GiantTemplate<T10<T1>, T2, T3, k4, k5, k6, T7, T8, T9>(value);
1489}
@ T3
Definition: rune.c:30
@ T2
Definition: rune.c:29
int value

◆ ACTION_TEMPLATE() [5/9]

testing::gmock_more_actions_test::ACTION_TEMPLATE ( ReturnSmartPointer  ,
HAS_1_TEMPLATE_PARAMS(template< typename Pointee > class, Pointer)  ,
AND_1_VALUE_PARAMS(pointee)   
)

Definition at line 1459 of file gmock-more-actions_test.cc.

1462 {
1463 return Pointer<pointee_type>(new pointee_type(pointee));
1464}

◆ ACTION_TEMPLATE() [6/9]

testing::gmock_more_actions_test::ACTION_TEMPLATE ( ReturnSum  ,
HAS_1_TEMPLATE_PARAMS(typename, Number)  ,
AND_10_VALUE_PARAMS(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10)   
)

Definition at line 1501 of file gmock-more-actions_test.cc.

1502 {
1503 return static_cast<Number>(v1) + v2 + v3 + v4 + v5 + v6 + v7 + v8 + v9 + v10;
1504}

◆ ACTION_TEMPLATE() [7/9]

testing::gmock_more_actions_test::ACTION_TEMPLATE ( ReturnSum  ,
HAS_1_TEMPLATE_PARAMS(typename, Number)  ,
AND_2_VALUE_PARAMS(v1, v2)   
)

Definition at line 1518 of file gmock-more-actions_test.cc.

1519 {
1520 return static_cast<Number>(v1) + v2;
1521}

◆ ACTION_TEMPLATE() [8/9]

testing::gmock_more_actions_test::ACTION_TEMPLATE ( ReturnSum  ,
HAS_1_TEMPLATE_PARAMS(typename, Number)  ,
AND_3_VALUE_PARAMS(v1, v2, v3)   
)

Definition at line 1523 of file gmock-more-actions_test.cc.

1524 {
1525 return static_cast<Number>(v1) + v2 + v3;
1526}

◆ ACTION_TEMPLATE() [9/9]

testing::gmock_more_actions_test::ACTION_TEMPLATE ( ReturnSum  ,
HAS_2_TEMPLATE_PARAMS(typename, Number, int, k)  ,
AND_4_VALUE_PARAMS(v1, v2, v3, v4)   
)

Definition at line 1528 of file gmock-more-actions_test.cc.

1529 {
1530 return static_cast<Number>(v1) + v2 + v3 + v4 + k;
1531}

◆ Binary()

const char * testing::gmock_more_actions_test::Binary ( const char *  input,
short  n 
)

Definition at line 87 of file gmock-more-actions_test.cc.

87{ return input + n; } // NOLINT

◆ ByConstRef()

bool testing::gmock_more_actions_test::ByConstRef ( const std::string &  s)

Definition at line 78 of file gmock-more-actions_test.cc.

78{ return s == "Hi"; }

◆ Char()

char testing::gmock_more_actions_test::Char ( char  ch)
inline

Definition at line 69 of file gmock-more-actions_test.cc.

69{ return ch; }

◆ CharPtr()

const char * testing::gmock_more_actions_test::CharPtr ( const char *  s)
inline

Definition at line 238 of file gmock-more-actions_test.cc.

238{ return s; }

◆ Concat() [1/2]

template<typename T1 , typename T2 >
ConcatImplActionP3< std::string, T1, T2 > testing::gmock_more_actions_test::Concat ( const std::string &  a,
T1  b,
T2  c 
)

Definition at line 1296 of file gmock-more-actions_test.cc.

1297 {
1299 if (true) {
1301 // This branch verifies that ConcatImpl() can be invoked without
1302 // explicit template arguments.
1303 return ConcatImpl(a, b, c);
1304 } else {
1305 // This branch verifies that ConcatImpl() can also be invoked with
1306 // explicit template arguments. It doesn't really need to be
1307 // executed as this is a compile-time verification.
1308 return ConcatImpl<std::string, T1, T2>(a, b, c);
1309 }
1310}
#define GTEST_INTENTIONAL_CONST_COND_PUSH_()
Definition: gtest-port.h:731
#define GTEST_INTENTIONAL_CONST_COND_POP_()
Definition: gtest-port.h:733

◆ Concat() [2/2]

template<typename T1 , typename T2 >
ConcatImplActionP3< T1, int, T2 > testing::gmock_more_actions_test::Concat ( T1  a,
int  b,
T2  c 
)

Definition at line 1315 of file gmock-more-actions_test.cc.

1315 {
1316 return ConcatImpl(a, b, c);
1317}

◆ Concat10()

std::string testing::gmock_more_actions_test::Concat10 ( const char *  s1,
const char *  s2,
const char *  s3,
const char *  s4,
const char *  s5,
const char *  s6,
const char *  s7,
const char *  s8,
const char *  s9,
const char *  s10 
)

Definition at line 131 of file gmock-more-actions_test.cc.

134 {
135 return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10;
136}

◆ Concat7()

std::string testing::gmock_more_actions_test::Concat7 ( const char *  s1,
const char *  s2,
const char *  s3,
const char *  s4,
const char *  s5,
const char *  s6,
const char *  s7 
)

Definition at line 113 of file gmock-more-actions_test.cc.

115 {
116 return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7;
117}

◆ Concat8()

std::string testing::gmock_more_actions_test::Concat8 ( const char *  s1,
const char *  s2,
const char *  s3,
const char *  s4,
const char *  s5,
const char *  s6,
const char *  s7,
const char *  s8 
)

Definition at line 119 of file gmock-more-actions_test.cc.

121 {
122 return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8;
123}

◆ Concat9()

std::string testing::gmock_more_actions_test::Concat9 ( const char *  s1,
const char *  s2,
const char *  s3,
const char *  s4,
const char *  s5,
const char *  s6,
const char *  s7,
const char *  s8,
const char *  s9 
)

Definition at line 125 of file gmock-more-actions_test.cc.

127 {
128 return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9;
129}

◆ Nullary()

int testing::gmock_more_actions_test::Nullary ( )

Definition at line 72 of file gmock-more-actions_test.cc.

72{ return 1; }

◆ ReferencesGlobalDouble()

bool testing::gmock_more_actions_test::ReferencesGlobalDouble ( const double &  x)

Definition at line 81 of file gmock-more-actions_test.cc.

81{ return &x == &g_double; }

◆ Short()

short testing::gmock_more_actions_test::Short ( short  n)
inline

Definition at line 68 of file gmock-more-actions_test.cc.

68{ return n; } // NOLINT

◆ SumOf4()

int testing::gmock_more_actions_test::SumOf4 ( int  a,
int  b,
int  c,
int  d 
)

Definition at line 91 of file gmock-more-actions_test.cc.

91{ return a + b + c + d; }

◆ SumOf5()

int testing::gmock_more_actions_test::SumOf5 ( int  a,
int  b,
int  c,
int  d,
int  e 
)

Definition at line 95 of file gmock-more-actions_test.cc.

95{ return a + b + c + d + e; }

◆ SumOf6()

int testing::gmock_more_actions_test::SumOf6 ( int  a,
int  b,
int  c,
int  d,
int  e,
int  f 
)

Definition at line 103 of file gmock-more-actions_test.cc.

103 {
104 return a + b + c + d + e + f;
105}

◆ SumOfFirst2()

int testing::gmock_more_actions_test::SumOfFirst2 ( int  a,
int  b,
Unused  ,
Unused   
)

Definition at line 93 of file gmock-more-actions_test.cc.

93{ return a + b; }

◆ Ternary()

int testing::gmock_more_actions_test::Ternary ( int  x,
char  y,
short  z 
)

Definition at line 89 of file gmock-more-actions_test.cc.

89{ return x + y + z; } // NOLINT

◆ TEST() [1/105]

testing::gmock_more_actions_test::TEST ( ActionMacroTest  ,
CanDefineOverloadedActions   
)

Definition at line 1164 of file gmock-more-actions_test.cc.

1164 {
1165 using MyAction = Action<const char*(bool, const char*)>;
1166
1167 const MyAction a1 = OverloadedAction();
1168 EXPECT_STREQ("hello", a1.Perform(std::make_tuple(false, CharPtr("world"))));
1169 EXPECT_STREQ("world", a1.Perform(std::make_tuple(true, CharPtr("world"))));
1170
1171 const MyAction a2 = OverloadedAction("hi");
1172 EXPECT_STREQ("hi", a2.Perform(std::make_tuple(false, CharPtr("world"))));
1173 EXPECT_STREQ("world", a2.Perform(std::make_tuple(true, CharPtr("world"))));
1174
1175 const MyAction a3 = OverloadedAction("hi", "you");
1176 EXPECT_STREQ("hi", a3.Perform(std::make_tuple(true, CharPtr("world"))));
1177 EXPECT_STREQ("you", a3.Perform(std::make_tuple(false, CharPtr("world"))));
1178}
#define EXPECT_STREQ(s1, s2)
Definition: gtest.h:2112

◆ TEST() [2/105]

testing::gmock_more_actions_test::TEST ( ActionMacroTest  ,
CanReferenceArgumentTuple   
)

Definition at line 1034 of file gmock-more-actions_test.cc.

1034 {
1035 Action<int(int, char, int*)> a1 = Sum2();
1036 int dummy = 0;
1037 EXPECT_EQ(11, a1.Perform(std::make_tuple(5, Char(6), &dummy)));
1038}
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:2043
Result Perform(ArgumentTuple args) const

◆ TEST() [3/105]

testing::gmock_more_actions_test::TEST ( ActionMacroTest  ,
CanReferenceArgumentType   
)

Definition at line 1019 of file gmock-more-actions_test.cc.

1019 {
1020 Action<void(int, bool, int*)> a1 = IncrementArg2();
1021 int n = 0;
1022 a1.Perform(std::make_tuple(5, false, &n));
1023 EXPECT_EQ(1, n);
1024}

◆ TEST() [4/105]

testing::gmock_more_actions_test::TEST ( ActionMacroTest  ,
CanReferenceMockFunctionReturnType   
)

Definition at line 1068 of file gmock-more-actions_test.cc.

1068 {
1069 Action<int(bool)> a1 = InvokeDummy2();
1070 EXPECT_EQ(1, a1.Perform(std::make_tuple(true)));
1071 EXPECT_EQ(1, a1.Perform(std::make_tuple(false)));
1072}

◆ TEST() [5/105]

testing::gmock_more_actions_test::TEST ( ActionMacroTest  ,
CanReferenceMockFunctionType   
)

Definition at line 1054 of file gmock-more-actions_test.cc.

1054 {
1055 Action<int(bool)> a1 = InvokeDummy();
1056 EXPECT_EQ(1, a1.Perform(std::make_tuple(true)));
1057 EXPECT_EQ(1, a1.Perform(std::make_tuple(false)));
1058}

◆ TEST() [6/105]

testing::gmock_more_actions_test::TEST ( ActionMacroTest  ,
WorksForConstReferenceArg   
)

Definition at line 1080 of file gmock-more-actions_test.cc.

1080 {
1081 Action<const bool*(int, const bool&)> a = ReturnAddrOfConstBoolReferenceArg();
1082 const bool b = false;
1083 EXPECT_EQ(&b, a.Perform(std::tuple<int, const bool&>(0, b)));
1084}

◆ TEST() [7/105]

testing::gmock_more_actions_test::TEST ( ActionMacroTest  ,
WorksForDifferentArgumentNumbers   
)

Definition at line 1112 of file gmock-more-actions_test.cc.

1112 {
1113 Action<int(int)> a1 = PlusTwo();
1114 EXPECT_EQ(4, a1.Perform(std::make_tuple(2)));
1115
1116 Action<double(float, void*)> a2 = PlusTwo();
1117 int dummy;
1118 EXPECT_DOUBLE_EQ(6, a2.Perform(std::make_tuple(4.0f, &dummy)));
1119}
#define EXPECT_DOUBLE_EQ(val1, val2)
Definition: gtest.h:2148

◆ TEST() [8/105]

testing::gmock_more_actions_test::TEST ( ActionMacroTest  ,
WorksForNonConstReferenceArg   
)

Definition at line 1092 of file gmock-more-actions_test.cc.

1092 {
1093 Action<int*(int&, bool, int)> a = ReturnAddrOfIntReferenceArg();
1094 int n = 0;
1095 EXPECT_EQ(&n, a.Perform(std::tuple<int&, bool, int>(n, true, 1)));
1096}

◆ TEST() [9/105]

testing::gmock_more_actions_test::TEST ( ActionMacroTest  ,
WorksInNamespace   
)

Definition at line 1103 of file gmock-more-actions_test.cc.

1103 {
1104 Action<int(int, int)> a1 = action_test::Sum();
1105 EXPECT_EQ(3, a1.Perform(std::make_tuple(1, 2)));
1106}

◆ TEST() [10/105]

testing::gmock_more_actions_test::TEST ( ActionMacroTest  ,
WorksWhenNotReferencingArguments   
)

Definition at line 993 of file gmock-more-actions_test.cc.

993 {
994 Action<double()> a1 = Return5();
995 EXPECT_DOUBLE_EQ(5, a1.Perform(std::make_tuple()));
996
997 Action<int(double, bool)> a2 = Return5();
998 EXPECT_EQ(5, a2.Perform(std::make_tuple(1, true)));
999}

◆ TEST() [11/105]

testing::gmock_more_actions_test::TEST ( ActionMacroTest  ,
WorksWhenReturningVoid   
)

Definition at line 1004 of file gmock-more-actions_test.cc.

1004 {
1005 Action<void(int, int*)> a1 = IncrementArg1();
1006 int n = 0;
1007 a1.Perform(std::make_tuple(5, &n));
1008 EXPECT_EQ(1, n);
1009}

◆ TEST() [12/105]

testing::gmock_more_actions_test::TEST ( ActionPMacroTest  ,
CanReferenceArgumentAndParameterTypes   
)

Definition at line 1137 of file gmock-more-actions_test.cc.

1137 {
1138 Action<int(char m, bool t)> a1 = TypedPlus(9);
1139 EXPECT_EQ(10, a1.Perform(std::make_tuple(Char(1), true)));
1140}

◆ TEST() [13/105]

testing::gmock_more_actions_test::TEST ( ActionPMacroTest  ,
DefinesParameterizedAction   
)

Definition at line 1124 of file gmock-more-actions_test.cc.

1124 {
1125 Action<int(int m, bool t)> a1 = Plus(9);
1126 EXPECT_EQ(10, a1.Perform(std::make_tuple(1, true)));
1127}

◆ TEST() [14/105]

testing::gmock_more_actions_test::TEST ( ActionPMacroTest  ,
WorksInCompatibleMockFunction   
)

Definition at line 1144 of file gmock-more-actions_test.cc.

1144 {
1145 Action<std::string(const std::string& s)> a1 = Plus("tail");
1146 const std::string re = "re";
1147 std::tuple<const std::string> dummy = std::make_tuple(re);
1148 EXPECT_EQ("retail", a1.Perform(dummy));
1149}

◆ TEST() [15/105]

testing::gmock_more_actions_test::TEST ( ActionPnMacroTest  ,
CanExplicitlyInstantiateWithReferenceTypes   
)

Definition at line 1380 of file gmock-more-actions_test.cc.

1380 {
1381 int x = 1, y = 2, z = 3;
1382 const std::tuple<> empty = std::make_tuple();
1383
1384 Action<int()> a = Plus1<int&>(x);
1385 EXPECT_EQ(1, a.Perform(empty));
1386
1387 a = Plus2<const int&, int&>(x, y);
1388 EXPECT_EQ(3, a.Perform(empty));
1389
1390 a = Plus3<int&, const int&, int&>(x, y, z);
1391 EXPECT_EQ(6, a.Perform(empty));
1392
1393 int n[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
1394 a = Plus10<const int&, int&, const int&, int&, const int&, int&, const int&,
1395 int&, const int&, int&>(n[0], n[1], n[2], n[3], n[4], n[5], n[6],
1396 n[7], n[8], n[9]);
1397 EXPECT_EQ(55, a.Perform(empty));
1398}

◆ TEST() [16/105]

testing::gmock_more_actions_test::TEST ( ActionPnMacroTest  ,
CanPartiallyRestrictParameterTypes   
)

Definition at line 1319 of file gmock-more-actions_test.cc.

1319 {
1320 Action<const std::string()> a1 = Concat("Hello", "1", 2);
1321 EXPECT_EQ("Hello12", a1.Perform(std::make_tuple()));
1322
1323 a1 = Concat(1, 2, 3);
1324 EXPECT_EQ("123", a1.Perform(std::make_tuple()));
1325}
ConcatImplActionP3< T1, int, T2 > Concat(T1 a, int b, T2 c)

◆ TEST() [17/105]

testing::gmock_more_actions_test::TEST ( ActionPnMacroTest  ,
SimpleTypePromotion   
)

Definition at line 1267 of file gmock-more-actions_test.cc.

1267 {
1268 Action<std::string(const char*)> no_promo =
1269 PadArgument(std::string("foo"), 'r');
1270 Action<std::string(const char*)> promo =
1271 PadArgument("foo", static_cast<int>('r'));
1272 EXPECT_EQ("foobar", no_promo.Perform(std::make_tuple(CharPtr("ba"))));
1273 EXPECT_EQ("foobar", promo.Perform(std::make_tuple(CharPtr("ba"))));
1274}

◆ TEST() [18/105]

testing::gmock_more_actions_test::TEST ( ActionPnMacroTest  ,
TypesAreCorrect   
)

Definition at line 1333 of file gmock-more-actions_test.cc.

1333 {
1334 // DoFoo() must be assignable to a DoFooAction variable.
1335 DoFooAction a0 = DoFoo();
1336
1337 // DoFoo(1) must be assignable to a DoFooActionP variable.
1338 DoFooActionP<int> a1 = DoFoo(1);
1339
1340 // DoFoo(p1, ..., pk) must be assignable to a DoFooActionPk
1341 // variable, and so on.
1342 DoFooActionP2<int, char> a2 = DoFoo(1, '2');
1343 PlusActionP3<int, int, char> a3 = Plus(1, 2, '3');
1344 PlusActionP4<int, int, int, char> a4 = Plus(1, 2, 3, '4');
1345 PlusActionP5<int, int, int, int, char> a5 = Plus(1, 2, 3, 4, '5');
1346 PlusActionP6<int, int, int, int, int, char> a6 = Plus(1, 2, 3, 4, 5, '6');
1347 PlusActionP7<int, int, int, int, int, int, char> a7 =
1348 Plus(1, 2, 3, 4, 5, 6, '7');
1349 PlusActionP8<int, int, int, int, int, int, int, char> a8 =
1350 Plus(1, 2, 3, 4, 5, 6, 7, '8');
1351 PlusActionP9<int, int, int, int, int, int, int, int, char> a9 =
1352 Plus(1, 2, 3, 4, 5, 6, 7, 8, '9');
1353 PlusActionP10<int, int, int, int, int, int, int, int, int, char> a10 =
1354 Plus(1, 2, 3, 4, 5, 6, 7, 8, 9, '0');
1355
1356 // Avoid "unused variable" warnings.
1357 (void)a0;
1358 (void)a1;
1359 (void)a2;
1360 (void)a3;
1361 (void)a4;
1362 (void)a5;
1363 (void)a6;
1364 (void)a7;
1365 (void)a8;
1366 (void)a9;
1367 (void)a10;
1368}

◆ TEST() [19/105]

testing::gmock_more_actions_test::TEST ( ActionPnMacroTest  ,
WorksFor10Parameters   
)

Definition at line 1252 of file gmock-more-actions_test.cc.

1252 {
1253 Action<int(int)> a1 = Plus(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
1254 EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10,
1255 a1.Perform(std::make_tuple(10)));
1256}

◆ TEST() [20/105]

testing::gmock_more_actions_test::TEST ( ActionPnMacroTest  ,
WorksFor3Parameters   
)

Definition at line 1184 of file gmock-more-actions_test.cc.

1184 {
1185 Action<double(int m, bool t)> a1 = Plus(100, 20, 3.4);
1186 EXPECT_DOUBLE_EQ(3123.4, a1.Perform(std::make_tuple(3000, true)));
1187
1188 Action<std::string(const std::string& s)> a2 = Plus("tail", "-", ">");
1189 const std::string re = "re";
1190 std::tuple<const std::string> dummy = std::make_tuple(re);
1191 EXPECT_EQ("retail->", a2.Perform(dummy));
1192}

◆ TEST() [21/105]

testing::gmock_more_actions_test::TEST ( ActionPnMacroTest  ,
WorksFor4Parameters   
)

Definition at line 1196 of file gmock-more-actions_test.cc.

1196 {
1197 Action<int(int)> a1 = Plus(1, 2, 3, 4);
1198 EXPECT_EQ(10 + 1 + 2 + 3 + 4, a1.Perform(std::make_tuple(10)));
1199}

◆ TEST() [22/105]

testing::gmock_more_actions_test::TEST ( ActionPnMacroTest  ,
WorksFor5Parameters   
)

Definition at line 1203 of file gmock-more-actions_test.cc.

1203 {
1204 Action<int(int)> a1 = Plus(1, 2, 3, 4, 5);
1205 EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5, a1.Perform(std::make_tuple(10)));
1206}

◆ TEST() [23/105]

testing::gmock_more_actions_test::TEST ( ActionPnMacroTest  ,
WorksFor6Parameters   
)

Definition at line 1212 of file gmock-more-actions_test.cc.

1212 {
1213 Action<int(int)> a1 = Plus(1, 2, 3, 4, 5, 6);
1214 EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5 + 6, a1.Perform(std::make_tuple(10)));
1215}

◆ TEST() [24/105]

testing::gmock_more_actions_test::TEST ( ActionPnMacroTest  ,
WorksFor7Parameters   
)

Definition at line 1221 of file gmock-more-actions_test.cc.

1221 {
1222 Action<int(int)> a1 = Plus(1, 2, 3, 4, 5, 6, 7);
1223 EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5 + 6 + 7, a1.Perform(std::make_tuple(10)));
1224}

◆ TEST() [25/105]

testing::gmock_more_actions_test::TEST ( ActionPnMacroTest  ,
WorksFor8Parameters   
)

Definition at line 1230 of file gmock-more-actions_test.cc.

1230 {
1231 Action<int(int)> a1 = Plus(1, 2, 3, 4, 5, 6, 7, 8);
1232 EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8,
1233 a1.Perform(std::make_tuple(10)));
1234}

◆ TEST() [26/105]

testing::gmock_more_actions_test::TEST ( ActionPnMacroTest  ,
WorksFor9Parameters   
)

Definition at line 1240 of file gmock-more-actions_test.cc.

1240 {
1241 Action<int(int)> a1 = Plus(1, 2, 3, 4, 5, 6, 7, 8, 9);
1242 EXPECT_EQ(10 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9,
1243 a1.Perform(std::make_tuple(10)));
1244}

◆ TEST() [27/105]

testing::gmock_more_actions_test::TEST ( ActionTemplateTest  ,
CanBeOverloadedOnNumberOfValueParameters   
)

Definition at line 1533 of file gmock-more-actions_test.cc.

1533 {
1534 const Action<int()> a0 = ReturnSum();
1535 const Action<int()> a1 = ReturnSum(1);
1536 const Action<int()> a2 = ReturnSum<int>(1, 2);
1537 const Action<int()> a3 = ReturnSum<int>(1, 2, 3);
1538 const Action<int()> a4 = ReturnSum<int, 10000>(2000, 300, 40, 5);
1539 EXPECT_EQ(0, a0.Perform(std::make_tuple()));
1540 EXPECT_EQ(1, a1.Perform(std::make_tuple()));
1541 EXPECT_EQ(3, a2.Perform(std::make_tuple()));
1542 EXPECT_EQ(6, a3.Perform(std::make_tuple()));
1543 EXPECT_EQ(12345, a4.Perform(std::make_tuple()));
1544}

◆ TEST() [28/105]

testing::gmock_more_actions_test::TEST ( ActionTemplateTest  ,
WorksFor10TemplateParameters   
)

Definition at line 1491 of file gmock-more-actions_test.cc.

1491 {
1492 using Giant = GiantTemplate<std::shared_ptr<int>, bool, double, 5, true, 6,
1493 char, unsigned, int>;
1494 const Action<Giant()> a = ReturnGiant<int, bool, double, 5, true, 6, char,
1495 unsigned, int, std::shared_ptr>(42);
1496 Giant giant = a.Perform(std::make_tuple());
1497 EXPECT_EQ(42, giant.value);
1498}

◆ TEST() [29/105]

testing::gmock_more_actions_test::TEST ( ActionTemplateTest  ,
WorksFor10ValueParameters   
)

Definition at line 1506 of file gmock-more-actions_test.cc.

1506 {
1507 const Action<int()> a = ReturnSum<int>(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
1508 EXPECT_EQ(55, a.Perform(std::make_tuple()));
1509}

◆ TEST() [30/105]

testing::gmock_more_actions_test::TEST ( ActionTemplateTest  ,
WorksForIntegralTemplateParams   
)

Definition at line 1449 of file gmock-more-actions_test.cc.

1449 {
1450 const Action<void(int*, BoolResetter*)> a = MyDeleteArg<1>();
1451 int n = 0;
1452 bool b = true;
1453 auto* resetter = new BoolResetter(&b);
1454 a.Perform(std::make_tuple(&n, resetter));
1455 EXPECT_FALSE(b); // Verifies that resetter is deleted.
1456}
#define EXPECT_FALSE(condition)
Definition: gtest.h:1986

◆ TEST() [31/105]

testing::gmock_more_actions_test::TEST ( ActionTemplateTest  ,
WorksForTemplateTemplateParameters   
)

Definition at line 1466 of file gmock-more-actions_test.cc.

1466 {
1467 const Action<std::shared_ptr<int>()> a =
1468 ReturnSmartPointer<std::shared_ptr>(42);
1469 std::shared_ptr<int> p = a.Perform(std::make_tuple());
1470 EXPECT_EQ(42, *p);
1471}
const char * p

◆ TEST() [32/105]

testing::gmock_more_actions_test::TEST ( ActionTemplateTest  ,
WorksWithoutValueParam   
)

Definition at line 1414 of file gmock-more-actions_test.cc.

1414 {
1415 const Action<int*()> a = CreateNew<int>();
1416 int* p = a.Perform(std::make_tuple());
1417 delete p;
1418}

◆ TEST() [33/105]

testing::gmock_more_actions_test::TEST ( ActionTemplateTest  ,
WorksWithValueParams   
)

Definition at line 1426 of file gmock-more-actions_test.cc.

1426 {
1427 const Action<int*()> a = CreateNew<int>(42);
1428 int* p = a.Perform(std::make_tuple());
1429 EXPECT_EQ(42, *p);
1430 delete p;
1431}

◆ TEST() [34/105]

testing::gmock_more_actions_test::TEST ( DeleteArgActionTest  ,
OneArg   
)

Definition at line 534 of file gmock-more-actions_test.cc.

534 {
535 bool is_deleted = false;
536 DeletionTester* t = new DeletionTester(&is_deleted);
537 const Action<void(DeletionTester*)> a1 = DeleteArg<0>(); // NOLINT
538 EXPECT_FALSE(is_deleted);
539 a1.Perform(std::make_tuple(t));
540 EXPECT_TRUE(is_deleted);
541}
#define EXPECT_TRUE(condition)
Definition: gtest.h:1982

◆ TEST() [35/105]

testing::gmock_more_actions_test::TEST ( DeleteArgActionTest  ,
TenArgs   
)

Definition at line 543 of file gmock-more-actions_test.cc.

543 {
544 bool is_deleted = false;
545 DeletionTester* t = new DeletionTester(&is_deleted);
546 const Action<void(bool, int, int, const char*, bool,
547 int, int, int, int, DeletionTester*)> a1 = DeleteArg<9>();
548 EXPECT_FALSE(is_deleted);
549 a1.Perform(std::make_tuple(true, 5, 6, CharPtr("hi"), false, 7, 8, 9, 10, t));
550 EXPECT_TRUE(is_deleted);
551}

◆ TEST() [36/105]

testing::gmock_more_actions_test::TEST ( DoAllTest  ,
EightActions   
)

Definition at line 884 of file gmock-more-actions_test.cc.

884 {
885 int m = 0, n = 0;
886 char a = '\0', b = '\0', c = '\0', d = '\0', e = '\0';
887 Action<int(int*, int*, char*, char*, char*, char*, // NOLINT
888 char*)>
889 action =
890 DoAll(SetArgPointee<0>(1), SetArgPointee<1>(2), SetArgPointee<2>('a'),
891 SetArgPointee<3>('b'), SetArgPointee<4>('c'),
892 SetArgPointee<5>('d'), SetArgPointee<6>('e'), Return(3));
893 EXPECT_EQ(3, action.Perform(std::make_tuple(&m, &n, &a, &b, &c, &d, &e)));
894 EXPECT_EQ(1, m);
895 EXPECT_EQ(2, n);
896 EXPECT_EQ('a', a);
897 EXPECT_EQ('b', b);
898 EXPECT_EQ('c', c);
899 EXPECT_EQ('d', d);
900 EXPECT_EQ('e', e);
901}
internal::DoAllAction< typename std::decay< Action >::type... > DoAll(Action &&... action)
internal::ReturnAction< R > Return(R value)
action
Definition: upload.py:408

◆ TEST() [37/105]

testing::gmock_more_actions_test::TEST ( DoAllTest  ,
FiveActions   
)

Definition at line 838 of file gmock-more-actions_test.cc.

838 {
839 int m = 0, n = 0;
840 char a = '\0', b = '\0';
841 Action<int(int*, int*, char*, char*)> action = // NOLINT
842 DoAll(SetArgPointee<0>(1), SetArgPointee<1>(2), SetArgPointee<2>('a'),
843 SetArgPointee<3>('b'), Return(3));
844 EXPECT_EQ(3, action.Perform(std::make_tuple(&m, &n, &a, &b)));
845 EXPECT_EQ(1, m);
846 EXPECT_EQ(2, n);
847 EXPECT_EQ('a', a);
848 EXPECT_EQ('b', b);
849}

◆ TEST() [38/105]

testing::gmock_more_actions_test::TEST ( DoAllTest  ,
FourActions   
)

Definition at line 825 of file gmock-more-actions_test.cc.

825 {
826 int m = 0, n = 0;
827 char ch = '\0';
828 Action<int(int*, int*, char*)> a = // NOLINT
829 DoAll(SetArgPointee<0>(1), SetArgPointee<1>(2), SetArgPointee<2>('a'),
830 Return(3));
831 EXPECT_EQ(3, a.Perform(std::make_tuple(&m, &n, &ch)));
832 EXPECT_EQ(1, m);
833 EXPECT_EQ(2, n);
834 EXPECT_EQ('a', ch);
835}

◆ TEST() [39/105]

testing::gmock_more_actions_test::TEST ( DoAllTest  ,
ImplicitlyConvertsActionArguments   
)

Definition at line 965 of file gmock-more-actions_test.cc.

965 {
966 bool ran_first = false;
967 // Action<void(std::vector<int>)> isn't an
968 // Action<void(const std::vector<int>&) but can be converted.
969 Action<void(std::vector<int>)> first = [&] { ran_first = true; };
970 Action<int(std::vector<int>)> a =
971 DoAll(first, [](std::vector<int> arg) { return arg.front(); });
972 EXPECT_EQ(7, a.Perform(std::make_tuple(std::vector<int>{7})));
973 EXPECT_TRUE(ran_first);
974}

◆ TEST() [40/105]

testing::gmock_more_actions_test::TEST ( DoAllTest  ,
MoveOnlyArgs   
)

Definition at line 956 of file gmock-more-actions_test.cc.

956 {
957 bool ran_first = false;
958 Action<int(std::unique_ptr<int>)> a =
959 DoAll(InvokeWithoutArgs([&] { ran_first = true; }),
960 [](std::unique_ptr<int> p) { return *p; });
961 EXPECT_EQ(7, a.Perform(std::make_tuple(std::unique_ptr<int>(new int(7)))));
962 EXPECT_TRUE(ran_first);
963}
internal::InvokeWithoutArgsAction< typename std::decay< FunctionImpl >::type > InvokeWithoutArgs(FunctionImpl function_impl)

◆ TEST() [41/105]

testing::gmock_more_actions_test::TEST ( DoAllTest  ,
NineActions   
)

Definition at line 904 of file gmock-more-actions_test.cc.

904 {
905 int m = 0, n = 0;
906 char a = '\0', b = '\0', c = '\0', d = '\0', e = '\0', f = '\0';
907 Action<int(int*, int*, char*, char*, char*, char*, // NOLINT
908 char*, char*)>
909 action = DoAll(SetArgPointee<0>(1), SetArgPointee<1>(2),
910 SetArgPointee<2>('a'), SetArgPointee<3>('b'),
911 SetArgPointee<4>('c'), SetArgPointee<5>('d'),
912 SetArgPointee<6>('e'), SetArgPointee<7>('f'), Return(3));
913 EXPECT_EQ(3, action.Perform(std::make_tuple(&m, &n, &a, &b, &c, &d, &e, &f)));
914 EXPECT_EQ(1, m);
915 EXPECT_EQ(2, n);
916 EXPECT_EQ('a', a);
917 EXPECT_EQ('b', b);
918 EXPECT_EQ('c', c);
919 EXPECT_EQ('d', d);
920 EXPECT_EQ('e', e);
921 EXPECT_EQ('f', f);
922}

◆ TEST() [42/105]

testing::gmock_more_actions_test::TEST ( DoAllTest  ,
NoArgs   
)

Definition at line 949 of file gmock-more-actions_test.cc.

949 {
950 bool ran_first = false;
951 Action<bool()> a =
952 DoAll([&] { ran_first = true; }, [&] { return ran_first; });
953 EXPECT_TRUE(a.Perform({}));
954}

◆ TEST() [43/105]

testing::gmock_more_actions_test::TEST ( DoAllTest  ,
SevenActions   
)

Definition at line 867 of file gmock-more-actions_test.cc.

867 {
868 int m = 0, n = 0;
869 char a = '\0', b = '\0', c = '\0', d = '\0';
870 Action<int(int*, int*, char*, char*, char*, char*)> action = // NOLINT
871 DoAll(SetArgPointee<0>(1), SetArgPointee<1>(2), SetArgPointee<2>('a'),
872 SetArgPointee<3>('b'), SetArgPointee<4>('c'), SetArgPointee<5>('d'),
873 Return(3));
874 EXPECT_EQ(3, action.Perform(std::make_tuple(&m, &n, &a, &b, &c, &d)));
875 EXPECT_EQ(1, m);
876 EXPECT_EQ(2, n);
877 EXPECT_EQ('a', a);
878 EXPECT_EQ('b', b);
879 EXPECT_EQ('c', c);
880 EXPECT_EQ('d', d);
881}

◆ TEST() [44/105]

testing::gmock_more_actions_test::TEST ( DoAllTest  ,
SixActions   
)

Definition at line 852 of file gmock-more-actions_test.cc.

852 {
853 int m = 0, n = 0;
854 char a = '\0', b = '\0', c = '\0';
855 Action<int(int*, int*, char*, char*, char*)> action = // NOLINT
856 DoAll(SetArgPointee<0>(1), SetArgPointee<1>(2), SetArgPointee<2>('a'),
857 SetArgPointee<3>('b'), SetArgPointee<4>('c'), Return(3));
858 EXPECT_EQ(3, action.Perform(std::make_tuple(&m, &n, &a, &b, &c)));
859 EXPECT_EQ(1, m);
860 EXPECT_EQ(2, n);
861 EXPECT_EQ('a', a);
862 EXPECT_EQ('b', b);
863 EXPECT_EQ('c', c);
864}

◆ TEST() [45/105]

testing::gmock_more_actions_test::TEST ( DoAllTest  ,
TenActions   
)

Definition at line 925 of file gmock-more-actions_test.cc.

925 {
926 int m = 0, n = 0;
927 char a = '\0', b = '\0', c = '\0', d = '\0';
928 char e = '\0', f = '\0', g = '\0';
929 Action<int(int*, int*, char*, char*, char*, char*, // NOLINT
930 char*, char*, char*)>
931 action =
932 DoAll(SetArgPointee<0>(1), SetArgPointee<1>(2), SetArgPointee<2>('a'),
933 SetArgPointee<3>('b'), SetArgPointee<4>('c'),
934 SetArgPointee<5>('d'), SetArgPointee<6>('e'),
935 SetArgPointee<7>('f'), SetArgPointee<8>('g'), Return(3));
936 EXPECT_EQ(
937 3, action.Perform(std::make_tuple(&m, &n, &a, &b, &c, &d, &e, &f, &g)));
938 EXPECT_EQ(1, m);
939 EXPECT_EQ(2, n);
940 EXPECT_EQ('a', a);
941 EXPECT_EQ('b', b);
942 EXPECT_EQ('c', c);
943 EXPECT_EQ('d', d);
944 EXPECT_EQ('e', e);
945 EXPECT_EQ('f', f);
946 EXPECT_EQ('g', g);
947}

◆ TEST() [46/105]

testing::gmock_more_actions_test::TEST ( DoAllTest  ,
ThreeActions   
)

Definition at line 815 of file gmock-more-actions_test.cc.

815 {
816 int m = 0, n = 0;
817 Action<int(int*, int*)> a = DoAll(SetArgPointee<0>(1), // NOLINT
818 SetArgPointee<1>(2), Return(3));
819 EXPECT_EQ(3, a.Perform(std::make_tuple(&m, &n)));
820 EXPECT_EQ(1, m);
821 EXPECT_EQ(2, n);
822}

◆ TEST() [47/105]

testing::gmock_more_actions_test::TEST ( DoAllTest  ,
TwoActions   
)

Definition at line 806 of file gmock-more-actions_test.cc.

806 {
807 int n = 0;
808 Action<int(int*)> a = DoAll(SetArgPointee<0>(1), // NOLINT
809 Return(2));
810 EXPECT_EQ(2, a.Perform(std::make_tuple(&n)));
811 EXPECT_EQ(1, n);
812}

◆ TEST() [48/105]

testing::gmock_more_actions_test::TEST ( InvokeArgumentTest  ,
ByConstReferenceFunction   
)

Definition at line 783 of file gmock-more-actions_test.cc.

783 {
784 Action<bool(bool (*function)(const std::string& s))> a = // NOLINT
785 InvokeArgument<0>(std::string("Hi"));
786 // When action 'a' is constructed, it makes a copy of the temporary
787 // string object passed to it, so it's OK to use 'a' later, when the
788 // temporary object has already died.
789 EXPECT_TRUE(a.Perform(std::make_tuple(&ByConstRef)));
790}
bool ByConstRef(const std::string &s)

◆ TEST() [49/105]

testing::gmock_more_actions_test::TEST ( InvokeArgumentTest  ,
ByExplicitConstReferenceFunction   
)

Definition at line 794 of file gmock-more-actions_test.cc.

794 {
795 Action<bool(bool (*)(const double& x))> a = // NOLINT
796 InvokeArgument<0>(ByRef(g_double));
797 // The above line calls ByRef() on a const value.
798 EXPECT_TRUE(a.Perform(std::make_tuple(&ReferencesGlobalDouble)));
799
800 double x = 0;
801 a = InvokeArgument<0>(ByRef(x)); // This calls ByRef() on a non-const.
802 EXPECT_FALSE(a.Perform(std::make_tuple(&ReferencesGlobalDouble)));
803}
inline ::std::reference_wrapper< T > ByRef(T &l_value)

◆ TEST() [50/105]

testing::gmock_more_actions_test::TEST ( InvokeArgumentTest  ,
ByPointerFunction   
)

Definition at line 768 of file gmock-more-actions_test.cc.

768 {
769 Action<const char*(const char* (*)(const char* input, short n))> // NOLINT
770 a = InvokeArgument<0>(static_cast<const char*>("Hi"), Short(1));
771 EXPECT_STREQ("i", a.Perform(std::make_tuple(&Binary)));
772}
const char * Binary(const char *input, short n)

◆ TEST() [51/105]

testing::gmock_more_actions_test::TEST ( InvokeArgumentTest  ,
Function0   
)

Definition at line 692 of file gmock-more-actions_test.cc.

692 {
693 Action<int(int, int (*)())> a = InvokeArgument<1>(); // NOLINT
694 EXPECT_EQ(1, a.Perform(std::make_tuple(2, &Nullary)));
695}

◆ TEST() [52/105]

testing::gmock_more_actions_test::TEST ( InvokeArgumentTest  ,
Function10   
)

Definition at line 759 of file gmock-more-actions_test.cc.

759 {
760 Action<std::string(std::string(*)(
761 const char*, const char*, const char*, const char*, const char*,
762 const char*, const char*, const char*, const char*, const char*))>
763 a = InvokeArgument<0>("1", "2", "3", "4", "5", "6", "7", "8", "9", "0");
764 EXPECT_EQ("1234567890", a.Perform(std::make_tuple(&Concat10)));
765}
std::string Concat10(const char *s1, const char *s2, const char *s3, const char *s4, const char *s5, const char *s6, const char *s7, const char *s8, const char *s9, const char *s10)

◆ TEST() [53/105]

testing::gmock_more_actions_test::TEST ( InvokeArgumentTest  ,
Function5   
)

Definition at line 704 of file gmock-more-actions_test.cc.

704 {
705 Action<int(int (*)(int, int, int, int, int))> a = // NOLINT
706 InvokeArgument<0>(10000, 2000, 300, 40, 5);
707 EXPECT_EQ(12345, a.Perform(std::make_tuple(&SumOf5)));
708}
int SumOf5(int a, int b, int c, int d, int e)

◆ TEST() [54/105]

testing::gmock_more_actions_test::TEST ( InvokeArgumentTest  ,
Function6   
)

Definition at line 718 of file gmock-more-actions_test.cc.

718 {
719 Action<int(int (*)(int, int, int, int, int, int))> a = // NOLINT
720 InvokeArgument<0>(100000, 20000, 3000, 400, 50, 6);
721 EXPECT_EQ(123456, a.Perform(std::make_tuple(&SumOf6)));
722}
int SumOf6(int a, int b, int c, int d, int e, int f)

◆ TEST() [55/105]

testing::gmock_more_actions_test::TEST ( InvokeArgumentTest  ,
Function7   
)

Definition at line 732 of file gmock-more-actions_test.cc.

732 {
733 Action<std::string(std::string(*)(const char*, const char*, const char*,
734 const char*, const char*, const char*,
735 const char*))>
736 a = InvokeArgument<0>("1", "2", "3", "4", "5", "6", "7");
737 EXPECT_EQ("1234567", a.Perform(std::make_tuple(&Concat7)));
738}
std::string Concat7(const char *s1, const char *s2, const char *s3, const char *s4, const char *s5, const char *s6, const char *s7)

◆ TEST() [56/105]

testing::gmock_more_actions_test::TEST ( InvokeArgumentTest  ,
Function8   
)

Definition at line 741 of file gmock-more-actions_test.cc.

741 {
742 Action<std::string(std::string(*)(const char*, const char*, const char*,
743 const char*, const char*, const char*,
744 const char*, const char*))>
745 a = InvokeArgument<0>("1", "2", "3", "4", "5", "6", "7", "8");
746 EXPECT_EQ("12345678", a.Perform(std::make_tuple(&Concat8)));
747}
std::string Concat8(const char *s1, const char *s2, const char *s3, const char *s4, const char *s5, const char *s6, const char *s7, const char *s8)

◆ TEST() [57/105]

testing::gmock_more_actions_test::TEST ( InvokeArgumentTest  ,
Function9   
)

Definition at line 750 of file gmock-more-actions_test.cc.

750 {
751 Action<std::string(std::string(*)(const char*, const char*, const char*,
752 const char*, const char*, const char*,
753 const char*, const char*, const char*))>
754 a = InvokeArgument<0>("1", "2", "3", "4", "5", "6", "7", "8", "9");
755 EXPECT_EQ("123456789", a.Perform(std::make_tuple(&Concat9)));
756}
std::string Concat9(const char *s1, const char *s2, const char *s3, const char *s4, const char *s5, const char *s6, const char *s7, const char *s8, const char *s9)

◆ TEST() [58/105]

testing::gmock_more_actions_test::TEST ( InvokeArgumentTest  ,
FunctionWithCStringLiteral   
)

Definition at line 776 of file gmock-more-actions_test.cc.

776 {
777 Action<const char*(const char* (*)(const char* input, short n))> // NOLINT
778 a = InvokeArgument<0>("Hi", Short(1));
779 EXPECT_STREQ("i", a.Perform(std::make_tuple(&Binary)));
780}

◆ TEST() [59/105]

testing::gmock_more_actions_test::TEST ( InvokeArgumentTest  ,
Functor1   
)

Definition at line 698 of file gmock-more-actions_test.cc.

698 {
699 Action<int(UnaryFunctor)> a = InvokeArgument<0>(true); // NOLINT
700 EXPECT_EQ(1, a.Perform(std::make_tuple(UnaryFunctor())));
701}

◆ TEST() [60/105]

testing::gmock_more_actions_test::TEST ( InvokeArgumentTest  ,
Functor5   
)

Definition at line 711 of file gmock-more-actions_test.cc.

711 {
712 Action<int(SumOf5Functor)> a = // NOLINT
713 InvokeArgument<0>(10000, 2000, 300, 40, 5);
714 EXPECT_EQ(12345, a.Perform(std::make_tuple(SumOf5Functor())));
715}

◆ TEST() [61/105]

testing::gmock_more_actions_test::TEST ( InvokeArgumentTest  ,
Functor6   
)

Definition at line 725 of file gmock-more-actions_test.cc.

725 {
726 Action<int(SumOf6Functor)> a = // NOLINT
727 InvokeArgument<0>(100000, 20000, 3000, 400, 50, 6);
728 EXPECT_EQ(123456, a.Perform(std::make_tuple(SumOf6Functor())));
729}

◆ TEST() [62/105]

testing::gmock_more_actions_test::TEST ( InvokeMethodTest  ,
Binary   
)

Definition at line 340 of file gmock-more-actions_test.cc.

340 {
341 Foo foo;
342 Action<std::string(const std::string&, char)> a = Invoke(&foo, &Foo::Binary);
343 std::string s("Hell");
344 std::tuple<std::string, char> dummy = std::make_tuple(s, 'o');
345 EXPECT_EQ("Hello", a.Perform(dummy));
346}
std::decay< FunctionImpl >::type Invoke(FunctionImpl &&function_impl)

◆ TEST() [63/105]

testing::gmock_more_actions_test::TEST ( InvokeMethodTest  ,
MethodThatTakes10Arguments   
)

Definition at line 416 of file gmock-more-actions_test.cc.

416 {
417 Foo foo;
418 Action<std::string(const char*, const char*, const char*, const char*,
419 const char*, const char*, const char*, const char*,
420 const char*, const char*)>
421 a = Invoke(&foo, &Foo::Concat10);
422 EXPECT_EQ("1234567890",
423 a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
424 CharPtr("4"), CharPtr("5"), CharPtr("6"),
425 CharPtr("7"), CharPtr("8"), CharPtr("9"),
426 CharPtr("0"))));
427}

◆ TEST() [64/105]

testing::gmock_more_actions_test::TEST ( InvokeMethodTest  ,
MethodThatTakes4Arguments   
)

Definition at line 356 of file gmock-more-actions_test.cc.

356 {
357 Foo foo;
358 Action<int(int, int, int, int)> a = Invoke(&foo, &Foo::SumOf4); // NOLINT
359 EXPECT_EQ(1357, a.Perform(std::make_tuple(1000, 200, 30, 4)));
360}
int SumOf4(int a, int b, int c, int d)

◆ TEST() [65/105]

testing::gmock_more_actions_test::TEST ( InvokeMethodTest  ,
MethodThatTakes5Arguments   
)

Definition at line 363 of file gmock-more-actions_test.cc.

363 {
364 Foo foo;
365 Action<int(int, int, int, int, int)> a = Invoke(&foo, &Foo::SumOf5); // NOLINT
366 EXPECT_EQ(12345, a.Perform(std::make_tuple(10000, 2000, 300, 40, 5)));
367}

◆ TEST() [66/105]

testing::gmock_more_actions_test::TEST ( InvokeMethodTest  ,
MethodThatTakes6Arguments   
)

Definition at line 370 of file gmock-more-actions_test.cc.

370 {
371 Foo foo;
372 Action<int(int, int, int, int, int, int)> a = // NOLINT
374 EXPECT_EQ(123456,
375 a.Perform(std::make_tuple(100000, 20000, 3000, 400, 50, 6)));
376}

◆ TEST() [67/105]

testing::gmock_more_actions_test::TEST ( InvokeMethodTest  ,
MethodThatTakes7Arguments   
)

Definition at line 379 of file gmock-more-actions_test.cc.

379 {
380 Foo foo;
381 Action<std::string(const char*, const char*, const char*, const char*,
382 const char*, const char*, const char*)>
383 a = Invoke(&foo, &Foo::Concat7);
384 EXPECT_EQ("1234567",
385 a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
386 CharPtr("4"), CharPtr("5"), CharPtr("6"),
387 CharPtr("7"))));
388}

◆ TEST() [68/105]

testing::gmock_more_actions_test::TEST ( InvokeMethodTest  ,
MethodThatTakes8Arguments   
)

Definition at line 391 of file gmock-more-actions_test.cc.

391 {
392 Foo foo;
393 Action<std::string(const char*, const char*, const char*, const char*,
394 const char*, const char*, const char*, const char*)>
395 a = Invoke(&foo, &Foo::Concat8);
396 EXPECT_EQ("12345678",
397 a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
398 CharPtr("4"), CharPtr("5"), CharPtr("6"),
399 CharPtr("7"), CharPtr("8"))));
400}

◆ TEST() [69/105]

testing::gmock_more_actions_test::TEST ( InvokeMethodTest  ,
MethodThatTakes9Arguments   
)

Definition at line 403 of file gmock-more-actions_test.cc.

403 {
404 Foo foo;
405 Action<std::string(const char*, const char*, const char*, const char*,
406 const char*, const char*, const char*, const char*,
407 const char*)>
408 a = Invoke(&foo, &Foo::Concat9);
409 EXPECT_EQ("123456789", a.Perform(std::make_tuple(
410 CharPtr("1"), CharPtr("2"), CharPtr("3"),
411 CharPtr("4"), CharPtr("5"), CharPtr("6"),
412 CharPtr("7"), CharPtr("8"), CharPtr("9"))));
413}

◆ TEST() [70/105]

testing::gmock_more_actions_test::TEST ( InvokeMethodTest  ,
MethodWithCompatibleType   
)

Definition at line 430 of file gmock-more-actions_test.cc.

430 {
431 Foo foo;
432 Action<long(int, short, char, bool)> a = // NOLINT
434 EXPECT_EQ(4444, a.Perform(std::make_tuple(4000, Short(300), Char(20), true)));
435}

◆ TEST() [71/105]

testing::gmock_more_actions_test::TEST ( InvokeMethodTest  ,
Nullary   
)

Definition at line 326 of file gmock-more-actions_test.cc.

326 {
327 Foo foo;
328 Action<int()> a = Invoke(&foo, &Foo::Nullary); // NOLINT
329 EXPECT_EQ(123, a.Perform(std::make_tuple()));
330}

◆ TEST() [72/105]

testing::gmock_more_actions_test::TEST ( InvokeMethodTest  ,
Ternary   
)

Definition at line 349 of file gmock-more-actions_test.cc.

349 {
350 Foo foo;
351 Action<int(int, bool, char)> a = Invoke(&foo, &Foo::Ternary); // NOLINT
352 EXPECT_EQ(1124, a.Perform(std::make_tuple(1000, true, Char(1))));
353}
int Ternary(int x, char y, short z)

◆ TEST() [73/105]

testing::gmock_more_actions_test::TEST ( InvokeMethodTest  ,
Unary   
)

Definition at line 333 of file gmock-more-actions_test.cc.

333 {
334 Foo foo;
335 Action<short(long)> a = Invoke(&foo, &Foo::Unary); // NOLINT
336 EXPECT_EQ(4123, a.Perform(std::make_tuple(4000)));
337}

◆ TEST() [74/105]

testing::gmock_more_actions_test::TEST ( InvokeTest  ,
Binary   
)

Definition at line 205 of file gmock-more-actions_test.cc.

205 {
206 Action<const char*(const char*, short)> a = Invoke(Binary); // NOLINT
207 const char* p = "Hello";
208 EXPECT_EQ(p + 2, a.Perform(std::make_tuple(p, Short(2))));
209}

◆ TEST() [75/105]

testing::gmock_more_actions_test::TEST ( InvokeTest  ,
FunctionThatTakes10Arguments   
)

Definition at line 275 of file gmock-more-actions_test.cc.

275 {
276 Action<std::string(const char*, const char*, const char*, const char*,
277 const char*, const char*, const char*, const char*,
278 const char*, const char*)>
279 a = Invoke(Concat10);
280 EXPECT_EQ("1234567890",
281 a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
282 CharPtr("4"), CharPtr("5"), CharPtr("6"),
283 CharPtr("7"), CharPtr("8"), CharPtr("9"),
284 CharPtr("0"))));
285}

◆ TEST() [76/105]

testing::gmock_more_actions_test::TEST ( InvokeTest  ,
FunctionThatTakes4Arguments   
)

Definition at line 218 of file gmock-more-actions_test.cc.

218 {
219 Action<int(int, int, int, int)> a = Invoke(SumOf4); // NOLINT
220 EXPECT_EQ(1234, a.Perform(std::make_tuple(1000, 200, 30, 4)));
221}

◆ TEST() [77/105]

testing::gmock_more_actions_test::TEST ( InvokeTest  ,
FunctionThatTakes5Arguments   
)

Definition at line 224 of file gmock-more-actions_test.cc.

224 {
225 Action<int(int, int, int, int, int)> a = Invoke(SumOf5); // NOLINT
226 EXPECT_EQ(12345, a.Perform(std::make_tuple(10000, 2000, 300, 40, 5)));
227}

◆ TEST() [78/105]

testing::gmock_more_actions_test::TEST ( InvokeTest  ,
FunctionThatTakes6Arguments   
)

Definition at line 230 of file gmock-more-actions_test.cc.

230 {
231 Action<int(int, int, int, int, int, int)> a = Invoke(SumOf6); // NOLINT
232 EXPECT_EQ(123456,
233 a.Perform(std::make_tuple(100000, 20000, 3000, 400, 50, 6)));
234}

◆ TEST() [79/105]

testing::gmock_more_actions_test::TEST ( InvokeTest  ,
FunctionThatTakes7Arguments   
)

Definition at line 241 of file gmock-more-actions_test.cc.

241 {
242 Action<std::string(const char*, const char*, const char*, const char*,
243 const char*, const char*, const char*)>
244 a = Invoke(Concat7);
245 EXPECT_EQ("1234567",
246 a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
247 CharPtr("4"), CharPtr("5"), CharPtr("6"),
248 CharPtr("7"))));
249}

◆ TEST() [80/105]

testing::gmock_more_actions_test::TEST ( InvokeTest  ,
FunctionThatTakes8Arguments   
)

Definition at line 252 of file gmock-more-actions_test.cc.

252 {
253 Action<std::string(const char*, const char*, const char*, const char*,
254 const char*, const char*, const char*, const char*)>
255 a = Invoke(Concat8);
256 EXPECT_EQ("12345678",
257 a.Perform(std::make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
258 CharPtr("4"), CharPtr("5"), CharPtr("6"),
259 CharPtr("7"), CharPtr("8"))));
260}

◆ TEST() [81/105]

testing::gmock_more_actions_test::TEST ( InvokeTest  ,
FunctionThatTakes9Arguments   
)

Definition at line 263 of file gmock-more-actions_test.cc.

263 {
264 Action<std::string(const char*, const char*, const char*, const char*,
265 const char*, const char*, const char*, const char*,
266 const char*)>
267 a = Invoke(Concat9);
268 EXPECT_EQ("123456789", a.Perform(std::make_tuple(
269 CharPtr("1"), CharPtr("2"), CharPtr("3"),
270 CharPtr("4"), CharPtr("5"), CharPtr("6"),
271 CharPtr("7"), CharPtr("8"), CharPtr("9"))));
272}

◆ TEST() [82/105]

testing::gmock_more_actions_test::TEST ( InvokeTest  ,
FunctionWithCompatibleType   
)

Definition at line 318 of file gmock-more-actions_test.cc.

318 {
319 Action<long(int, short, char, bool)> a = Invoke(SumOf4); // NOLINT
320 EXPECT_EQ(4321, a.Perform(std::make_tuple(4000, Short(300), Char(20), true)));
321}

◆ TEST() [83/105]

testing::gmock_more_actions_test::TEST ( InvokeTest  ,
FunctionWithUnusedParameters   
)

Definition at line 288 of file gmock-more-actions_test.cc.

288 {
289 Action<int(int, int, double, const std::string&)> a1 = Invoke(SumOfFirst2);
290 std::tuple<int, int, double, std::string> dummy =
291 std::make_tuple(10, 2, 5.6, std::string("hi"));
292 EXPECT_EQ(12, a1.Perform(dummy));
293
294 Action<int(int, int, bool, int*)> a2 =
296 EXPECT_EQ(
297 23, a2.Perform(std::make_tuple(20, 3, true, static_cast<int*>(nullptr))));
298}
int SumOfFirst2(int a, int b, Unused, Unused)

◆ TEST() [84/105]

testing::gmock_more_actions_test::TEST ( InvokeTest  ,
Functor   
)

Definition at line 312 of file gmock-more-actions_test.cc.

312 {
313 Action<long(long, int)> a = Invoke(plus<long>()); // NOLINT
314 EXPECT_EQ(3L, a.Perform(std::make_tuple(1, 2)));
315}

◆ TEST() [85/105]

testing::gmock_more_actions_test::TEST ( InvokeTest  ,
MethodWithUnusedParameters   
)

Definition at line 301 of file gmock-more-actions_test.cc.

301 {
302 Foo foo;
303 Action<int(std::string, bool, int, int)> a1 = Invoke(&foo, &Foo::SumOfLast2);
304 EXPECT_EQ(12, a1.Perform(std::make_tuple(CharPtr("hi"), true, 10, 2)));
305
306 Action<int(char, double, int, int)> a2 =
307 Invoke(&foo, &Foo::SumOfLast2);
308 EXPECT_EQ(23, a2.Perform(std::make_tuple('a', 2.5, 20, 3)));
309}

◆ TEST() [86/105]

testing::gmock_more_actions_test::TEST ( InvokeTest  ,
Nullary   
)

Definition at line 192 of file gmock-more-actions_test.cc.

192 {
193 Action<int()> a = Invoke(Nullary); // NOLINT
194 EXPECT_EQ(1, a.Perform(std::make_tuple()));
195}

◆ TEST() [87/105]

testing::gmock_more_actions_test::TEST ( InvokeTest  ,
Ternary   
)

Definition at line 212 of file gmock-more-actions_test.cc.

212 {
213 Action<int(int, char, short)> a = Invoke(Ternary); // NOLINT
214 EXPECT_EQ(6, a.Perform(std::make_tuple(1, '\2', Short(3))));
215}

◆ TEST() [88/105]

testing::gmock_more_actions_test::TEST ( InvokeTest  ,
Unary   
)

Definition at line 198 of file gmock-more-actions_test.cc.

198 {
199 Action<bool(int)> a = Invoke(Unary); // NOLINT
200 EXPECT_FALSE(a.Perform(std::make_tuple(1)));
201 EXPECT_TRUE(a.Perform(std::make_tuple(-1)));
202}

◆ TEST() [89/105]

testing::gmock_more_actions_test::TEST ( ReturnArgActionTest  ,
WorksForMultiArgBoolArg0   
)

Definition at line 455 of file gmock-more-actions_test.cc.

455 {
456 const Action<bool(bool, bool, bool)> a = ReturnArg<0>();
457 EXPECT_TRUE(a.Perform(std::make_tuple(true, false, false)));
458}

◆ TEST() [90/105]

testing::gmock_more_actions_test::TEST ( ReturnArgActionTest  ,
WorksForMultiArgStringArg2   
)

Definition at line 460 of file gmock-more-actions_test.cc.

460 {
461 const Action<std::string(int, int, std::string, int)> a = ReturnArg<2>();
462 EXPECT_EQ("seven", a.Perform(std::make_tuple(5, 6, std::string("seven"), 8)));
463}

◆ TEST() [91/105]

testing::gmock_more_actions_test::TEST ( ReturnArgActionTest  ,
WorksForOneArgIntArg0   
)

Definition at line 450 of file gmock-more-actions_test.cc.

450 {
451 const Action<int(int)> a = ReturnArg<0>();
452 EXPECT_EQ(5, a.Perform(std::make_tuple(5)));
453}

◆ TEST() [92/105]

testing::gmock_more_actions_test::TEST ( ReturnPointeeTest  ,
Works   
)

Definition at line 680 of file gmock-more-actions_test.cc.

680 {
681 int n = 42;
682 const Action<int()> a = ReturnPointee(&n);
683 EXPECT_EQ(42, a.Perform(std::make_tuple()));
684
685 n = 43;
686 EXPECT_EQ(43, a.Perform(std::make_tuple()));
687}
internal::ReturnPointeeAction< Ptr > ReturnPointee(Ptr pointer)

◆ TEST() [93/105]

testing::gmock_more_actions_test::TEST ( SaveArgActionTest  ,
WorksForCompatibleType   
)

Definition at line 472 of file gmock-more-actions_test.cc.

472 {
473 int result = 0;
474 const Action<void(bool, char)> a1 = SaveArg<1>(&result);
475 a1.Perform(std::make_tuple(true, 'a'));
476 EXPECT_EQ('a', result);
477}

◆ TEST() [94/105]

testing::gmock_more_actions_test::TEST ( SaveArgActionTest  ,
WorksForSameType   
)

Definition at line 465 of file gmock-more-actions_test.cc.

465 {
466 int result = 0;
467 const Action<void(int n)> a1 = SaveArg<0>(&result);
468 a1.Perform(std::make_tuple(5));
469 EXPECT_EQ(5, result);
470}

◆ TEST() [95/105]

testing::gmock_more_actions_test::TEST ( SaveArgPointeeActionTest  ,
WorksForCompatibleType   
)

Definition at line 487 of file gmock-more-actions_test.cc.

487 {
488 int result = 0;
489 char value = 'a';
490 const Action<void(bool, char*)> a1 = SaveArgPointee<1>(&result);
491 a1.Perform(std::make_tuple(true, &value));
492 EXPECT_EQ('a', result);
493}

◆ TEST() [96/105]

testing::gmock_more_actions_test::TEST ( SaveArgPointeeActionTest  ,
WorksForSameType   
)

Definition at line 479 of file gmock-more-actions_test.cc.

479 {
480 int result = 0;
481 const int value = 5;
482 const Action<void(const int*)> a1 = SaveArgPointee<0>(&result);
483 a1.Perform(std::make_tuple(&value));
484 EXPECT_EQ(5, result);
485}

◆ TEST() [97/105]

testing::gmock_more_actions_test::TEST ( SetArgRefereeActionTest  ,
WorksForCompatibleType   
)

Definition at line 502 of file gmock-more-actions_test.cc.

502 {
503 int value = 0;
504 const Action<void(int, int&)> a1 = SetArgReferee<1>('a');
505 a1.Perform(std::tuple<int, int&>(0, value));
506 EXPECT_EQ('a', value);
507}

◆ TEST() [98/105]

testing::gmock_more_actions_test::TEST ( SetArgRefereeActionTest  ,
WorksForSameType   
)

Definition at line 495 of file gmock-more-actions_test.cc.

495 {
496 int value = 0;
497 const Action<void(int&)> a1 = SetArgReferee<0>(1);
498 a1.Perform(std::tuple<int&>(value));
499 EXPECT_EQ(1, value);
500}

◆ TEST() [99/105]

testing::gmock_more_actions_test::TEST ( SetArgRefereeActionTest  ,
WorksWithExtraArguments   
)

Definition at line 509 of file gmock-more-actions_test.cc.

509 {
510 int value = 0;
511 const Action<void(bool, int, int&, const char*)> a1 = SetArgReferee<2>('a');
512 a1.Perform(std::tuple<bool, int, int&, const char*>(true, 0, value, "hi"));
513 EXPECT_EQ('a', value);
514}

◆ TEST() [100/105]

testing::gmock_more_actions_test::TEST ( SetArrayArgumentTest  ,
SetsTheNthArray   
)

Definition at line 603 of file gmock-more-actions_test.cc.

603 {
604 using MyFunction = void(bool, int*, char*);
605 int numbers[] = { 1, 2, 3 };
606 Action<MyFunction> a = SetArrayArgument<1>(numbers, numbers + 3);
607
608 int n[4] = {};
609 int* pn = n;
610 char ch[4] = {};
611 char* pch = ch;
612 a.Perform(std::make_tuple(true, pn, pch));
613 EXPECT_EQ(1, n[0]);
614 EXPECT_EQ(2, n[1]);
615 EXPECT_EQ(3, n[2]);
616 EXPECT_EQ(0, n[3]);
617 EXPECT_EQ('\0', ch[0]);
618 EXPECT_EQ('\0', ch[1]);
619 EXPECT_EQ('\0', ch[2]);
620 EXPECT_EQ('\0', ch[3]);
621
622 // Tests first and last are iterators.
623 std::string letters = "abc";
624 a = SetArrayArgument<2>(letters.begin(), letters.end());
625 std::fill_n(n, 4, 0);
626 std::fill_n(ch, 4, '\0');
627 a.Perform(std::make_tuple(true, pn, pch));
628 EXPECT_EQ(0, n[0]);
629 EXPECT_EQ(0, n[1]);
630 EXPECT_EQ(0, n[2]);
631 EXPECT_EQ(0, n[3]);
632 EXPECT_EQ('a', ch[0]);
633 EXPECT_EQ('b', ch[1]);
634 EXPECT_EQ('c', ch[2]);
635 EXPECT_EQ('\0', ch[3]);
636}

◆ TEST() [101/105]

testing::gmock_more_actions_test::TEST ( SetArrayArgumentTest  ,
SetsTheNthArrayWithConvertibleType   
)

Definition at line 655 of file gmock-more-actions_test.cc.

655 {
656 using MyFunction = void(bool, int*);
657 char chars[] = { 97, 98, 99 };
658 Action<MyFunction> a = SetArrayArgument<1>(chars, chars + 3);
659
660 int codes[4] = { 111, 222, 333, 444 };
661 int* pcodes = codes;
662 a.Perform(std::make_tuple(true, pcodes));
663 EXPECT_EQ(97, codes[0]);
664 EXPECT_EQ(98, codes[1]);
665 EXPECT_EQ(99, codes[2]);
666 EXPECT_EQ(444, codes[3]);
667}

◆ TEST() [102/105]

testing::gmock_more_actions_test::TEST ( SetArrayArgumentTest  ,
SetsTheNthArrayWithEmptyRange   
)

Definition at line 639 of file gmock-more-actions_test.cc.

639 {
640 using MyFunction = void(bool, int*);
641 int numbers[] = { 1, 2, 3 };
642 Action<MyFunction> a = SetArrayArgument<1>(numbers, numbers);
643
644 int n[4] = {};
645 int* pn = n;
646 a.Perform(std::make_tuple(true, pn));
647 EXPECT_EQ(0, n[0]);
648 EXPECT_EQ(0, n[1]);
649 EXPECT_EQ(0, n[2]);
650 EXPECT_EQ(0, n[3]);
651}

◆ TEST() [103/105]

testing::gmock_more_actions_test::TEST ( SetArrayArgumentTest  ,
SetsTheNthArrayWithIteratorArgument   
)

Definition at line 670 of file gmock-more-actions_test.cc.

670 {
671 using MyFunction = void(bool, std::back_insert_iterator<std::string>);
672 std::string letters = "abc";
673 Action<MyFunction> a = SetArrayArgument<1>(letters.begin(), letters.end());
674
675 std::string s;
676 a.Perform(std::make_tuple(true, back_inserter(s)));
677 EXPECT_EQ(letters, s);
678}

◆ TEST() [104/105]

testing::gmock_more_actions_test::TEST ( WithArgTest  ,
OneArg   
)

Definition at line 444 of file gmock-more-actions_test.cc.

444 {
445 Action<bool(double x, int n)> b = WithArg<1>(Invoke(Unary)); // NOLINT
446 EXPECT_TRUE(b.Perform(std::make_tuple(1.5, -1)));
447 EXPECT_FALSE(b.Perform(std::make_tuple(1.5, 1)));
448}

◆ TEST() [105/105]

testing::gmock_more_actions_test::TEST ( WithoutArgsTest  ,
NoArg   
)

Definition at line 438 of file gmock-more-actions_test.cc.

438 {
439 Action<int(int n)> a = WithoutArgs(Invoke(Nullary)); // NOLINT
440 EXPECT_EQ(1, a.Perform(std::make_tuple(2)));
441}
internal::WithArgsAction< typename std::decay< InnerAction >::type > WithoutArgs(InnerAction &&action)

◆ Unary()

bool testing::gmock_more_actions_test::Unary ( int  x)

Definition at line 76 of file gmock-more-actions_test.cc.

76{ return x < 0; }

Variable Documentation

◆ g_done

bool testing::gmock_more_actions_test::g_done = false

Definition at line 74 of file gmock-more-actions_test.cc.

◆ g_double

const double testing::gmock_more_actions_test::g_double = 0

Definition at line 80 of file gmock-more-actions_test.cc.