52 namespace gmock_nice_strict_test {
61 #if GTEST_HAS_STREAM_REDIRECTION
73 virtual int DoThat(
bool flag) = 0;
92 MockBar(
char a1,
char a2,
string a3,
string a4,
int a5,
int a6,
93 const string& a7,
const string& a8,
bool a9,
bool a10) {
94 str_ =
string() + a1 + a2 + a3 + a4 +
static_cast<char>(a5) +
95 static_cast<char>(a6) + a7 + a8 + (a9 ?
'T' :
'F') + (a10 ?
'T' :
'F');
111 #if GTEST_HAS_STREAM_REDIRECTION
114 TEST(RawMockTest, WarningForUninterestingCall) {
124 HasSubstr(
"Uninteresting mock function call"));
131 TEST(RawMockTest, WarningForUninterestingCallAfterDeath) {
135 MockFoo*
const raw_foo =
new MockFoo;
143 HasSubstr(
"Uninteresting mock function call"));
150 TEST(RawMockTest, InfoForUninterestingCall) {
158 HasSubstr(
"Uninteresting mock function call"));
164 TEST(NiceMockTest, NoWarningForUninterestingCall) {
165 NiceMock<MockFoo> nice_foo;
169 nice_foo.DoThat(
true);
175 TEST(NiceMockTest, NoWarningForUninterestingCallAfterDeath) {
176 NiceMock<MockFoo>*
const nice_foo =
new NiceMock<MockFoo>;
188 TEST(NiceMockTest, InfoForUninterestingCall) {
189 NiceMock<MockFoo> nice_foo;
196 HasSubstr(
"Uninteresting mock function call"));
201 #endif // GTEST_HAS_STREAM_REDIRECTION
204 TEST(NiceMockTest, AllowsExpectedCall) {
212 TEST(NiceMockTest, UnexpectedCallFails) {
221 TEST(NiceMockTest, NonDefaultConstructor) {
226 nice_bar.That(5,
true);
231 TEST(NiceMockTest, NonDefaultConstructor10) {
233 "g",
"h",
true,
false);
237 nice_bar.That(5,
true);
240 #if !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE
249 TEST(NiceMockTest, AcceptsClassNamedMock) {
254 #endif // !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE
256 #if GTEST_HAS_STREAM_REDIRECTION
259 TEST(NaggyMockTest, WarningForUninterestingCall) {
267 naggy_foo.DoThat(
true);
269 HasSubstr(
"Uninteresting mock function call"));
276 TEST(NaggyMockTest, WarningForUninterestingCallAfterDeath) {
280 NaggyMock<MockFoo>*
const naggy_foo =
new NaggyMock<MockFoo>;
288 HasSubstr(
"Uninteresting mock function call"));
293 #endif // GTEST_HAS_STREAM_REDIRECTION
296 TEST(NaggyMockTest, AllowsExpectedCall) {
304 TEST(NaggyMockTest, UnexpectedCallFails) {
309 "called more times than expected");
314 TEST(NaggyMockTest, NonDefaultConstructor) {
319 naggy_bar.That(5,
true);
324 TEST(NaggyMockTest, NonDefaultConstructor10) {
326 "6",
"7",
true,
false);
327 EXPECT_EQ(
"01234567TF", naggy_bar.str());
330 naggy_bar.That(5,
true);
333 #if !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE
342 TEST(NaggyMockTest, AcceptsClassNamedMock) {
347 #endif // !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE
350 TEST(StrictMockTest, AllowsExpectedCall) {
358 TEST(StrictMockTest, UnexpectedCallFails) {
363 "called more times than expected");
367 TEST(StrictMockTest, UninterestingCallFails) {
371 "Uninteresting mock function call");
376 TEST(StrictMockTest, UninterestingCallFailsAfterDeath) {
383 "Uninteresting mock function call");
388 TEST(StrictMockTest, NonDefaultConstructor) {
393 "Uninteresting mock function call");
398 TEST(StrictMockTest, NonDefaultConstructor10) {
400 "g",
"h",
true,
false);
401 EXPECT_EQ(
"abcdefghTF", strict_bar.str());
404 "Uninteresting mock function call");
407 #if !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE
416 TEST(StrictMockTest, AcceptsClassNamedMock) {
421 #endif // !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE