From c440a6923aa65d5be64134a6f430a5867a63df3f Mon Sep 17 00:00:00 2001 From: shiqian Date: Mon, 24 Nov 2008 20:13:22 +0000 Subject: 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. --- test/gtest_unittest.cc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'test') 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(), GetTypeId()); + EXPECT_EQ(GetTypeId(), GetTypeId()); +} + +class SubClassOfTest : public Test {}; +class AnotherSubClassOfTest : public Test {}; + +TEST(GetTypeIdTest, ReturnsDifferentValuesForDifferentTypes) { + EXPECT_NE(GetTypeId(), GetTypeId()); + EXPECT_NE(GetTypeId(), GetTypeId()); + EXPECT_NE(GetTypeId(), GetTestTypeId()); + EXPECT_NE(GetTypeId(), GetTestTypeId()); + EXPECT_NE(GetTypeId(), GetTestTypeId()); + EXPECT_NE(GetTypeId(), GetTypeId()); +} + +// 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) { -- cgit v1.2.3