mirror of
https://github.com/unittest-cpp/unittest-cpp
synced 2026-09-26 16:19:30 +03:00
Merge pull request #34 from pjohnmeyer/version1.4CompatibilityFixes
Address multiple version 1.4 incompatibilities
This commit is contained in:
commit
c13d2471e9
79 changed files with 132 additions and 95 deletions
|
|
@ -1,29 +1,42 @@
|
|||
cmake_minimum_required(VERSION 2.8.1)
|
||||
project(UnitTest++)
|
||||
|
||||
option(UTPP_USE_PLUS_SIGN "Set this to OFF is you with to use '-cpp' instead of '++' in lib/include paths" ON)
|
||||
|
||||
# get the main sources
|
||||
file(GLOB SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/*.cpp src/*.h)
|
||||
source_group("" FILES ${SRCS})
|
||||
file(GLOB headers_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} UnitTest++/*.h)
|
||||
file(GLOB sources_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} UnitTest++/*.cpp)
|
||||
source_group("" FILES ${headers_} ${sources_})
|
||||
|
||||
# get platform specific sources
|
||||
if (WIN32)
|
||||
set(PLAT_DIR Win32)
|
||||
set(platformDir_ Win32)
|
||||
else()
|
||||
set(PLAT_DIR Posix)
|
||||
set(platformDir_ Posix)
|
||||
endif(WIN32)
|
||||
file(GLOB PLAT_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/${PLAT_DIR}/*.cpp src/${PLAT_DIR}/*.h)
|
||||
source_group(${PLAT_DIR} FILES ${PLAT_SRCS})
|
||||
|
||||
file(GLOB platformHeaders_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} UnitTest++/${platformDir_}/*.h)
|
||||
file(GLOB platformSources_ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} UnitTest++/${platformDir_}/*.cpp)
|
||||
source_group(${platformDir_} FILES ${platformHeaders_} ${platformSources_})
|
||||
|
||||
# create the lib
|
||||
add_library(UnitTestPP STATIC ${SRCS} ${PLAT_SRCS})
|
||||
set_target_properties(UnitTestPP PROPERTIES OUTPUT_NAME UnitTest++)
|
||||
include_directories(src)
|
||||
add_library(UnitTestPP STATIC ${headers_} ${sources_} ${platformHeaders_} ${platformSources_})
|
||||
|
||||
if(${UTPP_USE_PLUS_SIGN})
|
||||
set_target_properties(UnitTestPP PROPERTIES OUTPUT_NAME UnitTest++)
|
||||
endif()
|
||||
|
||||
|
||||
# build the test runner
|
||||
file(GLOB TEST_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/tests/*.cpp src/tests/*.h)
|
||||
file(GLOB TEST_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} tests/*.cpp tests/*.h)
|
||||
source_group( "" FILES ${TEST_SRCS})
|
||||
add_executable(TestUnitTestPP ${TEST_SRCS})
|
||||
set_target_properties(TestUnitTestPP PROPERTIES OUTPUT_NAME TestUnitTest++)
|
||||
include_directories(.)
|
||||
|
||||
if(${UTPP_USE_PLUS_SIGN})
|
||||
set_target_properties(TestUnitTestPP PROPERTIES OUTPUT_NAME TestUnitTest++)
|
||||
endif()
|
||||
|
||||
target_link_libraries(TestUnitTestPP UnitTestPP)
|
||||
|
||||
# turn on testing
|
||||
|
|
@ -33,3 +46,17 @@ add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -V)
|
|||
# add the test runner as a test
|
||||
add_test(NAME TestUnitTestPP COMMAND TestUnitTest++ ${CONFIG_PATH} ${CONFIG_TASKS_PATH} ${SOUND_LOG_PATH})
|
||||
add_dependencies(check TestUnitTestPP)
|
||||
|
||||
|
||||
# add install targets
|
||||
# need a custom install path?
|
||||
# define CMAKE_INSTALL_PREFIX to change root folder
|
||||
if(${UTPP_USE_PLUS_SIGN})
|
||||
set (UTPP_INSTALL_DESTINATION "include/UnitTest++")
|
||||
else()
|
||||
set (UTPP_INSTALL_DESTINATION "include/UnitTestPP")
|
||||
endif()
|
||||
|
||||
install(TARGETS UnitTestPP DESTINATION lib)
|
||||
install(FILES ${headers_} DESTINATION ${UTPP_INSTALL_DESTINATION})
|
||||
install(FILES ${platformHeaders_} DESTINATION ${UTPP_INSTALL_DESTINATION}/${platformDir_})
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef UNITTEST_ASSERTEXCEPTION_H
|
||||
#define UNITTEST_ASSERTEXCEPTION_H
|
||||
|
||||
#include "../config.h"
|
||||
#include "Config.h"
|
||||
#ifndef UNITTEST_NO_EXCEPTIONS
|
||||
|
||||
#include "HelperMacros.h"
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef UNITTEST_CHECKS_H
|
||||
#define UNITTEST_CHECKS_H
|
||||
|
||||
#include "../config.h"
|
||||
#include "Config.h"
|
||||
#include "TestResults.h"
|
||||
#include "MemoryOutStream.h"
|
||||
|
||||
|
|
@ -28,13 +28,22 @@
|
|||
#endif
|
||||
|
||||
|
||||
// MemoryOutStream is a custom reimplementation of parts of std::ostringstream.
|
||||
// Uncomment this line to have MemoryOutStream implemented in terms of std::ostringstream.
|
||||
// By default, MemoryOutStream is implemented in terms of std::ostringstream.
|
||||
// This is useful if you are using the CHECK macros on objects that have something like this defined:
|
||||
// std::ostringstream& operator<<(std::ostringstream& s, const YourObject& value)
|
||||
//
|
||||
// On the other hand, it can be more expensive.
|
||||
// Un-comment this line to use the custom MemoryOutStream (no deps on std::ostringstream).
|
||||
|
||||
//#define UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM
|
||||
// #define UNITTEST_USE_CUSTOM_STREAMS
|
||||
|
||||
// Developer note: This dual-macro setup is to preserve compatibility with UnitTest++ 1.4 users
|
||||
// who may have used or defined UNITTEST_USE_CUSTOM_STREAMS outside of this configuration file, as
|
||||
// well as Google Code HEAD users that may have used or defined
|
||||
// UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM outside of this configuration file.
|
||||
#ifndef UNITTEST_USE_CUSTOM_STREAMS
|
||||
#define UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM
|
||||
#endif
|
||||
|
||||
// DeferredTestReporter uses the STL to collect test results for subsequent export by reporters like
|
||||
// XmlTestReporter. If you don't want to use this functionality, uncomment this line and no STL
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "../config.h"
|
||||
#include "Config.h"
|
||||
#ifndef UNITTEST_NO_DEFERRED_REPORTER
|
||||
|
||||
#include "DeferredTestReporter.h"
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef UNITTEST_DEFERREDTESTREPORTER_H
|
||||
#define UNITTEST_DEFERREDTESTREPORTER_H
|
||||
|
||||
#include "../config.h"
|
||||
#include "Config.h"
|
||||
|
||||
#ifndef UNITTEST_NO_DEFERRED_REPORTER
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "../config.h"
|
||||
#include "Config.h"
|
||||
#ifndef UNITTEST_NO_DEFERRED_REPORTER
|
||||
|
||||
#include "DeferredTestResult.h"
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef UNITTEST_DEFERREDTESTRESULT_H
|
||||
#define UNITTEST_DEFERREDTESTRESULT_H
|
||||
|
||||
#include "../config.h"
|
||||
#include "Config.h"
|
||||
#ifndef UNITTEST_NO_DEFERRED_REPORTER
|
||||
|
||||
#include "HelperMacros.h"
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef UNITTEST_EXCEPTIONMACROS_H
|
||||
#define UNITTEST_EXCEPTIONMACROS_H
|
||||
|
||||
#include "../config.h"
|
||||
#include "Config.h"
|
||||
|
||||
#ifndef UNITTEST_NO_EXCEPTIONS
|
||||
#define UT_TRY(x) try x
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef UNITTEST_EXECUTE_TEST_H
|
||||
#define UNITTEST_EXECUTE_TEST_H
|
||||
|
||||
#include "../config.h"
|
||||
#include "Config.h"
|
||||
#include "ExceptionMacros.h"
|
||||
#include "TestDetails.h"
|
||||
#include "TestResults.h"
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef UNITTEST_HELPERMACROS_H
|
||||
#define UNITTEST_HELPERMACROS_H
|
||||
|
||||
#include "../config.h"
|
||||
#include "Config.h"
|
||||
|
||||
#define UNITTEST_MULTILINE_MACRO_BEGIN do {
|
||||
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef UNITTEST_MEMORYOUTSTREAM_H
|
||||
#define UNITTEST_MEMORYOUTSTREAM_H
|
||||
|
||||
#include "../config.h"
|
||||
#include "Config.h"
|
||||
#include "HelperMacros.h"
|
||||
|
||||
#ifdef UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef UNITTEST_REPORTASSERTIMPL_H
|
||||
#define UNITTEST_REPORTASSERTIMPL_H
|
||||
|
||||
#include "../config.h"
|
||||
#include "Config.h"
|
||||
#include "HelperMacros.h"
|
||||
|
||||
#ifdef UNITTEST_NO_EXCEPTIONS
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "../config.h"
|
||||
#include "Config.h"
|
||||
#include "Test.h"
|
||||
#include "TestList.h"
|
||||
#include "TestResults.h"
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef UNITTEST_TESTMACROS_H
|
||||
#define UNITTEST_TESTMACROS_H
|
||||
|
||||
#include "../config.h"
|
||||
#include "Config.h"
|
||||
#include "TestSuite.h"
|
||||
#include "ExceptionMacros.h"
|
||||
#include "ExecuteTest.h"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "../config.h"
|
||||
#include "Config.h"
|
||||
|
||||
#if defined UNITTEST_POSIX
|
||||
#include "Posix/TimeHelpers.h"
|
||||
1
UnitTest++/UnitTest++.h
Normal file
1
UnitTest++/UnitTest++.h
Normal file
|
|
@ -0,0 +1 @@
|
|||
#include "UnitTestPP.h"
|
||||
11
UnitTest++/UnitTestPP.h
Normal file
11
UnitTest++/UnitTestPP.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef UNITTESTPP_H
|
||||
#define UNITTESTPP_H
|
||||
|
||||
#include "Config.h"
|
||||
#include "TestMacros.h"
|
||||
#include "CheckMacros.h"
|
||||
#include "TestRunner.h"
|
||||
#include "TimeConstraint.h"
|
||||
#include "ReportAssert.h"
|
||||
|
||||
#endif
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef UNITTEST_TIMEHELPERS_H
|
||||
#define UNITTEST_TIMEHELPERS_H
|
||||
|
||||
#include "../../config.h"
|
||||
#include "../Config.h"
|
||||
#include "../HelperMacros.h"
|
||||
|
||||
#ifdef UNITTEST_MINGW
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "../config.h"
|
||||
#include "Config.h"
|
||||
#ifndef UNITTEST_NO_DEFERRED_REPORTER
|
||||
|
||||
#include "XmlTestReporter.h"
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef UNITTEST_XMLTESTREPORTER_H
|
||||
#define UNITTEST_XMLTESTREPORTER_H
|
||||
|
||||
#include "../config.h"
|
||||
#include "Config.h"
|
||||
#ifndef UNITTEST_NO_DEFERRED_REPORTER
|
||||
|
||||
#include "DeferredTestReporter.h"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "../../unittestpp.h"
|
||||
#include "UnitTest++/UnitTestPP.h"
|
||||
|
||||
int main(int, char const *[])
|
||||
{
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
#ifndef UNITTEST_RECORDINGREPORTER_H
|
||||
#define UNITTEST_RECORDINGREPORTER_H
|
||||
|
||||
#include "../TestReporter.h"
|
||||
#include "UnitTest++/TestReporter.h"
|
||||
#include <cstring>
|
||||
|
||||
#include "../TestDetails.h"
|
||||
#include "UnitTest++/TestDetails.h"
|
||||
|
||||
struct RecordingReporter : public UnitTest::TestReporter
|
||||
{
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef UNITTEST_SCOPEDCURRENTTEST_H
|
||||
#define UNITTEST_SCOPEDCURRENTTEST_H
|
||||
|
||||
#include "../CurrentTest.h"
|
||||
#include "UnitTest++/CurrentTest.h"
|
||||
#include <cstddef>
|
||||
|
||||
class ScopedCurrentTest
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
#include "../../config.h"
|
||||
#include "../../unittestpp.h"
|
||||
#include "UnitTest++/Config.h"
|
||||
#include "UnitTest++/UnitTestPP.h"
|
||||
|
||||
#include "../ReportAssert.h"
|
||||
#include "../ReportAssertImpl.h"
|
||||
#include "../AssertException.h"
|
||||
#include "UnitTest++/ReportAssert.h"
|
||||
#include "UnitTest++/ReportAssertImpl.h"
|
||||
#include "UnitTest++/AssertException.h"
|
||||
|
||||
#include "RecordingReporter.h"
|
||||
#include <csetjmp>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include "../../unittestpp.h"
|
||||
#include "../CurrentTest.h"
|
||||
#include "UnitTest++/UnitTestPP.h"
|
||||
#include "UnitTest++/CurrentTest.h"
|
||||
#include "RecordingReporter.h"
|
||||
#include "ScopedCurrentTest.h"
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "../../unittestpp.h"
|
||||
#include "UnitTest++/UnitTestPP.h"
|
||||
#include "RecordingReporter.h"
|
||||
|
||||
#include <cstring>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include "../../unittestpp.h"
|
||||
#include "../CompositeTestReporter.h"
|
||||
#include "UnitTest++/UnitTestPP.h"
|
||||
#include "UnitTest++/CompositeTestReporter.h"
|
||||
|
||||
using namespace UnitTest;
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include "../../unittestpp.h"
|
||||
#include "../CurrentTest.h"
|
||||
#include "UnitTest++/UnitTestPP.h"
|
||||
#include "UnitTest++/CurrentTest.h"
|
||||
#include "ScopedCurrentTest.h"
|
||||
|
||||
namespace
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
#include "../../config.h"
|
||||
#include "UnitTest++/Config.h"
|
||||
|
||||
#ifndef UNITTEST_NO_DEFERRED_REPORTER
|
||||
|
||||
#include "../../unittestpp.h"
|
||||
#include "../DeferredTestReporter.h"
|
||||
#include "UnitTest++/UnitTestPP.h"
|
||||
#include "UnitTest++/DeferredTestReporter.h"
|
||||
#include <cstring>
|
||||
|
||||
namespace UnitTest
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
#include "../../config.h"
|
||||
#include "UnitTest++/Config.h"
|
||||
#ifndef UNITTEST_NO_EXCEPTIONS
|
||||
|
||||
#include "../../unittestpp.h"
|
||||
#include "../CurrentTest.h"
|
||||
#include "UnitTest++/UnitTestPP.h"
|
||||
#include "UnitTest++/CurrentTest.h"
|
||||
#include "RecordingReporter.h"
|
||||
#include "ScopedCurrentTest.h"
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#include "../../unittestpp.h"
|
||||
#include "UnitTest++/UnitTestPP.h"
|
||||
|
||||
#include "../MemoryOutStream.h"
|
||||
#include "UnitTest++/MemoryOutStream.h"
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include <climits>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#include "../../unittestpp.h"
|
||||
#include "../TestReporter.h"
|
||||
#include "../TimeHelpers.h"
|
||||
#include "UnitTest++/UnitTestPP.h"
|
||||
#include "UnitTest++/TestReporter.h"
|
||||
#include "UnitTest++/TimeHelpers.h"
|
||||
#include "ScopedCurrentTest.h"
|
||||
|
||||
using namespace UnitTest;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include "../../unittestpp.h"
|
||||
#include "../TestList.h"
|
||||
#include "UnitTest++/UnitTestPP.h"
|
||||
#include "UnitTest++/TestList.h"
|
||||
|
||||
using namespace UnitTest;
|
||||
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
#include "../../unittestpp.h"
|
||||
#include "../TestMacros.h"
|
||||
#include "../TestList.h"
|
||||
#include "../TestResults.h"
|
||||
#include "../TestReporter.h"
|
||||
#include "../ReportAssert.h"
|
||||
#include "UnitTest++/UnitTestPP.h"
|
||||
#include "UnitTest++/TestMacros.h"
|
||||
#include "UnitTest++/TestList.h"
|
||||
#include "UnitTest++/TestResults.h"
|
||||
#include "UnitTest++/TestReporter.h"
|
||||
#include "UnitTest++/ReportAssert.h"
|
||||
#include "RecordingReporter.h"
|
||||
#include "ScopedCurrentTest.h"
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include "../../unittestpp.h"
|
||||
#include "../TestResults.h"
|
||||
#include "UnitTest++/UnitTestPP.h"
|
||||
#include "UnitTest++/TestResults.h"
|
||||
#include "RecordingReporter.h"
|
||||
|
||||
using namespace UnitTest;
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
#include "../../unittestpp.h"
|
||||
#include "UnitTest++/UnitTestPP.h"
|
||||
#include "RecordingReporter.h"
|
||||
#include "../ReportAssert.h"
|
||||
#include "../TestList.h"
|
||||
#include "../TimeHelpers.h"
|
||||
#include "../TimeConstraint.h"
|
||||
#include "../ReportAssertImpl.h"
|
||||
#include "UnitTest++/ReportAssert.h"
|
||||
#include "UnitTest++/TestList.h"
|
||||
#include "UnitTest++/TimeHelpers.h"
|
||||
#include "UnitTest++/TimeConstraint.h"
|
||||
#include "UnitTest++/ReportAssertImpl.h"
|
||||
|
||||
using namespace UnitTest;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "../../unittestpp.h"
|
||||
#include "UnitTest++/UnitTestPP.h"
|
||||
|
||||
// We're really testing if it's possible to use the same suite in two files
|
||||
// to compile and link successfuly (TestTestSuite.cpp has suite with the same name)
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#include "../../unittestpp.h"
|
||||
#include "../TestResults.h"
|
||||
#include "../TimeHelpers.h"
|
||||
#include "UnitTest++/UnitTestPP.h"
|
||||
#include "UnitTest++/TestResults.h"
|
||||
#include "UnitTest++/TimeHelpers.h"
|
||||
#include "RecordingReporter.h"
|
||||
#include "ScopedCurrentTest.h"
|
||||
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include "../../unittestpp.h"
|
||||
#include "../TimeHelpers.h"
|
||||
#include "UnitTest++/UnitTestPP.h"
|
||||
#include "UnitTest++/TimeHelpers.h"
|
||||
|
||||
#include "RecordingReporter.h"
|
||||
#include "ScopedCurrentTest.h"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "../../unittestpp.h"
|
||||
#include "UnitTest++/UnitTestPP.h"
|
||||
#include "ScopedCurrentTest.h"
|
||||
|
||||
// These are sample tests that show the different features of the framework
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
#include "../../config.h"
|
||||
#include "UnitTest++/Config.h"
|
||||
#ifndef UNITTEST_NO_DEFERRED_REPORTER
|
||||
|
||||
#include "../../unittestpp.h"
|
||||
#include "../XmlTestReporter.h"
|
||||
#include "UnitTest++/UnitTestPP.h"
|
||||
#include "UnitTest++/XmlTestReporter.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
11
unittestpp.h
11
unittestpp.h
|
|
@ -1,11 +0,0 @@
|
|||
#ifndef UNITTESTPP_H
|
||||
#define UNITTESTPP_H
|
||||
|
||||
#include "config.h"
|
||||
#include "src/TestMacros.h"
|
||||
#include "src/CheckMacros.h"
|
||||
#include "src/TestRunner.h"
|
||||
#include "src/TimeConstraint.h"
|
||||
#include "src/ReportAssert.h"
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue