Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
testing::gmock_more_actions_test Namespace Reference

Classes

class  DeletionTester
 
class  Foo
 
class  NullaryFunctor
 
struct  SumOf5Functor
 
struct  SumOf6Functor
 
struct  UnaryFunctor
 
class  VoidNullaryFunctor
 

Functions

short Short (short n)
 
char Char (char ch)
 
int Nullary ()
 
void VoidNullary ()
 
bool Unary (int x)
 
const char * Plus1 (const char *s)
 
void VoidUnary (int)
 
bool ByConstRef (const std::string &s)
 
bool ReferencesGlobalDouble (const double &x)
 
std::string ByNonConstRef (std::string &s)
 
const char * Binary (const char *input, short n)
 
void VoidBinary (int, char)
 
int Ternary (int x, char y, short z)
 
void VoidTernary (int, char, bool)
 
int SumOf4 (int a, int b, int c, int d)
 
int SumOfFirst2 (int a, int b, Unused, Unused)
 
void VoidFunctionWithFourArguments (char, int, float, double)
 
std::string Concat4 (const char *s1, const char *s2, const char *s3, const char *s4)
 
int SumOf5 (int a, int b, int c, int d, int e)
 
std::string Concat5 (const char *s1, const char *s2, const char *s3, const char *s4, const char *s5)
 
int SumOf6 (int a, int b, int c, int d, int e, int f)
 
std::string Concat6 (const char *s1, const char *s2, const char *s3, const char *s4, const char *s5, const char *s6)
 
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 (SaveArgPointeeActionTest, WorksForLinkedPtr)
 
 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)
 

Variables

bool g_done = false
 
const double g_double = 0
 

Function Documentation

◆ Binary()

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

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

108{ return input + n; } // NOLINT

◆ ByConstRef()

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

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

97{ return s == "Hi"; }
char * s

◆ ByNonConstRef()

std::string testing::gmock_more_actions_test::ByNonConstRef ( std::string & s)

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

102{ return s += "+"; } // NOLINT

◆ Char()

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

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

73{ return ch; }
Here is the caller graph for this function:

◆ CharPtr()

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

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

279{ return s; }
Here is the caller graph for this function:

◆ 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 173 of file gmock-more-actions_test.cc.

176 {
177 return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10;
178}
Here is the caller graph for this function:

◆ Concat4()

std::string testing::gmock_more_actions_test::Concat4 ( const char * s1,
const char * s2,
const char * s3,
const char * s4 )

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

123 {
124 return std::string(s1) + s2 + s3 + s4;
125}

◆ Concat5()

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

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

136 {
137 return std::string(s1) + s2 + s3 + s4 + s5;
138}

◆ Concat6()

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

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

151 {
152 return std::string(s1) + s2 + s3 + s4 + s5 + s6;
153}

◆ 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 155 of file gmock-more-actions_test.cc.

157 {
158 return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7;
159}
Here is the caller graph for this function:

◆ 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 161 of file gmock-more-actions_test.cc.

163 {
164 return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8;
165}
Here is the caller graph for this function:

◆ 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 167 of file gmock-more-actions_test.cc.

169 {
170 return std::string(s1) + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9;
171}
Here is the caller graph for this function:

◆ Nullary()

int testing::gmock_more_actions_test::Nullary ( )

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

76{ return 1; }
Here is the caller graph for this function:

◆ Plus1()

const char * testing::gmock_more_actions_test::Plus1 ( const char * s)

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

93{ return s + 1; }

◆ ReferencesGlobalDouble()

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

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

100{ return &x == &g_double; }

◆ Short()

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

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

72{ return n; } // NOLINT
Here is the caller graph for this function:

◆ SumOf4()

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

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

116{ return a + b + c + d; }
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
CK_ULONG d
Here is the caller graph for this function:

◆ SumOf5()

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

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

127{ return a + b + c + d + e; }
Here is the caller graph for this function:

◆ SumOf6()

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

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

140 {
141 return a + b + c + d + e + f;
142}
Here is the caller graph for this function:

◆ SumOfFirst2()

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

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

118{ return a + b; }
Here is the caller graph for this function:

◆ Ternary()

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

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

112{ return x + y + z; } // NOLINT
Here is the caller graph for this function:

◆ TEST() [1/47]

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

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

581 {
582 bool is_deleted = false;
583 DeletionTester* t = new DeletionTester(&is_deleted);
584 const Action<void(DeletionTester*)> a1 = DeleteArg<0>(); // NOLINT
585 EXPECT_FALSE(is_deleted);
586 a1.Perform(make_tuple(t));
587 EXPECT_TRUE(is_deleted);
588}
Result Perform(ArgumentTuple args) const
#define EXPECT_TRUE(condition)
Definition gtest.h:1895
#define EXPECT_FALSE(condition)
Definition gtest.h:1898
Here is the call graph for this function:

◆ TEST() [2/47]

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

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

590 {
591 bool is_deleted = false;
592 DeletionTester* t = new DeletionTester(&is_deleted);
593 const Action<void(bool, int, int, const char*, bool,
594 int, int, int, int, DeletionTester*)> a1 = DeleteArg<9>();
595 EXPECT_FALSE(is_deleted);
596 a1.Perform(make_tuple(true, 5, 6, CharPtr("hi"), false, 7, 8, 9, 10, t));
597 EXPECT_TRUE(is_deleted);
598}
Here is the call graph for this function:

◆ TEST() [3/47]

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

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

380 {
381 Foo foo;
382 Action<std::string(const std::string&, char)> a = Invoke(&foo, &Foo::Binary);
383 std::string s("Hell");
384 tuple<std::string, char> dummy = make_tuple(s, 'o');
385 EXPECT_EQ("Hello", a.Perform(dummy));
386}
#define EXPECT_EQ(val1, val2)
Definition gtest.h:1954
Here is the call graph for this function:

◆ TEST() [4/47]

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

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

455 {
456 Foo foo;
457 Action<std::string(const char*, const char*, const char*, const char*,
458 const char*, const char*, const char*, const char*,
459 const char*, const char*)>
460 a = Invoke(&foo, &Foo::Concat10);
461 EXPECT_EQ("1234567890",
462 a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
463 CharPtr("4"), CharPtr("5"), CharPtr("6"),
464 CharPtr("7"), CharPtr("8"), CharPtr("9"),
465 CharPtr("0"))));
466}
Here is the call graph for this function:

◆ TEST() [5/47]

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

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

396 {
397 Foo foo;
398 Action<int(int, int, int, int)> a = Invoke(&foo, &Foo::SumOf4); // NOLINT
399 EXPECT_EQ(1357, a.Perform(make_tuple(1000, 200, 30, 4)));
400}
Here is the call graph for this function:

◆ TEST() [6/47]

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

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

403 {
404 Foo foo;
405 Action<int(int, int, int, int, int)> a = Invoke(&foo, &Foo::SumOf5); // NOLINT
406 EXPECT_EQ(12345, a.Perform(make_tuple(10000, 2000, 300, 40, 5)));
407}
Here is the call graph for this function:

◆ TEST() [7/47]

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

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

410 {
411 Foo foo;
412 Action<int(int, int, int, int, int, int)> a = // NOLINT
413 Invoke(&foo, &Foo::SumOf6);
414 EXPECT_EQ(123456, a.Perform(make_tuple(100000, 20000, 3000, 400, 50, 6)));
415}
Here is the call graph for this function:

◆ TEST() [8/47]

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

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

418 {
419 Foo foo;
420 Action<std::string(const char*, const char*, const char*, const char*,
421 const char*, const char*, const char*)>
422 a = Invoke(&foo, &Foo::Concat7);
423 EXPECT_EQ("1234567",
424 a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
425 CharPtr("4"), CharPtr("5"), CharPtr("6"),
426 CharPtr("7"))));
427}
Here is the call graph for this function:

◆ TEST() [9/47]

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

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

430 {
431 Foo foo;
432 Action<std::string(const char*, const char*, const char*, const char*,
433 const char*, const char*, const char*, const char*)>
434 a = Invoke(&foo, &Foo::Concat8);
435 EXPECT_EQ("12345678",
436 a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
437 CharPtr("4"), CharPtr("5"), CharPtr("6"),
438 CharPtr("7"), CharPtr("8"))));
439}
Here is the call graph for this function:

◆ TEST() [10/47]

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

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

442 {
443 Foo foo;
444 Action<std::string(const char*, const char*, const char*, const char*,
445 const char*, const char*, const char*, const char*,
446 const char*)>
447 a = Invoke(&foo, &Foo::Concat9);
448 EXPECT_EQ("123456789",
449 a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
450 CharPtr("4"), CharPtr("5"), CharPtr("6"),
451 CharPtr("7"), CharPtr("8"), CharPtr("9"))));
452}
Here is the call graph for this function:

◆ TEST() [11/47]

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

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

469 {
470 Foo foo;
471 Action<long(int, short, char, bool)> a = // NOLINT
472 Invoke(&foo, &Foo::SumOf4);
473 EXPECT_EQ(4444, a.Perform(make_tuple(4000, Short(300), Char(20), true)));
474}
Here is the call graph for this function:

◆ TEST() [12/47]

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

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

366 {
367 Foo foo;
368 Action<int()> a = Invoke(&foo, &Foo::Nullary); // NOLINT
369 EXPECT_EQ(123, a.Perform(make_tuple()));
370}
Here is the call graph for this function:

◆ TEST() [13/47]

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

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

389 {
390 Foo foo;
391 Action<int(int, bool, char)> a = Invoke(&foo, &Foo::Ternary); // NOLINT
392 EXPECT_EQ(1124, a.Perform(make_tuple(1000, true, Char(1))));
393}
Here is the call graph for this function:

◆ TEST() [14/47]

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

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

373 {
374 Foo foo;
375 Action<short(long)> a = Invoke(&foo, &Foo::Unary); // NOLINT
376 EXPECT_EQ(4123, a.Perform(make_tuple(4000)));
377}
Here is the call graph for this function:

◆ TEST() [15/47]

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

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

247 {
248 Action<const char*(const char*, short)> a = Invoke(Binary); // NOLINT
249 const char* p = "Hello";
250 EXPECT_EQ(p + 2, a.Perform(make_tuple(p, Short(2))));
251}
const mie::Vuint & p
Definition bn.cpp:27
Here is the call graph for this function:

◆ TEST() [16/47]

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

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

316 {
317 Action<std::string(const char*, const char*, const char*, const char*,
318 const char*, const char*, const char*, const char*,
319 const char*, const char*)>
320 a = Invoke(Concat10);
321 EXPECT_EQ("1234567890",
322 a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
323 CharPtr("4"), CharPtr("5"), CharPtr("6"),
324 CharPtr("7"), CharPtr("8"), CharPtr("9"),
325 CharPtr("0"))));
326}
Here is the call graph for this function:

◆ TEST() [17/47]

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

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

260 {
261 Action<int(int, int, int, int)> a = Invoke(SumOf4); // NOLINT
262 EXPECT_EQ(1234, a.Perform(make_tuple(1000, 200, 30, 4)));
263}
Here is the call graph for this function:

◆ TEST() [18/47]

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

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

266 {
267 Action<int(int, int, int, int, int)> a = Invoke(SumOf5); // NOLINT
268 EXPECT_EQ(12345, a.Perform(make_tuple(10000, 2000, 300, 40, 5)));
269}
Here is the call graph for this function:

◆ TEST() [19/47]

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

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

272 {
273 Action<int(int, int, int, int, int, int)> a = Invoke(SumOf6); // NOLINT
274 EXPECT_EQ(123456, a.Perform(make_tuple(100000, 20000, 3000, 400, 50, 6)));
275}
Here is the call graph for this function:

◆ TEST() [20/47]

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

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

