diff options
author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-04-28 00:28:09 (GMT) |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-04-28 00:28:09 (GMT) |
commit | c78ae6196dc9c24380b5cf86f8fd75a4d3edc704 (patch) | |
tree | ea5077b43fd8b0e10aedb67eb7488254efff7814 /src/gtest.cc | |
parent | f2334aa19555063791ec16fe2b476ec00195bbb8 (diff) | |
download | googletest-c78ae6196dc9c24380b5cf86f8fd75a4d3edc704.zip googletest-c78ae6196dc9c24380b5cf86f8fd75a4d3edc704.tar.gz googletest-c78ae6196dc9c24380b5cf86f8fd75a4d3edc704.tar.bz2 |
Ports gtest to C++Builder, by Josh Kelley.
Diffstat (limited to 'src/gtest.cc')
-rw-r--r-- | src/gtest.cc | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/gtest.cc b/src/gtest.cc index a711805..4880767 100644 --- a/src/gtest.cc +++ b/src/gtest.cc @@ -735,10 +735,11 @@ String UnitTestImpl::CurrentOsStackTraceExceptTop(int skip_count) { } static TimeInMillis GetTimeInMillis() { -#ifdef _WIN32_WCE // We are on Windows CE +#if defined(_WIN32_WCE) || defined(__BORLANDC__) // Difference between 1970-01-01 and 1601-01-01 in miliseconds. // http://analogous.blogspot.com/2005/04/epoch.html - const TimeInMillis kJavaEpochToWinFileTimeDelta = 11644473600000UL; + const TimeInMillis kJavaEpochToWinFileTimeDelta = + static_cast<TimeInMillis>(116444736UL) * 100000UL; const DWORD kTenthMicrosInMilliSecond = 10000; SYSTEMTIME now_systime; @@ -3221,13 +3222,18 @@ UnitTest * UnitTest::GetInstance() { // different implementation in this case to bypass the compiler bug. // This implementation makes the compiler happy, at the cost of // leaking the UnitTest object. -#if _MSC_VER == 1310 && !defined(_DEBUG) // MSVC 7.1 and optimized build. + + // CodeGear C++Builder insists on a public destructor for the + // default implementation. Use this implementation to keep good OO + // design with private destructor. + +#if (_MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__) static UnitTest* const instance = new UnitTest; return instance; #else static UnitTest instance; return &instance; -#endif // _MSC_VER==1310 && !defined(_DEBUG) +#endif // (_MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__) } // Registers and returns a global test environment. When a test @@ -3259,7 +3265,7 @@ Environment* UnitTest::AddEnvironment(Environment* env) { class GoogleTestFailureException : public ::std::runtime_error { public: explicit GoogleTestFailureException(const TestPartResult& failure) - : runtime_error(PrintTestPartResultToString(failure).c_str()) {} + : ::std::runtime_error(PrintTestPartResultToString(failure).c_str()) {} }; #endif @@ -3350,17 +3356,20 @@ int UnitTest::Run() { SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX); #endif // _WIN32_WCE +#if defined(_MSC_VER) || defined(__MINGW32__) // Death test children can be terminated with _abort(). On Windows, // _abort() can show a dialog with a warning message. This forces the // abort message to go to stderr instead. _set_error_mode(_OUT_TO_STDERR); +#endif +#if _MSC_VER >= 1400 // In the debug version, Visual Studio pops up a separate dialog // offering a choice to debug the aborted program. We need to suppress // this dialog or it will pop up for every EXPECT/ASSERT_DEATH statement // executed. Google Test will notify the user of any unexpected // failure via stderr. -#if _MSC_VER >= 1400 + // // VC++ doesn't define _set_abort_behavior() prior to the version 8.0. // Users of prior VC versions shall suffer the agony and pain of // clicking through the countless debug dialogs. |