GitHub Viewer
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a7411bc8..c9ddc328 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,7 +10,12 @@ option(UTPP_INCLUDE_TESTS_IN_BUILD
option(UTPP_AMPLIFY_WARNINGS
"Set this to OFF if you wish to use CMake default warning levels; should generally only use to work around support issues for your specific compiler"
ON)
-
+
+if(BORLAND)
+ set(UTPP_USE_PLUS_SIGN OFF)
+ string(APPEND CMAKE_CXX_STANDARD_LIBRARIES " cp32mti.lib Vcl50.bpi Vclx50.bpi bcbsmp50.bpi Qrpt50.bpi Vcldb50.bpi Vclbde50.bpi ibsmp50.bpi vcldbx50.bpi TeeUI50.bpi TeeDB50.bpi Tee50.bpi TeeQR50.bpi VCLIB50.bpi bcbie50.bpi vclie50.bpi Inetdb50.bpi Inet50.bpi NMFast50.bpi dclocx50.bpi bcb2kaxserver50.bpi Memmgr.Lib ")
+endif()
+
if(MSVC14 OR MSVC12)
# has the support we need
else()
@@ -32,6 +37,8 @@ if (${UTPP_AMPLIFY_WARNINGS})
# we are dealing with an MSVC or MSVC-like compiler (e.g. Intel on Windows)
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
+ elseif(BORLAND)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w-par")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
endif()
@@ -59,28 +66,34 @@ add_library(UnitTest++ STATIC ${headers_} ${sources_} ${platformHeaders_} ${plat
if(${UTPP_USE_PLUS_SIGN})
set_target_properties(UnitTest++ PROPERTIES OUTPUT_NAME UnitTest++)
+else()
+ set_target_properties(UnitTest++ PROPERTIES OUTPUT_NAME UnitTestpp)
endif()
+if(${UTPP_USE_PLUS_SIGN})
+ set(UTPP_TEST_NAME TestUnitTest++)
+else()
+ set(UTPP_TEST_NAME TestUnitTestPP)
+endif()
+
# build the test runner
file(GLOB TEST_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} tests/*.cpp tests/*.h)
source_group( "" FILES ${TEST_SRCS})
-add_executable(TestUnitTest++ ${TEST_SRCS})
+add_executable(${UTPP_TEST_NAME} ${TEST_SRCS})
include_directories(.)
-if(${UTPP_USE_PLUS_SIGN})
- set_target_properties(TestUnitTest++ PROPERTIES OUTPUT_NAME TestUnitTest++)
-endif()
+set_target_properties(${UTPP_TEST_NAME} PROPERTIES OUTPUT_NAME ${UTPP_TEST_NAME})
-target_link_libraries(TestUnitTest++ UnitTest++)
+target_link_libraries(${UTPP_TEST_NAME} UnitTest++)
# run unit tests as post build step
-add_custom_command(TARGET TestUnitTest++
- POST_BUILD COMMAND TestUnitTest++
+add_custom_command(TARGET ${UTPP_TEST_NAME}
+ POST_BUILD COMMAND ${UTPP_TEST_NAME}
COMMENT "Running unit tests")
if(NOT ${UTPP_INCLUDE_TESTS_IN_BUILD})
- set_target_properties(TestUnitTest++ PROPERTIES EXCLUDE_FROM_ALL 1)
+ set_target_properties(${UTPP_TEST_NAME} PROPERTIES EXCLUDE_FROM_ALL 1)
endif()
# add install targets
diff --git a/UnitTest++/MemoryOutStream.cpp b/UnitTest++/MemoryOutStream.cpp
index 98e52e62..41dd0f9d 100644
--- a/UnitTest++/MemoryOutStream.cpp
+++ b/UnitTest++/MemoryOutStream.cpp
@@ -6,14 +6,19 @@ namespace UnitTest {
char const* MemoryOutStream::GetText() const
{
- m_text = this->str();
+ try
+ {
+ m_text = this->str();
+ }
+ catch (...) { m_text = ""; }
+
return m_text.c_str();
}
void MemoryOutStream::Clear()
{
this->str(std::string());
- m_text = this->str();
+ m_text = std::string();
}
#ifdef UNITTEST_COMPILER_IS_MSVC6
diff --git a/tests/Main.cpp b/tests/Main.cpp
index 4a0f4025..0c369f0b 100644
--- a/tests/Main.cpp
+++ b/tests/Main.cpp
@@ -1,4 +1,7 @@
#include "UnitTest++/UnitTestPP.h"
+#ifdef __BORLANDC__
+ #include
+#endif
int main(int, char const *[])
{
diff --git a/tests/TestCheckMacros.cpp b/tests/TestCheckMacros.cpp
index f9c46c49..6d948fb0 100644
--- a/tests/TestCheckMacros.cpp
+++ b/tests/TestCheckMacros.cpp
@@ -4,6 +4,9 @@
#include "ScopedCurrentTest.h"
using namespace std;
+#ifdef __BORLANDC__
+using namespace UnitTest;
+#endif
namespace {
diff --git a/tests/TestChecks.cpp b/tests/TestChecks.cpp
index 2c0ac047..04cd150c 100644
--- a/tests/TestChecks.cpp
+++ b/tests/TestChecks.cpp
@@ -3,6 +3,11 @@
#include
+#ifdef __BORLANDC__
+ #include
+ #include
+#endif
+
using namespace UnitTest;
@@ -148,6 +153,11 @@ namespace {
TEST(CheckCloseWithNaNFails)
{
+#ifdef __BORLANDC__
+ // This is to allow the check test to pass when using Nan (invalid float numbers), otherwise, they throw an exception
+ // and the test fails (CheckCloseWithNaNFails and CheckCloseWithNaNAgainstItselfFails)
+ _control87(MCW_EM, MCW_EM);
+#endif
const unsigned int bitpattern = 0xFFFFFFFF;
float nan;
UNIITEST_NS_QUAL_STD(memcpy)(&nan, &bitpattern, sizeof(bitpattern));
diff --git a/tests/TestCurrentTest.cpp b/tests/TestCurrentTest.cpp
index 6cfb99df..ef0852ad 100644
--- a/tests/TestCurrentTest.cpp
+++ b/tests/TestCurrentTest.cpp
@@ -2,6 +2,10 @@
#include "UnitTest++/CurrentTest.h"
#include "ScopedCurrentTest.h"
+#ifdef __BORLANDC__
+using namespace UnitTest;
+#endif
+
namespace
{
diff --git a/tests/TestExceptions.cpp b/tests/TestExceptions.cpp
index 08f6547b..c7157c2b 100644
--- a/tests/TestExceptions.cpp
+++ b/tests/TestExceptions.cpp
@@ -9,6 +9,9 @@
#include
using namespace std;
+#ifdef __BORLANDC__
+using namespace UnitTest;
+#endif
namespace {
diff --git a/tests/TestLongMacros.cpp b/tests/TestLongMacros.cpp
index 6720a976..89df6364 100644
--- a/tests/TestLongMacros.cpp
+++ b/tests/TestLongMacros.cpp
@@ -2,6 +2,10 @@
#include "UnitTest++/UnitTestPP.h"
+#ifdef __BORLANDC__
+using namespace UnitTest;
+#endif
+
// This file is not intended to test every little thing, just a few basics to hopefully ensure
// the macros are working and the short macros are not defined.
UNITTEST_SUITE(LongMacros)
diff --git a/tests/TestMemoryOutStream.cpp b/tests/TestMemoryOutStream.cpp
index 854277ea..4010c79e 100644
--- a/tests/TestMemoryOutStream.cpp
+++ b/tests/TestMemoryOutStream.cpp
@@ -170,7 +170,7 @@ namespace {
TEST(StreamingLongLongWritesCorrectCharacters)
{
MemoryOutStream stream;
-#ifdef UNITTEST_COMPILER_IS_MSVC6
+#if defined(UNITTEST_COMPILER_IS_MSVC6) || defined(__BORLANDC__)
stream