From 8965a6a0d2165f32e6413594bba6367f271f51e7 Mon Sep 17 00:00:00 2001 From: vladlosev Date: Fri, 4 Nov 2011 17:56:23 +0000 Subject: Improves conformance to the Google C++ Style Guide (by Greg Miller). --- test/gtest_unittest.cc | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'test/gtest_unittest.cc') diff --git a/test/gtest_unittest.cc b/test/gtest_unittest.cc index 0d624fd7..8cd58be0 100644 --- a/test/gtest_unittest.cc +++ b/test/gtest_unittest.cc @@ -33,8 +33,6 @@ // Google Test work. #include "gtest/gtest.h" -#include -#include // Verifies that the command line flag variables can be accessed // in code once has been #included. @@ -58,6 +56,15 @@ TEST(CommandLineFlagsTest, CanBeAccessedInCodeOnceGTestHIsIncluded) { EXPECT_TRUE(dummy || !dummy); // Suppresses warning that dummy is unused. } +#include // For INT_MAX. +#include +#include +#include + +#include +#include +#include + #include "gtest/gtest-spi.h" // Indicates that this translation unit is part of Google Test's @@ -69,13 +76,6 @@ TEST(CommandLineFlagsTest, CanBeAccessedInCodeOnceGTestHIsIncluded) { #include "src/gtest-internal-inl.h" #undef GTEST_IMPLEMENTATION_ -#include // For INT_MAX. -#include -#include -#include - -#include - namespace testing { namespace internal { @@ -1141,7 +1141,7 @@ TEST(StringTest, Equals) { EXPECT_TRUE(foo == "foo"); // NOLINT const String bar("x\0y", 3); - EXPECT_FALSE(bar == "x"); + EXPECT_NE(bar, "x"); } // Tests String::operator!=(). @@ -1163,7 +1163,7 @@ TEST(StringTest, NotEquals) { EXPECT_FALSE(foo != "foo"); // NOLINT const String bar("x\0y", 3); - EXPECT_TRUE(bar != "x"); + EXPECT_NE(bar, "x"); } // Tests String::length(). @@ -1902,6 +1902,7 @@ class GTestFlagSaverTest : public Test { GTEST_FLAG(stream_result_to) = "localhost:1234"; GTEST_FLAG(throw_on_failure) = true; } + private: // For saving Google Test flags during this test case. static GTestFlagSaver* saver_; @@ -2797,7 +2798,6 @@ TEST(IsNotSubstringTest, ReturnsCorrectResultForStdWstring) { template class FloatingPointTest : public Test { protected: - // Pre-calculated numbers to be used by the tests. struct TestValues { RawType close_to_positive_zero; @@ -7278,6 +7278,7 @@ TEST(ArrayEqTest, WorksForDegeneratedArrays) { } TEST(ArrayEqTest, WorksForOneDimensionalArrays) { + // Note that a and b are distinct but compatible types. const int a[] = { 0, 1 }; long b[] = { 0, 1 }; EXPECT_TRUE(ArrayEq(a, b)); -- cgit v1.2.3