From 29e9ca87743400382725bd475f2206ca4b6f1828 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Fri, 23 Feb 2018 11:29:35 -0500 Subject: [PATCH 1/3] merging unitests, check --- googletest/test/gtest_unittest.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index bf7621ef..f62e5b4b 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -2421,9 +2421,8 @@ TEST(StringAssertionTest, ASSERT_STREQ) { const char p2[] = "good"; ASSERT_STREQ(p1, p2); - EXPECT_FATAL_FAILURE( - ASSERT_STREQ("bad", "good"), - "Expected equality of these values:\n \"bad\"\n \"good\""); + EXPECT_FATAL_FAILURE(ASSERT_STREQ("bad", "good"), + " \"bad\"\n \"good\""); } // Tests ASSERT_STREQ with NULL arguments. @@ -3698,7 +3697,7 @@ TEST(AssertionTest, ASSERT_EQ_NULL) { // A failure. static int n = 0; EXPECT_FATAL_FAILURE(ASSERT_EQ(NULL, &n), - " &n\n Which is:"); + " &n\n Which is: 0x"); } #endif // GTEST_CAN_COMPARE_NULL From 004f6a00b20ef92285707702e2ab187092671c2b Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Fri, 23 Feb 2018 15:27:11 -0500 Subject: [PATCH 2/3] merging unitests - check 4 --- googletest/test/gtest_unittest.cc | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index f62e5b4b..38ff19ee 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -3697,7 +3697,7 @@ TEST(AssertionTest, ASSERT_EQ_NULL) { // A failure. static int n = 0; EXPECT_FATAL_FAILURE(ASSERT_EQ(NULL, &n), - " &n\n Which is: 0x"); + " &n\n Which is:"); } #endif // GTEST_CAN_COMPARE_NULL @@ -3812,7 +3812,7 @@ void TestEq1(int x) { // Tests calling a test subroutine that's not part of a fixture. TEST(AssertionTest, NonFixtureSubroutine) { EXPECT_FATAL_FAILURE(TestEq1(2), - "Which is: 2"); + " x\n Which is: 2"); } // An uncopyable class. @@ -3951,13 +3951,13 @@ TEST(AssertionTest, AnonymousEnum) { // ICE's in C++Builder. EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseB), - "kCaseB"); + " kCaseB\n Which is: "); EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC), - "Which is: 42"); + "\n Which is: 42"); # endif EXPECT_FATAL_FAILURE(ASSERT_EQ(kCaseA, kCaseC), - "Which is: -1"); + "\n Which is: -1"); } #endif // !GTEST_OS_MAC && !defined(__SUNPRO_CC) @@ -4441,7 +4441,7 @@ TEST(ExpectTest, EXPECT_EQ_0) { // A failure. EXPECT_NONFATAL_FAILURE(EXPECT_EQ(0, 5.6), - "Expected equality of these values:\n 0\n 5.6"); + " 0\n 5.6"); } // Tests EXPECT_NE. @@ -4541,7 +4541,7 @@ TEST(ExpectTest, EXPECT_ANY_THROW) { TEST(ExpectTest, ExpectPrecedence) { EXPECT_EQ(1 < 2, true); EXPECT_NONFATAL_FAILURE(EXPECT_EQ(true, true && false), - "true && false"); + " true && false\n Which is: false"); } @@ -4688,14 +4688,14 @@ TEST(EqAssertionTest, Bool) { EXPECT_FATAL_FAILURE({ bool false_value = false; ASSERT_EQ(false_value, true); - }, "Which is: false"); + }, " false_value\n Which is: false\n true"); } // Tests using int values in {EXPECT|ASSERT}_EQ. TEST(EqAssertionTest, Int) { ASSERT_EQ(32, 32); EXPECT_NONFATAL_FAILURE(EXPECT_EQ(32, 33), - "33"); + " 32\n 33"); } // Tests using time_t values in {EXPECT|ASSERT}_EQ. @@ -4712,9 +4712,9 @@ TEST(EqAssertionTest, Char) { ASSERT_EQ('z', 'z'); const char ch = 'b'; EXPECT_NONFATAL_FAILURE(EXPECT_EQ('\0', ch), - "ch"); + " ch\n Which is: 'b'"); EXPECT_NONFATAL_FAILURE(EXPECT_EQ('a', ch), - "ch"); + " ch\n Which is: 'b'"); } // Tests using wchar_t values in {EXPECT|ASSERT}_EQ. @@ -4734,7 +4734,7 @@ TEST(EqAssertionTest, WideChar) { "wchar"); wchar = 0x8119; EXPECT_FATAL_FAILURE(ASSERT_EQ(static_cast(0x8120), wchar), - "wchar"); + " wchar\n Which is: L'"); } // Tests using ::std::string values in {EXPECT|ASSERT}_EQ. @@ -4763,8 +4763,7 @@ TEST(EqAssertionTest, StdString) { static ::std::string str3(str1); str3.at(2) = '\0'; EXPECT_FATAL_FAILURE(ASSERT_EQ(str1, str3), - " str3\n" - " Which is: \"A \\0 in the middle\""); + " str3\n Which is: \"A \\0 in the middle\""); } #if GTEST_HAS_STD_WSTRING From 4dbb4371741c170742b87dcec02b88e61a586888 Mon Sep 17 00:00:00 2001 From: Gennadiy Civil Date: Mon, 26 Feb 2018 09:51:27 -0500 Subject: [PATCH 3/3] merging unittests - 5 --- googletest/test/gtest_unittest.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/googletest/test/gtest_unittest.cc b/googletest/test/gtest_unittest.cc index 38ff19ee..11af9c9b 100644 --- a/googletest/test/gtest_unittest.cc +++ b/googletest/test/gtest_unittest.cc @@ -4425,7 +4425,7 @@ TEST(ExpectTest, EXPECT_EQ_NULL) { // A failure. int n = 0; EXPECT_NONFATAL_FAILURE(EXPECT_EQ(NULL, &n), - "&n\n"); + " &n\n Which is:"); } #endif // GTEST_CAN_COMPARE_NULL @@ -4883,9 +4883,9 @@ TEST(EqAssertionTest, CharPointer) { ASSERT_EQ(p1, p1); EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p0, p2), - "p2"); + " p2\n Which is:"); EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p1, p2), - "p2"); + " p2\n Which is:"); EXPECT_FATAL_FAILURE(ASSERT_EQ(reinterpret_cast(0x1234), reinterpret_cast(0xABC0)), "ABC0"); @@ -4905,9 +4905,9 @@ TEST(EqAssertionTest, WideCharPointer) { EXPECT_EQ(p0, p0); EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p0, p2), - "p2"); + " p2\n Which is:"); EXPECT_NONFATAL_FAILURE(EXPECT_EQ(p1, p2), - "p2"); + " p2\n Which is:"); void* pv3 = (void*)0x1234; // NOLINT void* pv4 = (void*)0xABC0; // NOLINT const wchar_t* p3 = reinterpret_cast(pv3);