From b7f889fb8580d698025ed72417ad2f83e0a3e73e Mon Sep 17 00:00:00 2001 From: "zhanyong.wan" Date: Sat, 12 Sep 2009 06:46:26 +0000 Subject: Removes dead code in gmock-more-actions_test.cc. git-svn-id: http://googlemock.googlecode.com/svn/trunk@199 8415998a-534a-0410-bf83-d39667b30386 --- test/gmock-more-actions_test.cc | 132 ---------------------------------------- 1 file changed, 132 deletions(-) diff --git a/test/gmock-more-actions_test.cc b/test/gmock-more-actions_test.cc index 9507776..f5dab5b 100644 --- a/test/gmock-more-actions_test.cc +++ b/test/gmock-more-actions_test.cc @@ -350,25 +350,6 @@ TEST(InvokeTest, FunctionWithCompatibleType) { EXPECT_EQ(4321, a.Perform(make_tuple(4000, 300, 20, true))); } -#if GMOCK_HAS_GOOGLE3_CALLBACK_ - -// Tests IgnoreResult(Invoke(result_callback)). -TEST(InvokeTest, IgnoreResultOfResultCallback) { - ResultCallback* c = NewPermanentCallback(Nullary); - Action a = IgnoreResult(Invoke(c)); - a.Perform(make_tuple()); -} - -// Tests IgnoreResult(Invoke(result_callback4)). -TEST(InvokeTest, IgnoreResultOfResultCallback4) { - ResultCallback4* c = - NewPermanentCallback(SumOf4); - Action a = IgnoreResult(Invoke(c)); - a.Perform(make_tuple(1, 2, 3, 4)); -} - -#endif // GMOCK_HAS_GOOGLE3_CALLBACK_ - // Tests using Invoke() with an object pointer and a method pointer. // Tests using Invoke() with a nullary method. @@ -479,119 +460,6 @@ TEST(InvokeMethodTest, MethodWithCompatibleType) { EXPECT_EQ(4444, a.Perform(make_tuple(4000, 300, 20, true))); } -#if GMOCK_HAS_GOOGLE3_CALLBACK_ - -// We don't have dedicated tests to verify that Invoke(callback) and -// InvokeWithoutArgs(callback) delete the callback argument. Instead, -// we rely on the heap checker linked in this test program to do that. - -// Tests that Invoke(non-permanent-callback) kills the process. -TEST(InvokeCallbackDeathTest, RejectsNonPermanentCallback) { - EXPECT_DEATH({ - Action a = Invoke(NewCallback(Nullary)); // NOLINT - }, ""); -} - -// Tests using Invoke() with a nullary callback. -TEST(InvokeCallbackTest, Nullary) { - // Tests using Invoke(callback) as an action of the exact type. - Action a = Invoke(NewPermanentCallback(Nullary)); // NOLINT - EXPECT_EQ(1, a.Perform(make_tuple())); - - // Tests using Invoke(callback) as an action of a compatible type. - Action a2 = Invoke(NewPermanentCallback(Nullary)); // NOLINT - EXPECT_TRUE(a2.Perform(make_tuple())); - - // Tests using Invoke() on a callback that returns void. - Action a3 = Invoke(NewPermanentCallback(VoidNullary)); // NOLINT - g_done = false; - a3.Perform(make_tuple()); - EXPECT_TRUE(g_done); -} - -// Tests using Invoke() with a unary callback. -TEST(InvokeCallbackTest, Unary) { - // Tests using Invoke(callback1) as an action of the exact type. - Action a = Invoke(NewPermanentCallback(Unary)); // NOLINT - EXPECT_FALSE(a.Perform(make_tuple(1))); - EXPECT_TRUE(a.Perform(make_tuple(-1))); - - // Tests using Invoke(callback1) as an action of a compatible type. - Action a2 = Invoke(NewPermanentCallback(Unary)); // NOLINT - EXPECT_EQ(0, a2.Perform(make_tuple(1L))); - EXPECT_EQ(1, a2.Perform(make_tuple(-1L))); - - // Tests using Invoke() on a callback that returns void. - Action a3 = Invoke(NewPermanentCallback(VoidUnary)); // NOLINT - g_done = false; - a3.Perform(make_tuple('a')); - EXPECT_TRUE(g_done); -} - -// Tests using Invoke() with a binary callback. -TEST(InvokeCallbackTest, Binary) { - // Tests using Invoke(callback2) as an action of the exact type. - Action a = // NOLINT - Invoke(NewPermanentCallback(Binary)); - const char* p = "Hello"; - EXPECT_EQ(p + 2, a.Perform(make_tuple(p, 2))); - - // Tests using Invoke(callback2) as an action of a compatible type. - Action a2 = // NOLINT - Invoke(NewPermanentCallback(Binary)); - char str[] = "Hello"; - EXPECT_TRUE(a2.Perform(make_tuple(str, 2))); - - // Tests using Invoke() on a callback that returns void. - Action a3 = - Invoke(NewPermanentCallback(VoidBinary)); // NOLINT - g_done = false; - a3.Perform(make_tuple('a', 'b')); - EXPECT_TRUE(g_done); -} - -// Tests using Invoke() with a ternary callback. -TEST(InvokeCallbackTest, Ternary) { - // Tests using Invoke(callback3) as an action of the exact type. - Action a = // NOLINT - Invoke(NewPermanentCallback(Ternary)); - EXPECT_EQ(6, a.Perform(make_tuple(1, '\2', 3))); - - // Tests using Invoke(callback3) as an action of a compatible type. - Action a2 = // NOLINT - Invoke(NewPermanentCallback(Ternary)); - EXPECT_EQ(6, a2.Perform(make_tuple('\1', 2, 3))); - - // Tests using Invoke() on a callback that returns void. - Action a3 = - Invoke(NewPermanentCallback(VoidTernary)); // NOLINT - g_done = false; - a3.Perform(make_tuple('a', 'b', true)); - EXPECT_TRUE(g_done); -} - -// Tests using Invoke() with a 4-argument callback. -TEST(InvokeCallbackTest, CallbackThatTakes4Arguments) { - // Tests using Invoke(callback4) as an action of the exact type. - Action a = // NOLINT - Invoke(NewPermanentCallback(SumOf4)); - EXPECT_EQ(1234, a.Perform(make_tuple(1000, 200, 30, 4))); - - // Tests using Invoke(callback4) as an action of a compatible type. - Action a2 = // NOLINT - Invoke(NewPermanentCallback(SumOf4)); - EXPECT_EQ(4321, a2.Perform(make_tuple(4000, 300, 20, true))); - - // Tests using Invoke() on a callback that returns void. - Action a3 = - Invoke(NewPermanentCallback(VoidFunctionWithFourArguments)); // NOLINT - g_done = false; - a3.Perform(make_tuple('a', 'b', 0, 1)); - EXPECT_TRUE(g_done); -} - -#endif // GMOCK_HAS_GOOGLE3_CALLBACK_ - // Tests using WithoutArgs with an action that takes no argument. TEST(WithoutArgsTest, NoArg) { Action a = WithoutArgs(Invoke(Nullary)); // NOLINT -- cgit v1.2.1