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

Classes

class  Foo
 
class  MockBar
 
class  MockFoo
 
class  NotDefaultConstructible
 

Functions

 TEST (NiceMockTest, AllowsExpectedCall)
 
 TEST (NiceMockTest, ThrowsExceptionForUnknownReturnTypes)
 
 TEST (NiceMockTest, UnexpectedCallFails)
 
 TEST (NiceMockTest, NonDefaultConstructor)
 
 TEST (NiceMockTest, NonDefaultConstructor10)
 
 TEST (NiceMockTest, AllowLeak)
 
 TEST (NiceMockTest, AcceptsClassNamedMock)
 
 TEST (NaggyMockTest, AllowsExpectedCall)
 
 TEST (NaggyMockTest, UnexpectedCallFails)
 
 TEST (NaggyMockTest, NonDefaultConstructor)
 
 TEST (NaggyMockTest, NonDefaultConstructor10)
 
 TEST (NaggyMockTest, AllowLeak)
 
 TEST (NaggyMockTest, AcceptsClassNamedMock)
 
 TEST (StrictMockTest, AllowsExpectedCall)
 
 TEST (StrictMockTest, UnexpectedCallFails)
 
 TEST (StrictMockTest, UninterestingCallFails)
 
 TEST (StrictMockTest, UninterestingCallFailsAfterDeath)
 
 TEST (StrictMockTest, NonDefaultConstructor)
 
 TEST (StrictMockTest, NonDefaultConstructor10)
 
 TEST (StrictMockTest, AllowLeak)
 
 TEST (StrictMockTest, AcceptsClassNamedMock)
 

Function Documentation

◆ TEST() [1/21]

testing::gmock_nice_strict_test::TEST ( NaggyMockTest ,
AcceptsClassNamedMock  )

Definition at line 414 of file gmock-nice-strict_test.cc.

414 {
415 NaggyMock< ::Mock> naggy;
416 EXPECT_CALL(naggy, DoThis());
417 naggy.DoThis();
418}
#define EXPECT_CALL(obj, call)

◆ TEST() [2/21]

testing::gmock_nice_strict_test::TEST ( NaggyMockTest ,
AllowLeak  )

Definition at line 390 of file gmock-nice-strict_test.cc.

390 {
392 Mock::AllowLeak(leaked);
393 EXPECT_CALL(*leaked, DoThis());
394 leaked->DoThis();
395}

◆ TEST() [3/21]

testing::gmock_nice_strict_test::TEST ( NaggyMockTest ,
AllowsExpectedCall  )

Definition at line 353 of file gmock-nice-strict_test.cc.

353 {
354 NaggyMock<MockFoo> naggy_foo;
355
356 EXPECT_CALL(naggy_foo, DoThis());
357 naggy_foo.DoThis();
358}

◆ TEST() [4/21]

testing::gmock_nice_strict_test::TEST ( NaggyMockTest ,
NonDefaultConstructor  )

Definition at line 371 of file gmock-nice-strict_test.cc.

371 {
372 NaggyMock<MockBar> naggy_bar("hi");
373 EXPECT_EQ("hi", naggy_bar.str());
374
375 naggy_bar.This();
376 naggy_bar.That(5, true);
377}
#define EXPECT_EQ(val1, val2)
Definition gtest.h:1954

◆ TEST() [5/21]

testing::gmock_nice_strict_test::TEST ( NaggyMockTest ,
NonDefaultConstructor10  )

Definition at line 381 of file gmock-nice-strict_test.cc.

381 {
382 NaggyMock<MockBar> naggy_bar('0', '1', "2", "3", '4', '5',
383 "6", "7", true, false);
384 EXPECT_EQ("01234567TF", naggy_bar.str());
385
386 naggy_bar.This();
387 naggy_bar.That(5, true);
388}

◆ TEST() [6/21]

testing::gmock_nice_strict_test::TEST ( NaggyMockTest ,
UnexpectedCallFails  )

Definition at line 361 of file gmock-nice-strict_test.cc.

361 {
362 NaggyMock<MockFoo> naggy_foo;
363
364 EXPECT_CALL(naggy_foo, DoThis()).Times(0);
365 EXPECT_NONFATAL_FAILURE(naggy_foo.DoThis(),
366 "called more times than expected");
367}
#define EXPECT_NONFATAL_FAILURE(statement, substr)
Definition gtest-spi.h:203

◆ TEST() [7/21]

testing::gmock_nice_strict_test::TEST ( NiceMockTest ,
AcceptsClassNamedMock  )

Definition at line 306 of file gmock-nice-strict_test.cc.

306 {
308 EXPECT_CALL(nice, DoThis());
309 nice.DoThis();
310}

◆ TEST() [8/21]

testing::gmock_nice_strict_test::TEST ( NiceMockTest ,
AllowLeak  )

Definition at line 282 of file gmock-nice-strict_test.cc.

282 {
284 Mock::AllowLeak(leaked);
285 EXPECT_CALL(*leaked, DoThis());
286 leaked->DoThis();
287}

◆ TEST() [9/21]

testing::gmock_nice_strict_test::TEST ( NiceMockTest ,
AllowsExpectedCall  )

Definition at line 229 of file gmock-nice-strict_test.cc.

229 {
230 NiceMock<MockFoo> nice_foo;
231
232 EXPECT_CALL(nice_foo, DoThis());
233 nice_foo.DoThis();
234}

◆ TEST() [10/21]

testing::gmock_nice_strict_test::TEST ( NiceMockTest ,
NonDefaultConstructor  )

Definition at line 263 of file gmock-nice-strict_test.cc.

263 {
264 NiceMock<MockBar> nice_bar("hi");
265 EXPECT_EQ("hi", nice_bar.str());
266
267 nice_bar.This();
268 nice_bar.That(5, true);
269}

◆ TEST() [11/21]

testing::gmock_nice_strict_test::TEST ( NiceMockTest ,
NonDefaultConstructor10  )

Definition at line 273 of file gmock-nice-strict_test.cc.

273 {
274 NiceMock<MockBar> nice_bar('a', 'b', "c", "d", 'e', 'f',
275 "g", "h", true, false);
276 EXPECT_EQ("abcdefghTF", nice_bar.str());
277
278 nice_bar.This();
279 nice_bar.That(5, true);
280}

◆ TEST() [12/21]

testing::gmock_nice_strict_test::TEST ( NiceMockTest ,
ThrowsExceptionForUnknownReturnTypes  )

Definition at line 239 of file gmock-nice-strict_test.cc.

239 {
240 NiceMock<MockFoo> nice_foo;
241#if GTEST_HAS_EXCEPTIONS
242 try {
243 nice_foo.ReturnNonDefaultConstructible();
244 FAIL();
245 } catch (const std::runtime_error& ex) {
246 EXPECT_THAT(ex.what(), HasSubstr("ReturnNonDefaultConstructible"));
247 }
248#else
249 EXPECT_DEATH_IF_SUPPORTED({ nice_foo.ReturnNonDefaultConstructible(); }, "");
250#endif
251}
#define EXPECT_THAT(value, matcher)
#define EXPECT_DEATH_IF_SUPPORTED(statement, regex)
#define FAIL()
Definition gtest.h:1858

◆ TEST() [13/21]

testing::gmock_nice_strict_test::TEST ( NiceMockTest ,
UnexpectedCallFails  )

Definition at line 254 of file gmock-nice-strict_test.cc.

254 {
255 NiceMock<MockFoo> nice_foo;
256
257 EXPECT_CALL(nice_foo, DoThis()).Times(0);
258 EXPECT_NONFATAL_FAILURE(nice_foo.DoThis(), "called more times than expected");
259}

◆ TEST() [14/21]

testing::gmock_nice_strict_test::TEST ( StrictMockTest ,
AcceptsClassNamedMock  )

Definition at line 503 of file gmock-nice-strict_test.cc.

503 {
504 StrictMock< ::Mock> strict;
505 EXPECT_CALL(strict, DoThis());
506 strict.DoThis();
507}

◆ TEST() [15/21]

testing::gmock_nice_strict_test::TEST ( StrictMockTest ,
AllowLeak  )

Definition at line 479 of file gmock-nice-strict_test.cc.

479 {
481 Mock::AllowLeak(leaked);
482 EXPECT_CALL(*leaked, DoThis());
483 leaked->DoThis();
484}

◆ TEST() [16/21]

testing::gmock_nice_strict_test::TEST ( StrictMockTest ,
AllowsExpectedCall  )

Definition at line 422 of file gmock-nice-strict_test.cc.

422 {
423 StrictMock<MockFoo> strict_foo;
424
425 EXPECT_CALL(strict_foo, DoThis());
426 strict_foo.DoThis();
427}

◆ TEST() [17/21]

testing::gmock_nice_strict_test::TEST ( StrictMockTest ,
NonDefaultConstructor  )

Definition at line 460 of file gmock-nice-strict_test.cc.

460 {
461 StrictMock<MockBar> strict_bar("hi");
462 EXPECT_EQ("hi", strict_bar.str());
463
464 EXPECT_NONFATAL_FAILURE(strict_bar.That(5, true),
465 "Uninteresting mock function call");
466}

◆ TEST() [18/21]

testing::gmock_nice_strict_test::TEST ( StrictMockTest ,
NonDefaultConstructor10  )

Definition at line 470 of file gmock-nice-strict_test.cc.

470 {
471 StrictMock<MockBar> strict_bar('a', 'b', "c", "d", 'e', 'f',
472 "g", "h", true, false);
473 EXPECT_EQ("abcdefghTF", strict_bar.str());
474
475 EXPECT_NONFATAL_FAILURE(strict_bar.That(5, true),
476 "Uninteresting mock function call");
477}

◆ TEST() [19/21]

testing::gmock_nice_strict_test::TEST ( StrictMockTest ,
UnexpectedCallFails  )

Definition at line 430 of file gmock-nice-strict_test.cc.

430 {
431 StrictMock<MockFoo> strict_foo;
432
433 EXPECT_CALL(strict_foo, DoThis()).Times(0);
434 EXPECT_NONFATAL_FAILURE(strict_foo.DoThis(),
435 "called more times than expected");
436}

◆ TEST() [20/21]

testing::gmock_nice_strict_test::TEST ( StrictMockTest ,
UninterestingCallFails  )

Definition at line 439 of file gmock-nice-strict_test.cc.

439 {
440 StrictMock<MockFoo> strict_foo;
441
442 EXPECT_NONFATAL_FAILURE(strict_foo.DoThis(),
443 "Uninteresting mock function call");
444}

◆ TEST() [21/21]

testing::gmock_nice_strict_test::TEST ( StrictMockTest ,
UninterestingCallFailsAfterDeath  )

Definition at line 448 of file gmock-nice-strict_test.cc.

448 {
449 StrictMock<MockFoo>* const strict_foo = new StrictMock<MockFoo>;
450
451 ON_CALL(*strict_foo, DoThis())
452 .WillByDefault(Invoke(strict_foo, &MockFoo::Delete));
453
454 EXPECT_NONFATAL_FAILURE(strict_foo->DoThis(),
455 "Uninteresting mock function call");
456}
#define ON_CALL(obj, call)
Here is the call graph for this function: