From a2a32c20434807e9966e3f48375f9419134d1b55 Mon Sep 17 00:00:00 2001 From: "kenton@google.com" Date: Fri, 14 Nov 2008 17:29:32 +0000 Subject: Support HP C++ on Tru64. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch (mostly) by Vincent Choinière . --- src/gtest/gtest.cc | 43 ++++++++++++++++++------------------------- 1 file changed, 18 insertions(+), 25 deletions(-) (limited to 'src/gtest/gtest.cc') diff --git a/src/gtest/gtest.cc b/src/gtest/gtest.cc index 1eee3922..09a0815a 100644 --- a/src/gtest/gtest.cc +++ b/src/gtest/gtest.cc @@ -112,6 +112,21 @@ namespace testing { +// Calling ForEach(internal::Delete) doesn't work on HP C++ / Tru64. So, +// we must define a separate non-template function for each type. +static void DeleteTestCase(TestCase *x) +{ + delete x; +} +static void DeleteEnvironment(Environment *x) +{ + delete x; +} +static void DeleteTestInfo(TestInfo *x) +{ + delete x; +} + // Constants. // A test that matches this pattern is disabled and not run. @@ -799,28 +814,6 @@ String FormatForFailureMessage(char ch) { ch_as_uint, ch_as_uint); } -// For a wchar_t value, we print it as a C++ wchar_t literal and as an -// unsigned integer (both in decimal and in hexidecimal). -String FormatForFailureMessage(wchar_t wchar) { - // The C++ standard doesn't specify the exact size of the wchar_t - // type. It just says that it shall have the same size as another - // integral type, called its underlying type. - // - // Therefore, in order to print a wchar_t value in the numeric form, - // we first convert it to the largest integral type (UInt64) and - // then print the converted value. - // - // We use streaming to print the value as "%llu" doesn't work - // correctly with MSVC 7.1. - const UInt64 wchar_as_uint64 = wchar; - Message msg; - // A String object cannot contain '\0', so we print "\\0" when wchar is - // L'\0'. - msg << "L'" << (wchar ? ToUtf8String(wchar).c_str() : "\\0") << "' (" - << wchar_as_uint64 << ", 0x" << ::std::setbase(16) - << wchar_as_uint64 << ")"; - return msg.GetString(); -} } // namespace internal @@ -2059,7 +2052,7 @@ TestCase::TestCase(const char* name, // Destructor of TestCase. TestCase::~TestCase() { // Deletes every Test in the collection. - test_info_list_->ForEach(internal::Delete); + test_info_list_->ForEach(DeleteTestInfo); // Then deletes the Test collection. delete test_info_list_; @@ -3039,10 +3032,10 @@ UnitTestImpl::UnitTestImpl(UnitTest* parent) UnitTestImpl::~UnitTestImpl() { // Deletes every TestCase. - test_cases_.ForEach(internal::Delete); + test_cases_.ForEach(DeleteTestCase); // Deletes every Environment. - environments_.ForEach(internal::Delete); + environments_.ForEach(DeleteEnvironment); // Deletes the current test result printer. delete result_printer_; -- cgit v1.2.3