Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: testing/gmock/test/gmock_output_test_.cc

Issue 521012: Update gmock and gtest. (Closed)
Patch Set: update readme Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2008, Google Inc. 1 // Copyright 2008, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 using testing::_; 42 using testing::_;
43 using testing::AnyNumber; 43 using testing::AnyNumber;
44 using testing::Ge; 44 using testing::Ge;
45 using testing::InSequence; 45 using testing::InSequence;
46 using testing::Ref; 46 using testing::Ref;
47 using testing::Return; 47 using testing::Return;
48 using testing::Sequence; 48 using testing::Sequence;
49 49
50 class MockFoo { 50 class MockFoo {
51 public: 51 public:
52 MockFoo() {}
53
52 MOCK_METHOD3(Bar, char(const std::string& s, int i, double x)); 54 MOCK_METHOD3(Bar, char(const std::string& s, int i, double x));
53 MOCK_METHOD2(Bar2, bool(int x, int y)); 55 MOCK_METHOD2(Bar2, bool(int x, int y));
54 MOCK_METHOD2(Bar3, void(int x, int y)); 56 MOCK_METHOD2(Bar3, void(int x, int y));
57
58 private:
59 GTEST_DISALLOW_COPY_AND_ASSIGN_(MockFoo);
55 }; 60 };
56 61
57 class GMockOutputTest : public testing::Test { 62 class GMockOutputTest : public testing::Test {
58 protected: 63 protected:
59 MockFoo foo_; 64 MockFoo foo_;
60 }; 65 };
61 66
62 TEST_F(GMockOutputTest, ExpectedCall) { 67 TEST_F(GMockOutputTest, ExpectedCall) {
63 testing::GMOCK_FLAG(verbose) = "info"; 68 testing::GMOCK_FLAG(verbose) = "info";
64 69
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 .InSequence(s2); 159 .InSequence(s2);
155 EXPECT_CALL(foo_, Bar2(1, _)) 160 EXPECT_CALL(foo_, Bar2(1, _))
156 .InSequence(s1, s2); 161 .InSequence(s1, s2);
157 162
158 foo_.Bar2(1, 0); // Has two immediate unsatisfied pre-requisites 163 foo_.Bar2(1, 0); // Has two immediate unsatisfied pre-requisites
159 foo_.Bar("Hi", 0, 0); 164 foo_.Bar("Hi", 0, 0);
160 foo_.Bar2(0, 0); 165 foo_.Bar2(0, 0);
161 foo_.Bar2(1, 0); 166 foo_.Bar2(1, 0);
162 } 167 }
163 168
169 TEST_F(GMockOutputTest, UnsatisfiedWith) {
170 EXPECT_CALL(foo_, Bar2(_, _)).With(Ge());
171 }
172
164 TEST_F(GMockOutputTest, UnsatisfiedExpectation) { 173 TEST_F(GMockOutputTest, UnsatisfiedExpectation) {
165 EXPECT_CALL(foo_, Bar(_, _, _)); 174 EXPECT_CALL(foo_, Bar(_, _, _));
166 EXPECT_CALL(foo_, Bar2(0, _)) 175 EXPECT_CALL(foo_, Bar2(0, _))
167 .Times(2); 176 .Times(2);
168 177
169 foo_.Bar2(0, 1); 178 foo_.Bar2(0, 1);
170 } 179 }
171 180
172 TEST_F(GMockOutputTest, MismatchArguments) { 181 TEST_F(GMockOutputTest, MismatchArguments) {
173 const std::string s = "Hi"; 182 const std::string s = "Hi";
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 testing::InitGoogleMock(&argc, argv); 281 testing::InitGoogleMock(&argc, argv);
273 282
274 // Ensures that the tests pass no matter what value of 283 // Ensures that the tests pass no matter what value of
275 // --gmock_catch_leaked_mocks and --gmock_verbose the user specifies. 284 // --gmock_catch_leaked_mocks and --gmock_verbose the user specifies.
276 testing::GMOCK_FLAG(catch_leaked_mocks) = true; 285 testing::GMOCK_FLAG(catch_leaked_mocks) = true;
277 testing::GMOCK_FLAG(verbose) = "warning"; 286 testing::GMOCK_FLAG(verbose) = "warning";
278 287
279 TestCatchesLeakedMocksInAdHocTests(); 288 TestCatchesLeakedMocksInAdHocTests();
280 return RUN_ALL_TESTS(); 289 return RUN_ALL_TESTS();
281 } 290 }
OLDNEW
« no previous file with comments | « testing/gmock/test/gmock_output_test.py ('k') | testing/gmock/test/gmock_output_test_golden.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698