diff options
author | shiqian <shiqian@861a406c-534a-0410-8894-cb66d6ee9925> | 2008-11-24 20:13:22 +0000 |
---|---|---|
committer | shiqian <shiqian@861a406c-534a-0410-8894-cb66d6ee9925> | 2008-11-24 20:13:22 +0000 |
commit | c440a6923aa65d5be64134a6f430a5867a63df3f (patch) | |
tree | 6d5be5dd4644d4c83cc5e434de31a8a4a59a3865 /test/gtest_unittest.cc | |
parent | 514265c415e072caf92fb4eed57aacdfea9964f1 (diff) | |
download | googletest-c440a6923aa65d5be64134a6f430a5867a63df3f.tar.gz googletest-c440a6923aa65d5be64134a6f430a5867a63df3f.tar.bz2 googletest-c440a6923aa65d5be64134a6f430a5867a63df3f.zip |
Enables the Python tests to run with 2.3 (necessary for testing on Mac OS X Tiger); also fixes gtest_output_test when built with xcode.
Diffstat (limited to 'test/gtest_unittest.cc')
-rw-r--r-- | test/gtest_unittest.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/gtest_unittest.cc b/test/gtest_unittest.cc index 0864d6eb..d926a744 100644 --- a/test/gtest_unittest.cc +++ b/test/gtest_unittest.cc @@ -105,12 +105,15 @@ using testing::TPRT_FATAL_FAILURE; using testing::TPRT_NONFATAL_FAILURE; using testing::TPRT_SUCCESS; using testing::UnitTest; +using testing::internal::kTestTypeIdInGoogleTest; using testing::internal::AppendUserMessage; using testing::internal::CodePointToUtf8; using testing::internal::EqFailure; using testing::internal::FloatingPoint; using testing::internal::GetCurrentOsStackTraceExceptTop; using testing::internal::GetFailedPartCount; +using testing::internal::GetTestTypeId; +using testing::internal::GetTypeId; using testing::internal::GTestFlagSaver; using testing::internal::Int32; using testing::internal::List; @@ -126,6 +129,31 @@ using testing::internal::WideStringToUtf8; // This line tests that we can define tests in an unnamed namespace. namespace { +// Tests GetTypeId. + +TEST(GetTypeIdTest, ReturnsSameValueForSameType) { + EXPECT_EQ(GetTypeId<int>(), GetTypeId<int>()); + EXPECT_EQ(GetTypeId<Test>(), GetTypeId<Test>()); +} + +class SubClassOfTest : public Test {}; +class AnotherSubClassOfTest : public Test {}; + +TEST(GetTypeIdTest, ReturnsDifferentValuesForDifferentTypes) { + EXPECT_NE(GetTypeId<int>(), GetTypeId<const int>()); + EXPECT_NE(GetTypeId<int>(), GetTypeId<char>()); + EXPECT_NE(GetTypeId<int>(), GetTestTypeId()); + EXPECT_NE(GetTypeId<SubClassOfTest>(), GetTestTypeId()); + EXPECT_NE(GetTypeId<AnotherSubClassOfTest>(), GetTestTypeId()); + EXPECT_NE(GetTypeId<AnotherSubClassOfTest>(), GetTypeId<SubClassOfTest>()); +} + +// Verifies that GetTestTypeId() returns the same value, no matter it +// is called from inside Google Test or outside of it. +TEST(GetTestTypeIdTest, ReturnsTheSameValueInsideOrOutsideOfGoogleTest) { + EXPECT_EQ(kTestTypeIdInGoogleTest, GetTestTypeId()); +} + // Tests FormatTimeInMillisAsSeconds(). TEST(FormatTimeInMillisAsSecondsTest, FormatsZero) { |