282 {
283 Action<std::string(const char*, const char*, const char*, const char*,
284 const char*, const char*, const char*)>
285 a = Invoke(Concat7);
286 EXPECT_EQ("1234567",
287 a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
288 CharPtr("4"), CharPtr("5"), CharPtr("6"),
289 CharPtr("7"))));
290}
Here is the call graph for this function:

◆ TEST() [21/47]

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

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

293 {
294 Action<std::string(const char*, const char*, const char*, const char*,
295 const char*, const char*, const char*, const char*)>
296 a = Invoke(Concat8);
297 EXPECT_EQ("12345678",
298 a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
299 CharPtr("4"), CharPtr("5"), CharPtr("6"),
300 CharPtr("7"), CharPtr("8"))));
301}
Here is the call graph for this function:

◆ TEST() [22/47]

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

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

304 {
305 Action<std::string(const char*, const char*, const char*, const char*,
306 const char*, const char*, const char*, const char*,
307 const char*)>
308 a = Invoke(Concat9);
309 EXPECT_EQ("123456789",
310 a.Perform(make_tuple(CharPtr("1"), CharPtr("2"), CharPtr("3"),
311 CharPtr("4"), CharPtr("5"), CharPtr("6"),
312 CharPtr("7"), CharPtr("8"), CharPtr("9"))));
313}
Here is the call graph for this function:

◆ TEST() [23/47]

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

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

358 {
359 Action<long(int, short, char, bool)> a = Invoke(SumOf4); // NOLINT
360 EXPECT_EQ(4321, a.Perform(make_tuple(4000, Short(300), Char(20), true)));
361}
Here is the call graph for this function:

◆ TEST() [24/47]

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

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

329 {
330 Action<int(int, int, double, const std::string&)> a1 = Invoke(SumOfFirst2);
331 tuple<int, int, double, std::string> dummy =
332 make_tuple(10, 2, 5.6, std::string("hi"));
333 EXPECT_EQ(12, a1.Perform(dummy));
334
335 Action<int(int, int, bool, int*)> a2 =
336 Invoke(SumOfFirst2);
337 EXPECT_EQ(23, a2.Perform(make_tuple(20, 3, true, static_cast<int*>(NULL))));
338}
Here is the call graph for this function:

◆ TEST() [25/47]

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

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

352 {
353 Action<long(long, int)> a = Invoke(plus<long>()); // NOLINT
354 EXPECT_EQ(3L, a.Perform(make_tuple(1, 2)));
355}
Here is the call graph for this function:

◆ TEST() [26/47]

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

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

341 {
342 Foo foo;
343 Action<int(std::string, bool, int, int)> a1 = Invoke(&foo, &Foo::SumOfLast2);
344 EXPECT_EQ(12, a1.Perform(make_tuple(CharPtr("hi"), true, 10, 2)));
345
346 Action<int(char, double, int, int)> a2 =
347 Invoke(&foo, &Foo::SumOfLast2);
348 EXPECT_EQ(23, a2.Perform(make_tuple('a', 2.5, 20, 3)));
349}
Here is the call graph for this function:

◆ TEST() [27/47]

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

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

234 {
235 Action<int()> a = Invoke(Nullary); // NOLINT
236 EXPECT_EQ(1, a.Perform(make_tuple()));
237}
Here is the call graph for this function:

◆ TEST() [28/47]

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

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

254 {
255 Action<int(int, char, short)> a = Invoke(Ternary); // NOLINT
256 EXPECT_EQ(6, a.Perform(make_tuple(1, '\2', Short(3))));
257}
Here is the call graph for this function:

◆ TEST() [29/47]

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

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

240 {
241 Action<bool(int)> a = Invoke(Unary); // NOLINT
242 EXPECT_FALSE(a.Perform(make_tuple(1)));
243 EXPECT_TRUE(a.Perform(make_tuple(-1)));
244}
Here is the call graph for this function:

◆ TEST() [30/47]

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

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

494 {
495 const Action<bool(bool, bool, bool)> a = ReturnArg<0>();
496 EXPECT_TRUE(a.Perform(make_tuple(true, false, false)));
497}

◆ TEST() [31/47]

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

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

499 {
500 const Action<std::string(int, int, std::string, int)> a = ReturnArg<2>();
501 EXPECT_EQ("seven", a.Perform(make_tuple(5, 6, std::string("seven"), 8)));
502}

◆ TEST() [32/47]

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

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

489 {
490 const Action<int(int)> a = ReturnArg<0>();
491 EXPECT_EQ(5, a.Perform(make_tuple(5)));
492}

◆ TEST() [33/47]

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

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

700 {
701 int n = 42;
702 const Action<int()> a = ReturnPointee(&n);
703 EXPECT_EQ(42, a.Perform(make_tuple()));
704
705 n = 43;
706 EXPECT_EQ(43, a.Perform(make_tuple()));
707}

◆ TEST() [34/47]

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

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

511 {
512 int result = 0;
513 const Action<void(bool, char)> a1 = SaveArg<1>(&result);
514 a1.Perform(make_tuple(true, 'a'));
515 EXPECT_EQ('a', result);
516}
Here is the call graph for this function:

◆ TEST() [35/47]

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

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

504 {
505 int result = 0;
506 const Action<void(int n)> a1 = SaveArg<0>(&result);
507 a1.Perform(make_tuple(5));
508 EXPECT_EQ(5, result);
509}
Here is the call graph for this function:

◆ TEST() [36/47]

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

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

526 {
527 int result = 0;
528 char value = 'a';
529 const Action<void(bool, char*)> a1 = SaveArgPointee<1>(&result);
530 a1.Perform(make_tuple(true, &value));
531 EXPECT_EQ('a', result);
532}
#define value
Definition pkcs11.h:157
Here is the call graph for this function:

◆ TEST() [37/47]

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

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

534 {
535 int result = 0;
536 linked_ptr<int> value(new int(5));
537 const Action<void(linked_ptr<int>)> a1 = SaveArgPointee<0>(&result);
538 a1.Perform(make_tuple(value));
539 EXPECT_EQ(5, result);
540}
Here is the call graph for this function:

◆ TEST() [38/47]

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

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

518 {
519 int result = 0;
520 const int value = 5;
521 const Action<void(const int*)> a1 = SaveArgPointee<0>(&result);
522 a1.Perform(make_tuple(&value));
523 EXPECT_EQ(5, result);
524}
Here is the call graph for this function:

◆ TEST() [39/47]

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

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

549 {
550 int value = 0;
551 const Action<void(int, int&)> a1 = SetArgReferee<1>('a');
552 a1.Perform(tuple<int, int&>(0, value));
553 EXPECT_EQ('a', value);
554}
Here is the call graph for this function:

◆ TEST() [40/47]

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

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

542 {
543 int value = 0;
544 const Action<void(int&)> a1 = SetArgReferee<0>(1);
545 a1.Perform(tuple<int&>(value));
546 EXPECT_EQ(1, value);
547}
Here is the call graph for this function:

◆ TEST() [41/47]

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

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

556 {
557 int value = 0;
558 const Action<void(bool, int, int&, const char*)> a1 = SetArgReferee<2>('a');
559 a1.Perform(tuple<bool, int, int&, const char*>(true, 0, value, "hi"));
560 EXPECT_EQ('a', value);
561}
Here is the call graph for this function:

◆ TEST() [42/47]

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

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

