From 52a9c14c48ed8f3c68d1d10e53a5be761a901a17 Mon Sep 17 00:00:00 2001 From: misterg Date: Mon, 7 Aug 2017 13:20:57 -0400 Subject: Samples changes upstreaming --- googletest/samples/sample10_unittest.cc | 6 +----- googletest/samples/sample1_unittest.cc | 6 +++++- googletest/samples/sample2_unittest.cc | 2 +- googletest/samples/sample3_unittest.cc | 3 ++- googletest/samples/sample4_unittest.cc | 2 +- googletest/samples/sample6_unittest.cc | 2 +- googletest/samples/sample7_unittest.cc | 2 +- googletest/samples/sample8_unittest.cc | 2 +- googletest/samples/sample9_unittest.cc | 8 ++------ 9 files changed, 15 insertions(+), 18 deletions(-) diff --git a/googletest/samples/sample10_unittest.cc b/googletest/samples/sample10_unittest.cc index 6ddb24b..4c4dcf8 100644 --- a/googletest/samples/sample10_unittest.cc +++ b/googletest/samples/sample10_unittest.cc @@ -34,8 +34,7 @@ #include #include -#include "gtest/gtest.h" -namespace { +#include "third_party/gtest/include/gtest/gtest.h" using ::testing::EmptyTestEventListener; using ::testing::InitGoogleTest; using ::testing::Test; @@ -46,7 +45,6 @@ using ::testing::TestPartResult; using ::testing::UnitTest; namespace { - // We will track memory used by this class. class Water { public: @@ -106,7 +104,6 @@ TEST(ListenersTest, LeaksWater) { Water* water = new Water; EXPECT_TRUE(water != NULL); } - } // namespace int main(int argc, char **argv) { @@ -142,4 +139,3 @@ int main(int argc, char **argv) { } return RUN_ALL_TESTS(); } -} // namespace \ No newline at end of file diff --git a/googletest/samples/sample1_unittest.cc b/googletest/samples/sample1_unittest.cc index 861eff9..8376bb4 100644 --- a/googletest/samples/sample1_unittest.cc +++ b/googletest/samples/sample1_unittest.cc @@ -72,6 +72,7 @@ namespace { // // + // Tests Factorial(). // Tests factorial of negative numbers. @@ -99,7 +100,9 @@ TEST(FactorialTest, Negative) { } // Tests factorial of 0. -TEST(FactorialTest, Zero) { EXPECT_EQ(1, Factorial(0)); } +TEST(FactorialTest, Zero) { + EXPECT_EQ(1, Factorial(0)); +} // Tests factorial of positive numbers. TEST(FactorialTest, Positive) { @@ -109,6 +112,7 @@ TEST(FactorialTest, Positive) { EXPECT_EQ(40320, Factorial(8)); } + // Tests IsPrime() // Tests negative input. diff --git a/googletest/samples/sample2_unittest.cc b/googletest/samples/sample2_unittest.cc index 826f2d4..df522da 100644 --- a/googletest/samples/sample2_unittest.cc +++ b/googletest/samples/sample2_unittest.cc @@ -107,4 +107,4 @@ TEST(MyString, Set) { s.Set(NULL); EXPECT_STREQ(NULL, s.c_string()); } -} // namespace \ No newline at end of file +} // namespace diff --git a/googletest/samples/sample3_unittest.cc b/googletest/samples/sample3_unittest.cc index 18da0b3..b2f4924 100644 --- a/googletest/samples/sample3_unittest.cc +++ b/googletest/samples/sample3_unittest.cc @@ -65,7 +65,7 @@ #include "sample3-inl.h" #include "gtest/gtest.h" - +namespace{ // To use a test fixture, derive a class from testing::Test. class QueueTestSmpl3 : public testing::Test { protected: // You should make the members protected s.t. they can be @@ -149,3 +149,4 @@ TEST_F(QueueTestSmpl3, Map) { MapTester(&q1_); MapTester(&q2_); } +} // namespace diff --git a/googletest/samples/sample4_unittest.cc b/googletest/samples/sample4_unittest.cc index 2d13a8b..948266e 100644 --- a/googletest/samples/sample4_unittest.cc +++ b/googletest/samples/sample4_unittest.cc @@ -43,4 +43,4 @@ TEST(Counter, Increment) { EXPECT_EQ(1, c.Increment()); EXPECT_EQ(2, c.Increment()); } -} // namespace \ No newline at end of file +} // namespace diff --git a/googletest/samples/sample6_unittest.cc b/googletest/samples/sample6_unittest.cc index 7b603a2..1faf0c3 100644 --- a/googletest/samples/sample6_unittest.cc +++ b/googletest/samples/sample6_unittest.cc @@ -222,4 +222,4 @@ INSTANTIATE_TYPED_TEST_CASE_P(OnTheFlyAndPreCalculated, // Instance name PrimeTableImplementations); // Type list #endif // GTEST_HAS_TYPED_TEST_P -} // namespace \ No newline at end of file +} // namespace diff --git a/googletest/samples/sample7_unittest.cc b/googletest/samples/sample7_unittest.cc index 44f534b..b59e1d9 100644 --- a/googletest/samples/sample7_unittest.cc +++ b/googletest/samples/sample7_unittest.cc @@ -127,4 +127,4 @@ INSTANTIATE_TEST_CASE_P(OnTheFlyAndPreCalculated, PrimeTableTestSmpl7, TEST(DummyTest, ValueParameterizedTestsAreNotSupportedOnThisPlatform) {} #endif // GTEST_HAS_PARAM_TEST -} \ No newline at end of file +} // namespace diff --git a/googletest/samples/sample8_unittest.cc b/googletest/samples/sample8_unittest.cc index 4ce9667..b0ff2d1 100644 --- a/googletest/samples/sample8_unittest.cc +++ b/googletest/samples/sample8_unittest.cc @@ -171,4 +171,4 @@ INSTANTIATE_TEST_CASE_P(MeaningfulTestParameters, TEST(DummyTest, CombineIsNotSupportedOnThisPlatform) {} #endif // GTEST_HAS_COMBINE -} \ No newline at end of file +} // namespace diff --git a/googletest/samples/sample9_unittest.cc b/googletest/samples/sample9_unittest.cc index 87ddca7..fb35a3a 100644 --- a/googletest/samples/sample9_unittest.cc +++ b/googletest/samples/sample9_unittest.cc @@ -34,8 +34,8 @@ #include -#include "gtest/gtest.h" -namespace { +#include "third_party/gtest/include/gtest/gtest.h" + using ::testing::EmptyTestEventListener; using ::testing::InitGoogleTest; using ::testing::Test; @@ -44,9 +44,7 @@ using ::testing::TestEventListeners; using ::testing::TestInfo; using ::testing::TestPartResult; using ::testing::UnitTest; - namespace { - // Provides alternative output mode which produces minimal amount of // information about tests. class TersePrinter : public EmptyTestEventListener { @@ -102,7 +100,6 @@ TEST(CustomOutputTest, Fails) { EXPECT_EQ(1, 2) << "This test fails in order to demonstrate alternative failure messages"; } - } // namespace int main(int argc, char **argv) { @@ -158,4 +155,3 @@ int main(int argc, char **argv) { return ret_val; } -} // namespace \ No newline at end of file -- cgit v0.12