Samples changes upstreaming
This commit is contained in:
parent
aa31cb67c2
commit
52a9c14c48
|
@ -34,8 +34,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#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
|
|
@ -72,6 +72,7 @@ namespace {
|
|||
//
|
||||
// </TechnicalDetails>
|
||||
|
||||
|
||||
// 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.
|
||||
|
|
|
@ -107,4 +107,4 @@ TEST(MyString, Set) {
|
|||
s.Set(NULL);
|
||||
EXPECT_STREQ(NULL, s.c_string());
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -43,4 +43,4 @@ TEST(Counter, Increment) {
|
|||
EXPECT_EQ(1, c.Increment());
|
||||
EXPECT_EQ(2, c.Increment());
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
|
|
@ -222,4 +222,4 @@ INSTANTIATE_TYPED_TEST_CASE_P(OnTheFlyAndPreCalculated, // Instance name
|
|||
PrimeTableImplementations); // Type list
|
||||
|
||||
#endif // GTEST_HAS_TYPED_TEST_P
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
|
|
@ -127,4 +127,4 @@ INSTANTIATE_TEST_CASE_P(OnTheFlyAndPreCalculated, PrimeTableTestSmpl7,
|
|||
TEST(DummyTest, ValueParameterizedTestsAreNotSupportedOnThisPlatform) {}
|
||||
|
||||
#endif // GTEST_HAS_PARAM_TEST
|
||||
}
|
||||
} // namespace
|
||||
|
|
|
@ -171,4 +171,4 @@ INSTANTIATE_TEST_CASE_P(MeaningfulTestParameters,
|
|||
TEST(DummyTest, CombineIsNotSupportedOnThisPlatform) {}
|
||||
|
||||
#endif // GTEST_HAS_COMBINE
|
||||
}
|
||||
} // namespace
|
||||
|
|
|
@ -34,8 +34,8 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#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
|
Loading…
Reference in New Issue
Block a user