diff options
author | vladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-10-20 21:03:10 +0000 |
---|---|---|
committer | vladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-10-20 21:03:10 +0000 |
commit | bad778caa39a88b7c11b159e20730aeec4fd711e (patch) | |
tree | ab4f68a695479be0a9eaadcadc364f6c4b06d0c0 /test/gtest-tuple_test.cc | |
parent | 060804deb8c05b5ea5735b875eaea2c7493e2262 (diff) | |
download | googletest-bad778caa39a88b7c11b159e20730aeec4fd711e.tar.gz googletest-bad778caa39a88b7c11b159e20730aeec4fd711e.tar.bz2 googletest-bad778caa39a88b7c11b159e20730aeec4fd711e.zip |
Implements support for AssertionResult in Boolean assertions such as EXPECT_TRUE; Fixes Google Tests's tuple implementation to default-initialize its fields in the default constructor (by Zhanyong Wan); Populates gtest_stress_test.cc with actual tests.
Diffstat (limited to 'test/gtest-tuple_test.cc')
-rw-r--r-- | test/gtest-tuple_test.cc | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/test/gtest-tuple_test.cc b/test/gtest-tuple_test.cc index 3829118e..ca5232ee 100644 --- a/test/gtest-tuple_test.cc +++ b/test/gtest-tuple_test.cc @@ -135,12 +135,44 @@ TEST(ReferenceFieldTest, IsAliasOfReferencedVariable) { << "Changing a reference field should update the underlying variable."; } -// Tests tuple's default constructor. -TEST(TupleConstructorTest, DefaultConstructor) { - // We are just testing that the following compiles. +// Tests that tuple's default constructor default initializes each field. +// This test needs to compile without generating warnings. +TEST(TupleConstructorTest, DefaultConstructorDefaultInitializesEachField) { + // The TR1 report requires that tuple's default constructor default + // initializes each field, even if it's a primitive type. If the + // implementation forgets to do this, this test will catch it by + // generating warnings about using uninitialized variables (assuming + // a decent compiler). + tuple<> empty; - tuple<int> one_field; - tuple<double, char, bool*> three_fields; + + tuple<int> a1, b1; + b1 = a1; + EXPECT_EQ(0, get<0>(b1)); + + tuple<int, double> a2, b2; + b2 = a2; + EXPECT_EQ(0, get<0>(b2)); + EXPECT_EQ(0.0, get<1>(b2)); + + tuple<double, char, bool*> a3, b3; + b3 = a3; + EXPECT_EQ(0.0, get<0>(b3)); + EXPECT_EQ('\0', get<1>(b3)); + EXPECT_EQ(NULL, get<2>(b3)); + + tuple<int, int, int, int, int, int, int, int, int, int> a10, b10; + b10 = a10; + EXPECT_EQ(0, get<0>(b10)); + EXPECT_EQ(0, get<1>(b10)); + EXPECT_EQ(0, get<2>(b10)); + EXPECT_EQ(0, get<3>(b10)); + EXPECT_EQ(0, get<4>(b10)); + EXPECT_EQ(0, get<5>(b10)); + EXPECT_EQ(0, get<6>(b10)); + EXPECT_EQ(0, get<7>(b10)); + EXPECT_EQ(0, get<8>(b10)); + EXPECT_EQ(0, get<9>(b10)); } // Tests constructing a tuple from its fields. |