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

Classes

class  FooInterface
 
class  FunctionMockerTest
 
class  MockB
 
class  MockFoo
 
struct  MockMethodSizes0
 
struct  MockMethodSizes1
 
struct  MockMethodSizes2
 
struct  MockMethodSizes3
 
struct  MockMethodSizes4
 
class  MockOverloadedOnArgNumber
 
class  MockOverloadedOnConstness
 
class  MockStack
 
class  StackInterface
 

Functions

 TEST_F (FunctionMockerTest, MocksVoidFunction)
 
 TEST_F (FunctionMockerTest, MocksNullaryFunction)
 
 TEST_F (FunctionMockerTest, MocksUnaryFunction)
 
 TEST_F (FunctionMockerTest, MocksBinaryFunction)
 
 TEST_F (FunctionMockerTest, MocksDecimalFunction)
 
 TEST_F (FunctionMockerTest, MocksFunctionWithNonConstReferenceArgument)
 
 TEST_F (FunctionMockerTest, MocksFunctionWithConstReferenceArgument)
 
 TEST_F (FunctionMockerTest, MocksFunctionWithConstArgument)
 
 TEST_F (FunctionMockerTest, MocksFunctionsOverloadedOnArgumentNumber)
 
 TEST_F (FunctionMockerTest, MocksFunctionsOverloadedOnArgumentType)
 
 TEST_F (FunctionMockerTest, MocksFunctionsOverloadedOnConstnessOfThis)
 
 TEST_F (FunctionMockerTest, MocksReturnTypeWithComma)
 
 TEST (ExpectCallTest, UnmentionedFunctionCanBeCalledAnyNumberOfTimes)
 
 TEST (TemplateMockTest, Works)
 
 TEST (TemplateMockTest, MethodWithCommaInReturnTypeWorks)
 
 TEST (OverloadedMockMethodTest, CanOverloadOnArgNumberInMacroBody)
 
 TEST (OverloadedMockMethodTest, CanOverloadOnConstnessInMacroBody)
 
 TEST (MockFunctionTest, WorksForVoidNullary)
 
 TEST (MockFunctionTest, WorksForNonVoidNullary)
 
 TEST (MockFunctionTest, WorksForVoidUnary)
 
 TEST (MockFunctionTest, WorksForNonVoidBinary)
 
 TEST (MockFunctionTest, WorksFor10Arguments)
 
 TEST (MockFunctionTest, MockMethodSizeOverhead)
 

Function Documentation

◆ TEST() [1/11]

testing::gmock_generated_function_mockers_test::TEST ( ExpectCallTest ,
UnmentionedFunctionCanBeCalledAnyNumberOfTimes  )

Definition at line 367 of file gmock-generated-function-mockers_test.cc.

367 {
368 {
369 MockB b;
370 }
371
372 {
373 MockB b;
374 b.DoB();
375 }
376
377 {
378 MockB b;
379 b.DoB();
380 b.DoB();
381 }
382}

◆ TEST() [2/11]

◆ TEST() [3/11]

testing::gmock_generated_function_mockers_test::TEST ( MockFunctionTest ,
WorksFor10Arguments  )

Definition at line 590 of file gmock-generated-function-mockers_test.cc.

590 {
591 MockFunction<int(bool a0, char a1, int a2, int a3, int a4,
592 int a5, int a6, char a7, int a8, bool a9)> foo;
593 EXPECT_CALL(foo, Call(_, 'a', _, _, _, _, _, _, _, _))
594 .WillOnce(Return(1))
595 .WillOnce(Return(2));
596 EXPECT_EQ(1, foo.Call(false, 'a', 0, 0, 0, 0, 0, 'b', 0, true));
597 EXPECT_EQ(2, foo.Call(true, 'a', 0, 0, 0, 0, 0, 'b', 1, false));
598}
#define EXPECT_CALL(obj, call)
Here is the call graph for this function:

◆ TEST() [4/11]

testing::gmock_generated_function_mockers_test::TEST ( MockFunctionTest ,
WorksForNonVoidBinary  )

Definition at line 578 of file gmock-generated-function-mockers_test.cc.

578 {
579 MockFunction<int(bool, int)> foo;
580 EXPECT_CALL(foo, Call(false, 42))
581 .WillOnce(Return(1))
582 .WillOnce(Return(2));
583 EXPECT_CALL(foo, Call(true, Ge(100)))
584 .WillOnce(Return(3));
585 EXPECT_EQ(1, foo.Call(false, 42));
586 EXPECT_EQ(2, foo.Call(false, 42));
587 EXPECT_EQ(3, foo.Call(true, 120));
588}
Here is the call graph for this function:

◆ TEST() [5/11]

testing::gmock_generated_function_mockers_test::TEST ( MockFunctionTest ,
WorksForNonVoidNullary  )

Definition at line 563 of file gmock-generated-function-mockers_test.cc.

563 {
564 MockFunction<int()> foo;
566 .WillOnce(Return(1))
567 .WillOnce(Return(2));
568 EXPECT_EQ(1, foo.Call());
569 EXPECT_EQ(2, foo.Call());
570}
Here is the call graph for this function:

◆ TEST() [6/11]

testing::gmock_generated_function_mockers_test::TEST ( MockFunctionTest ,
WorksForVoidNullary  )

Definition at line 557 of file gmock-generated-function-mockers_test.cc.

557 {
558 MockFunction<void()> foo;
559 EXPECT_CALL(foo, Call());
560 foo.Call();
561}

◆ TEST() [7/11]

testing::gmock_generated_function_mockers_test::TEST ( MockFunctionTest ,
WorksForVoidUnary  )

Definition at line 572 of file gmock-generated-function-mockers_test.cc.

572 {
573 MockFunction<void(int)> foo;
574 EXPECT_CALL(foo, Call(1));
575 foo.Call(1);
576}

◆ TEST() [8/11]

testing::gmock_generated_function_mockers_test::TEST ( OverloadedMockMethodTest ,
CanOverloadOnArgNumberInMacroBody  )

Definition at line 522 of file gmock-generated-function-mockers_test.cc.

522 {
524 EXPECT_CALL(mock, Overloaded());
525 EXPECT_CALL(mock, Overloaded(1)).WillOnce(Return(2));
526 EXPECT_CALL(mock, Overloaded(true, 1)).WillOnce(Return(true));
527
528 mock.Overloaded();
529 EXPECT_EQ(2, mock.Overloaded(1));
530 EXPECT_TRUE(mock.Overloaded(true, 1));
531}
#define EXPECT_TRUE(condition)
Definition gtest.h:1895
Here is the call graph for this function:

◆ TEST() [9/11]

testing::gmock_generated_function_mockers_test::TEST ( OverloadedMockMethodTest ,
CanOverloadOnConstnessInMacroBody  )

Definition at line 547 of file gmock-generated-function-mockers_test.cc.

547 {
549 const MockOverloadedOnConstness* const_mock = &mock;
550 EXPECT_CALL(mock, Overloaded(1)).WillOnce(Return(2));
551 EXPECT_CALL(*const_mock, Overloaded(1)).WillOnce(Return(3));
552
553 EXPECT_EQ(2, mock.Overloaded(1));
554 EXPECT_EQ(3, const_mock->Overloaded(1));
555}
Here is the call graph for this function:

◆ TEST() [10/11]

testing::gmock_generated_function_mockers_test::TEST ( TemplateMockTest ,
MethodWithCommaInReturnTypeWorks  )

Definition at line 440 of file gmock-generated-function-mockers_test.cc.

440 {
441 MockStack<int> mock;
442
443 const std::map<int, int> a_map;
444 EXPECT_CALL(mock, ReturnTypeWithComma())
445 .WillOnce(Return(a_map));
446 EXPECT_CALL(mock, ReturnTypeWithComma(1))
447 .WillOnce(Return(a_map));
448
449 EXPECT_EQ(a_map, mock.ReturnTypeWithComma());
450 EXPECT_EQ(a_map, mock.ReturnTypeWithComma(1));
451}
Here is the call graph for this function:

◆ TEST() [11/11]