623 {
624 typedef void MyFunction(bool, int*, char*);
625 int numbers[] = { 1, 2, 3 };
626 Action<MyFunction> a = SetArrayArgument<1>(numbers, numbers + 3);
627
628 int n[4] = {};
629 int* pn = n;
630 char ch[4] = {};
631 char* pch = ch;
632 a.Perform(make_tuple(true, pn, pch));
633 EXPECT_EQ(1, n[0]);
634 EXPECT_EQ(2, n[1]);
635 EXPECT_EQ(3, n[2]);
636 EXPECT_EQ(0, n[3]);
637 EXPECT_EQ('\0', ch[0]);
638 EXPECT_EQ('\0', ch[1]);
639 EXPECT_EQ('\0', ch[2]);
640 EXPECT_EQ('\0', ch[3]);
641
642 // Tests first and last are iterators.
643 std::string letters = "abc";
644 a = SetArrayArgument<2>(letters.begin(), letters.end());
645 std::fill_n(n, 4, 0);
646 std::fill_n(ch, 4, '\0');
647 a.Perform(make_tuple(true, pn, pch));
648 EXPECT_EQ(0, n[0]);
649 EXPECT_EQ(0, n[1]);
650 EXPECT_EQ(0, n[2]);
651 EXPECT_EQ(0, n[3]);
652 EXPECT_EQ('a', ch[0]);
653 EXPECT_EQ('b', ch[1]);
654 EXPECT_EQ('c', ch[2]);
655 EXPECT_EQ('\0', ch[3]);
656}
static const Reg8 ch(Operand::CH)

◆ TEST() [43/47]

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

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

675 {
676 typedef void MyFunction(bool, int*);
677 char chars[] = { 97, 98, 99 };
678 Action<MyFunction> a = SetArrayArgument<1>(chars, chars + 3);
679
680 int codes[4] = { 111, 222, 333, 444 };
681 int* pcodes = codes;
682 a.Perform(make_tuple(true, pcodes));
683 EXPECT_EQ(97, codes[0]);
684 EXPECT_EQ(98, codes[1]);
685 EXPECT_EQ(99, codes[2]);
686 EXPECT_EQ(444, codes[3]);
687}

◆ TEST() [44/47]

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

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

659 {
660 typedef void MyFunction(bool, int*);
661 int numbers[] = { 1, 2, 3 };
662 Action<MyFunction> a = SetArrayArgument<1>(numbers, numbers);
663
664 int n[4] = {};
665 int* pn = n;
666 a.Perform(make_tuple(true, pn));
667 EXPECT_EQ(0, n[0]);
668 EXPECT_EQ(0, n[1]);
669 EXPECT_EQ(0, n[2]);
670 EXPECT_EQ(0, n[3]);
671}

◆ TEST() [45/47]

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

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

690 {
691 typedef void MyFunction(bool, std::back_insert_iterator<std::string>);
692 std::string letters = "abc";
693 Action<MyFunction> a = SetArrayArgument<1>(letters.begin(), letters.end());
694
695 std::string s;
696 a.Perform(make_tuple(true, back_inserter(s)));
697 EXPECT_EQ(letters, s);
698}

◆ TEST() [46/47]

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

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

483 {
484 Action<bool(double x, int n)> b = WithArg<1>(Invoke(Unary)); // NOLINT
485 EXPECT_TRUE(b.Perform(make_tuple(1.5, -1)));
486 EXPECT_FALSE(b.Perform(make_tuple(1.5, 1)));
487}
Here is the call graph for this function:

◆ TEST() [47/47]

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

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

477 {
478 Action<int(int n)> a = WithoutArgs(Invoke(Nullary)); // NOLINT
479 EXPECT_EQ(1, a.Perform(make_tuple(2)));
480}
Here is the call graph for this function:

◆ Unary()

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

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

91{ return x < 0; }

◆ VoidBinary()

void testing::gmock_more_actions_test::VoidBinary ( int ,
char  )

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

110{ g_done = true; }

◆ VoidFunctionWithFourArguments()

void testing::gmock_more_actions_test::VoidFunctionWithFourArguments ( char ,
int ,
float ,
double  )

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

120{ g_done = true; }

◆ VoidNullary()

void testing::gmock_more_actions_test::VoidNullary ( )

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

84{ g_done = true; }

◆ VoidTernary()

void testing::gmock_more_actions_test::VoidTernary ( int ,
char ,
bool  )

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

114{ g_done = true; }

◆ VoidUnary()

void testing::gmock_more_actions_test::VoidUnary ( int )

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

95{ g_done = true; }

Variable Documentation

◆ g_done

bool testing::gmock_more_actions_test::g_done = false

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

◆ g_double

const double testing::gmock_more_actions_test::g_double = 0

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