-
Notifications
You must be signed in to change notification settings - Fork 179
Adding Borland C++ Builder 5 support. #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
2809901
6c62f24
bcf039e
c5aa621
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems to me this is changing the meaning of |
||
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 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,14 +6,19 @@ namespace UnitTest { | |
|
||
char const* MemoryOutStream::GetText() const | ||
{ | ||
m_text = this->str(); | ||
try | ||
{ | ||
m_text = this->str(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the Borland implementation of If so, can we catch a more specific exception? Maybe Or, can we change the exception mask to prevent the exception entirely? http://en.cppreference.com/w/cpp/io/basic_ios/exceptions |
||
} | ||
catch (...) { m_text = ""; } | ||
|
||
return m_text.c_str(); | ||
} | ||
|
||
void MemoryOutStream::Clear() | ||
{ | ||
this->str(std::string()); | ||
m_text = this->str(); | ||
m_text = std::string(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe |
||
} | ||
|
||
#ifdef UNITTEST_COMPILER_IS_MSVC6 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
#include "UnitTest++/UnitTestPP.h" | ||
#ifdef __BORLANDC__ | ||
#include <vcl.h> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't think we needed the Visual Component Library to run a console application? |
||
#endif | ||
|
||
int main(int, char const *[]) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,9 @@ | |
#include "ScopedCurrentTest.h" | ||
|
||
using namespace std; | ||
#ifdef __BORLANDC__ | ||
using namespace UnitTest; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are there individual statements that can be changed, rather than adding this? |
||
#endif | ||
|
||
namespace { | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -170,7 +170,7 @@ namespace { | |
TEST(StreamingLongLongWritesCorrectCharacters) | ||
{ | ||
MemoryOutStream stream; | ||
#ifdef UNITTEST_COMPILER_IS_MSVC6 | ||
#if defined(UNITTEST_COMPILER_IS_MSVC6) || defined(__BORLANDC__) | ||
stream << (__int64)-12345i64; | ||
#else | ||
stream << (long long)-12345ll; | ||
|
@@ -199,7 +199,7 @@ namespace { | |
TEST(StreamingUnsignedLongLongWritesCorrectCharacters) | ||
{ | ||
MemoryOutStream stream; | ||
#ifdef UNITTEST_COMPILER_IS_MSVC6 | ||
#if defined(UNITTEST_COMPILER_IS_MSVC6) || defined(__BORLANDC__) | ||
stream << (unsigned __int64)85899ui64; | ||
#else | ||
stream << (unsigned long long)85899ull; | ||
|
@@ -219,7 +219,7 @@ namespace { | |
TEST(StreamingMinUnsignedLongLongWritesCorrectCharacters) | ||
{ | ||
MemoryOutStream stream; | ||
#ifdef UNITTEST_COMPILER_IS_MSVC6 | ||
#if defined(UNITTEST_COMPILER_IS_MSVC6) || defined(__BORLANDC__) | ||
stream << (unsigned __int64)0ui64; | ||
#else | ||
stream << (unsigned long long)0ull; | ||
|
@@ -257,6 +257,9 @@ namespace { | |
CHECK_EQUAL("53124", stream.GetText()); | ||
} | ||
|
||
// Not sure why but this test fails with the Borland C++ 5.5 compiler. | ||
// It throws an unhandled exception: | ||
// unexpected NULL pointer in function: basic_string( const charT*,size_type,const Allocator&) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, this test still fails, or did one of your other changes fix it? |
||
TEST(ClearEmptiesMemoryOutStreamContents) | ||
{ | ||
MemoryOutStream stream; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this
set
statement required for Borland? Can it not generate output files with+
in the name?