testing::gmock_generated_function_mockers_test::TEST ( TemplateMockTest ,
Works  )

Definition at line 418 of file gmock-generated-function-mockers_test.cc.

418 {
419 MockStack<int> mock;
420
421 EXPECT_CALL(mock, GetSize())
422 .WillOnce(Return(0))
423 .WillOnce(Return(1))
424 .WillOnce(Return(0));
425 EXPECT_CALL(mock, Push(_));
426 int n = 5;
427 EXPECT_CALL(mock, GetTop())
428 .WillOnce(ReturnRef(n));
429 EXPECT_CALL(mock, Pop())
430 .Times(AnyNumber());
431
432 EXPECT_EQ(0, mock.GetSize());
433 mock.Push(5);
434 EXPECT_EQ(1, mock.GetSize());
435 EXPECT_EQ(5, mock.GetTop());
436 mock.Pop();
437 EXPECT_EQ(0, mock.GetSize());
438}
Here is the call graph for this function:

◆ TEST_F() [1/12]

testing::gmock_generated_function_mockers_test::TEST_F ( FunctionMockerTest ,
MocksBinaryFunction  )

Definition at line 219 of file gmock-generated-function-mockers_test.cc.

219 {
220 EXPECT_CALL(mock_foo_, Binary(2, _))
221 .WillOnce(Return(3));
222
223 EXPECT_EQ(3, foo_->Binary(2, 1));
224}
Here is the call graph for this function:

◆ TEST_F() [2/12]

testing::gmock_generated_function_mockers_test::TEST_F ( FunctionMockerTest ,
MocksDecimalFunction  )

Definition at line 227 of file gmock-generated-function-mockers_test.cc.

227 {
228 EXPECT_CALL(mock_foo_, Decimal(true, 'a', 0, 0, 1L, A<float>(),
229 Lt(100), 5U, NULL, "hi"))
230 .WillOnce(Return(5));
231
232 EXPECT_EQ(5, foo_->Decimal(true, 'a', 0, 0, 1, 0, 0, 5, NULL, "hi"));
233}
Here is the call graph for this function:

◆ TEST_F() [3/12]

testing::gmock_generated_function_mockers_test::TEST_F ( FunctionMockerTest ,
MocksFunctionsOverloadedOnArgumentNumber  )

Definition at line 264 of file gmock-generated-function-mockers_test.cc.

264 {
265 EXPECT_CALL(mock_foo_, OverloadedOnArgumentNumber())
266 .WillOnce(Return(1));
267 EXPECT_CALL(mock_foo_, OverloadedOnArgumentNumber(_))
268 .WillOnce(Return(2));
269
270 EXPECT_EQ(2, foo_->OverloadedOnArgumentNumber(1));
271 EXPECT_EQ(1, foo_->OverloadedOnArgumentNumber());
272}
Here is the call graph for this function:

◆ TEST_F() [4/12]

testing::gmock_generated_function_mockers_test::TEST_F ( FunctionMockerTest ,
MocksFunctionsOverloadedOnArgumentType  )

Definition at line 275 of file gmock-generated-function-mockers_test.cc.

275 {
276 EXPECT_CALL(mock_foo_, OverloadedOnArgumentType(An<int>()))
277 .WillOnce(Return(1));
278 EXPECT_CALL(mock_foo_, OverloadedOnArgumentType(TypedEq<char>('a')))
279 .WillOnce(Return('b'));
280
281 EXPECT_EQ(1, foo_->OverloadedOnArgumentType(0));
282 EXPECT_EQ('b', foo_->OverloadedOnArgumentType('a'));
283}
Here is the call graph for this function:

◆ TEST_F() [5/12]

testing::gmock_generated_function_mockers_test::TEST_F ( FunctionMockerTest ,
MocksFunctionsOverloadedOnConstnessOfThis  )

Definition at line 286 of file gmock-generated-function-mockers_test.cc.

286 {
287 EXPECT_CALL(mock_foo_, OverloadedOnConstness());
288 EXPECT_CALL(Const(mock_foo_), OverloadedOnConstness())
289 .WillOnce(Return('a'));
290
291 EXPECT_EQ(0, foo_->OverloadedOnConstness());
292 EXPECT_EQ('a', Const(*foo_).OverloadedOnConstness());
293}
Here is the call graph for this function:

◆ TEST_F() [6/12]

testing::gmock_generated_function_mockers_test::TEST_F ( FunctionMockerTest ,
MocksFunctionWithConstArgument  )

Definition at line 255 of file gmock-generated-function-mockers_test.cc.

255 {
256 EXPECT_CALL(mock_foo_, TakesConst(Lt(10)))
257 .WillOnce(DoDefault());
258
259 EXPECT_FALSE(foo_->TakesConst(5));
260}
#define EXPECT_FALSE(condition)
Definition gtest.h:1898
Here is the call graph for this function:

◆ TEST_F() [7/12]

testing::gmock_generated_function_mockers_test::TEST_F ( FunctionMockerTest ,
MocksFunctionWithConstReferenceArgument  )

Definition at line 245 of file gmock-generated-function-mockers_test.cc.

245 {
246 int a = 0;
247 EXPECT_CALL(mock_foo_, TakesConstReference(Ref(a)))
248 .WillOnce(Return("Hello"));
249
250 EXPECT_EQ("Hello", foo_->TakesConstReference(a));
251}
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
Here is the call graph for this function:

◆ TEST_F() [8/12]

testing::gmock_generated_function_mockers_test::TEST_F ( FunctionMockerTest ,
MocksFunctionWithNonConstReferenceArgument  )

Definition at line 236 of file gmock-generated-function-mockers_test.cc.

236 {
237 int a = 0;
238 EXPECT_CALL(mock_foo_, TakesNonConstReference(Ref(a)))
239 .WillOnce(Return(true));
240
241 EXPECT_TRUE(foo_->TakesNonConstReference(a));
242}
Here is the call graph for this function:

◆ TEST_F() [9/12]

testing::gmock_generated_function_mockers_test::TEST_F ( FunctionMockerTest ,
MocksNullaryFunction  )

Definition at line 199 of file gmock-generated-function-mockers_test.cc.

199 {
200 EXPECT_CALL(mock_foo_, Nullary())
201 .WillOnce(DoDefault())
202 .WillOnce(Return(1));
203
204 EXPECT_EQ(0, foo_->Nullary());
205 EXPECT_EQ(1, foo_->Nullary());
206}
Here is the call graph for this function:

◆ TEST_F() [10/12]

testing::gmock_generated_function_mockers_test::TEST_F ( FunctionMockerTest ,
MocksReturnTypeWithComma  )

Definition at line 295 of file gmock-generated-function-mockers_test.cc.

295 {
296 const std::map<int, std::string> a_map;
297 EXPECT_CALL(mock_foo_, ReturnTypeWithComma())
298 .WillOnce(Return(a_map));
299 EXPECT_CALL(mock_foo_, ReturnTypeWithComma(42))
300 .WillOnce(Return(a_map));
301
302 EXPECT_EQ(a_map, mock_foo_.ReturnTypeWithComma());
303 EXPECT_EQ(a_map, mock_foo_.ReturnTypeWithComma(42));
304}
Here is the call graph for this function:

◆ TEST_F() [11/12]

testing::gmock_generated_function_mockers_test::TEST_F ( FunctionMockerTest ,
MocksUnaryFunction  )

Definition at line 209 of file gmock-generated-function-mockers_test.cc.

209 {
210 EXPECT_CALL(mock_foo_, Unary(Eq(2)))
211 .Times(2)
212 .WillOnce(Return(true));
213
214 EXPECT_TRUE(foo_->Unary(2));
215 EXPECT_FALSE(foo_->Unary(2));
216}
Here is the call graph for this function:

◆ TEST_F() [12/12]

testing::gmock_generated_function_mockers_test::TEST_F ( FunctionMockerTest ,
MocksVoidFunction  )

Definition at line 193 of file gmock-generated-function-mockers_test.cc.

193 {
194 EXPECT_CALL(mock_foo_, VoidReturning(Lt(100)));
195 foo_->VoidReturning(0);
196}
Here is the call graph for this function: