diff options
Diffstat (limited to '3rdParty/CppUnit/src/include')
31 files changed, 508 insertions, 421 deletions
diff --git a/3rdParty/CppUnit/src/include/cppunit/Asserter.h b/3rdParty/CppUnit/src/include/cppunit/Asserter.h index 94dadaa..3321b87 100644 --- a/3rdParty/CppUnit/src/include/cppunit/Asserter.h +++ b/3rdParty/CppUnit/src/include/cppunit/Asserter.h @@ -42,17 +42,24 @@ class Message; * CPPUNIT_SOURCELINE() ) * \endcode */ + +#if defined __GNUC__ +# define NORETURN __attribute__((noreturn)) +#else +# define NORETURN +#endif + struct Asserter { /*! \brief Throws a Exception with the specified message and location. */ - static void CPPUNIT_API fail( const Message &message, + NORETURN static void CPPUNIT_API fail( const Message &message, const SourceLine &sourceLine = SourceLine() ); /*! \brief Throws a Exception with the specified message and location. * \deprecated Use fail( Message, SourceLine ) instead. */ - static void CPPUNIT_API fail( std::string message, + NORETURN static void CPPUNIT_API fail( std::string message, const SourceLine &sourceLine = SourceLine() ); /*! \brief Throws a Exception with the specified message and location. @@ -76,16 +83,55 @@ struct Asserter std::string message, const SourceLine &sourceLine = SourceLine() ); - /*! \brief Returns a expected value string for a message. + /*! \brief Returns a expected value string for a message, case equal than * Typically used to create 'not equal' message, or to check that a message * contains the expected content when writing unit tests for your custom * assertions. * * \param expectedValue String that represents the expected value. * \return \a expectedValue prefixed with "Expected: ". + * \deprecated Use makeExpectedEqual instead * \see makeActual(). */ static std::string CPPUNIT_API makeExpected( const std::string &expectedValue ); + /*! \brief Returns a expected value string for a message, case equal than + * Typically used to create 'not equal' message, or to check that a message + * contains the expected content when writing unit tests for your custom + * assertions. + * + * \param expectedValue String that represents the expected value. + * \return \a expectedValue prefixed with "Expected: ". + * \see makeActual(). + */ + static std::string CPPUNIT_API makeExpectedEqual( const std::string &expectedValue ); + /*! \brief Returns a expected value string for a message, case less than. + * + * \param expectedValue String that represents the expected value. + * \return \a expectedValue prefixed with "Expected less than: ". + * \see makeExpectedEqual(). + */ + static std::string CPPUNIT_API makeExpectedLess( const std::string &expectedValue ); + /*! \brief Returns a expected value string for a message, case less or equal than. + * + * \param expectedValue String that represents the expected value. + * \return \a expectedValue prefixed with "Expected: ". + * \see makeExpectedEqual(). + */ + static std::string CPPUNIT_API makeExpectedLessEqual( const std::string &expectedValue ); + /*! \brief Returns a expected value string for a message, case greater than. + * + * \param expectedValue String that represents the expected value. + * \return \a expectedValue prefixed with "Expected: ". + * \see makeExpectedEqual(). + */ + static std::string CPPUNIT_API makeExpectedGreater( const std::string &expectedValue ); + /*! \brief Returns a expected value string for a message, greater or equal than. + * + * \param expectedValue String that represents the expected value. + * \return \a expectedValue prefixed with "Expected: ". + * \see makeExpectedEqual(). + */ + static std::string CPPUNIT_API makeExpectedGreaterEqual( const std::string &expectedValue ); /*! \brief Returns an actual value string for a message. * Typically used to create 'not equal' message, or to check that a message @@ -98,11 +144,19 @@ struct Asserter */ static std::string CPPUNIT_API makeActual( const std::string &actualValue ); + /*! + * \deprecated Use makeMessage instead + */ static Message CPPUNIT_API makeNotEqualMessage( const std::string &expectedValue, const std::string &actualValue, const AdditionalMessage &additionalMessage = AdditionalMessage(), const std::string &shortDescription = "equality assertion failed"); + static Message CPPUNIT_API makeMessage( const std::string &expectedValue, + const std::string &actualValue, + const std::string &shortDescription, + const AdditionalMessage &additionalMessage = AdditionalMessage()); + /*! \brief Throws an Exception with the specified message and location. * \param expected Text describing the expected value. * \param actual Text describing the actual value. @@ -111,13 +165,68 @@ struct Asserter * what are the differences between the expected and actual value. * \param shortDescription Short description for the failure message. */ - static void CPPUNIT_API failNotEqual( std::string expected, + NORETURN static void CPPUNIT_API failNotEqual( std::string expected, std::string actual, const SourceLine &sourceLine, const AdditionalMessage &additionalMessage = AdditionalMessage(), std::string shortDescription = "equality assertion failed" ); /*! \brief Throws an Exception with the specified message and location. + * \param expected Text describing the expected value. + * \param actual Text describing the actual value. + * \param sourceLine Location of the assertion. + * \param additionalMessage Additional message. Usually used to report + * what are the differences between the expected and actual value. + * \param shortDescription Short description for the failure message. + */ + static void CPPUNIT_API failNotLess( std::string expected, + std::string actual, + const SourceLine &sourceLine, + const AdditionalMessage &additionalMessage = AdditionalMessage(), + std::string shortDescription = "less assertion failed" ); + + /*! \brief Throws an Exception with the specified message and location. + * \param expected Text describing the expected value. + * \param actual Text describing the actual value. + * \param sourceLine Location of the assertion. + * \param additionalMessage Additional message. Usually used to report + * what are the differences between the expected and actual value. + * \param shortDescription Short description for the failure message. + */ + static void CPPUNIT_API failNotGreater( std::string expected, + std::string actual, + const SourceLine &sourceLine, + const AdditionalMessage &additionalMessage = AdditionalMessage(), + std::string shortDescription = "greater assertion failed" ); + + /*! \brief Throws an Exception with the specified message and location. + * \param expected Text describing the expected value. + * \param actual Text describing the actual value. + * \param sourceLine Location of the assertion. + * \param additionalMessage Additional message. Usually used to report + * what are the differences between the expected and actual value. + * \param shortDescription Short description for the failure message. + */ + static void CPPUNIT_API failNotLessEqual( std::string expected, + std::string actual, + const SourceLine &sourceLine, + const AdditionalMessage &additionalMessage = AdditionalMessage(), + std::string shortDescription = "less equal assertion failed" ); + + /*! \brief Throws an Exception with the specified message and location. + * \param expected Text describing the expected value. + * \param actual Text describing the actual value. + * \param sourceLine Location of the assertion. + * \param additionalMessage Additional message. Usually used to report + * what are the differences between the expected and actual value. + * \param shortDescription Short description for the failure message. + */ + static void CPPUNIT_API failNotGreaterEqual( std::string expected, + std::string actual, + const SourceLine &sourceLine, + const AdditionalMessage &additionalMessage = AdditionalMessage(), + std::string shortDescription = "greater equal assertion failed" ); /*! \brief Throws an Exception with the specified message and location. + * \param shouldFail if \c true then the exception is thrown. Otherwise * nothing happen. * \param expected Text describing the expected value. diff --git a/3rdParty/CppUnit/src/include/cppunit/Message.h b/3rdParty/CppUnit/src/include/cppunit/Message.h index 1ae51cc..c3d8d92 100644 --- a/3rdParty/CppUnit/src/include/cppunit/Message.h +++ b/3rdParty/CppUnit/src/include/cppunit/Message.h @@ -8,17 +8,13 @@ #pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z #endif -#include <cppunit/portability/CppUnitDeque.h> +#include <deque> #include <string> CPPUNIT_NS_BEGIN -#if CPPUNIT_NEED_DLL_DECL -// template class CPPUNIT_API std::deque<std::string>; -#endif - /*! \brief Message associated to an Exception. * \ingroup CreatingNewAssertions * A message is composed of two items: @@ -38,7 +34,7 @@ CPPUNIT_NS_BEGIN class CPPUNIT_API Message { public: - Message(); + Message() {}; // Ensure thread-safe copy by detaching the string. Message( const Message &other ); @@ -57,6 +53,8 @@ public: const std::string &detail2, const std::string &detail3 ); + virtual ~Message(); + Message &operator =( const Message &other ); /*! \brief Returns the short description. @@ -141,7 +139,7 @@ public: private: std::string m_shortDescription; - typedef CppUnitDeque<std::string> Details; + typedef std::deque<std::string> Details; Details m_details; }; diff --git a/3rdParty/CppUnit/src/include/cppunit/Portability.h b/3rdParty/CppUnit/src/include/cppunit/Portability.h index ddf0316..d7c4c11 100644 --- a/3rdParty/CppUnit/src/include/cppunit/Portability.h +++ b/3rdParty/CppUnit/src/include/cppunit/Portability.h @@ -20,7 +20,7 @@ // Version number of package #ifndef CPPUNIT_VERSION -#define CPPUNIT_VERSION "1.12.0" +#define CPPUNIT_VERSION "1.14.0" #endif #include <cppunit/config/CppUnitApi.h> // define CPPUNIT_API & CPPUNIT_NEED_DLL_DECL @@ -61,20 +61,6 @@ # endif // !defined(CPPUNIT_NO_STD_NAMESPACE) #endif // !defined(CPPUNIT_HAVE_NAMESPACES) -/* Define CPPUNIT_STD_NEED_ALLOCATOR to 1 if you need to specify - * the allocator you used when instantiating STL container. Typically - * used for compilers that do not support template default parameter. - * CPPUNIT_STD_ALLOCATOR will be used as the allocator. Default is - * std::allocator. On some compilers, you may need to change this to - * std::allocator<T>. - */ -#if CPPUNIT_STD_NEED_ALLOCATOR -# if !defined(CPPUNIT_STD_ALLOCATOR) -# define CPPUNIT_STD_ALLOCATOR std::allocator -# endif // !defined(CPPUNIT_STD_ALLOCATOR) -#endif // defined(CPPUNIT_STD_NEED_ALLOCATOR) - - // Compiler error location format for CompilerOutputter // If not define, assumes that it's gcc // See class CompilerOutputter for format. @@ -162,11 +148,17 @@ /// \internal #define _CPPUNIT_DO_JOIN2( symbol1, symbol2 ) symbol1##symbol2 +/// \internal Unique suffix for variable name. Can be overridden in platform specific +/// config-*.h. Default to line number. +#ifndef CPPUNIT_UNIQUE_COUNTER +# define CPPUNIT_UNIQUE_COUNTER __LINE__ +#endif + /*! Adds the line number to the specified string to create a unique identifier. * \param prefix Prefix added to the line number to create a unique identifier. * \see CPPUNIT_TEST_SUITE_REGISTRATION for an example of usage. */ -#define CPPUNIT_MAKE_UNIQUE_NAME( prefix ) CPPUNIT_JOIN( prefix, __LINE__ ) +#define CPPUNIT_MAKE_UNIQUE_NAME( prefix ) CPPUNIT_JOIN( prefix, CPPUNIT_UNIQUE_COUNTER ) /*! Defines wrap colunm for %CppUnit. Used by CompilerOuputter. */ diff --git a/3rdParty/CppUnit/src/include/cppunit/Protector.h b/3rdParty/CppUnit/src/include/cppunit/Protector.h index d14e75f..c6d2e7c 100644 --- a/3rdParty/CppUnit/src/include/cppunit/Protector.h +++ b/3rdParty/CppUnit/src/include/cppunit/Protector.h @@ -84,6 +84,8 @@ public: ~ProtectorGuard(); private: + ProtectorGuard( const ProtectorGuard& ); /* not copyable */ + ProtectorGuard& operator=( const ProtectorGuard& ); /* not assignable */ TestResult *m_result; }; diff --git a/3rdParty/CppUnit/src/include/cppunit/SynchronizedObject.h b/3rdParty/CppUnit/src/include/cppunit/SynchronizedObject.h index 0f7d094..59c3cbb 100644 --- a/3rdParty/CppUnit/src/include/cppunit/SynchronizedObject.h +++ b/3rdParty/CppUnit/src/include/cppunit/SynchronizedObject.h @@ -50,15 +50,21 @@ protected: public: ExclusiveZone( SynchronizationObject *syncObject ) - : m_syncObject( syncObject ) + : m_syncObject( syncObject ) { - m_syncObject->lock(); + m_syncObject->lock(); } ~ExclusiveZone() { - m_syncObject->unlock (); + m_syncObject->unlock (); } + private: + /// Prevents the use of the copy constructor. + ExclusiveZone( const ExclusiveZone& ); + + /// Prevents the use of the copy operator. + ExclusiveZone& operator=( const ExclusiveZone& ); }; virtual void setSynchronizationObject( SynchronizationObject *syncObject ); diff --git a/3rdParty/CppUnit/src/include/cppunit/TestAssert.h b/3rdParty/CppUnit/src/include/cppunit/TestAssert.h index f74797b..bb29ac0 100644 --- a/3rdParty/CppUnit/src/include/cppunit/TestAssert.h +++ b/3rdParty/CppUnit/src/include/cppunit/TestAssert.h @@ -5,14 +5,20 @@ #include <cppunit/Exception.h> #include <cppunit/Asserter.h> #include <cppunit/portability/Stream.h> +#include <cppunit/tools/StringHelper.h> #include <stdio.h> #include <float.h> // For struct assertion_traits<double> +// Work around "passing 'T' chooses 'int' over 'unsigned int'" warnings when T +// is an enum type: +#if defined __GNUC__ && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)) +#pragma GCC system_header +#endif -CPPUNIT_NS_BEGIN +CPPUNIT_NS_BEGIN -/*! \brief Traits used by CPPUNIT_ASSERT_EQUAL(). +/*! \brief Traits used by CPPUNIT_ASSERT* macros. * * Here is an example of specialising these traits: * @@ -24,7 +30,17 @@ CPPUNIT_NS_BEGIN * { * return x == y; * } - * + * + * static bool less( const std::string& x, const std::string& y ) + * { + * return x < y; + * } + * + * static bool lessEqual( const std::string& x, const std::string& y ) + * { + * return x <= y; + * } + * * static std::string toString( const std::string& x ) * { * std::string text = '"' + x + '"'; // adds quote around the string to see whitespace @@ -43,15 +59,22 @@ struct assertion_traits return x == y; } + static bool less( const T& x, const T& y ) + { + return x < y; + } + + static bool lessEqual( const T& x, const T& y ) + { + return x <= y; + } + static std::string toString( const T& x ) { - OStringStream ost; - ost << x; - return ost.str(); + return CPPUNIT_NS::StringHelper::toString(x); } }; - /*! \brief Traits used by CPPUNIT_ASSERT_DOUBLES_EQUAL(). * * This specialisation from @c struct @c assertion_traits<> ensures that @@ -68,6 +91,16 @@ struct assertion_traits<double> return x == y; } + static bool less( double x, double y ) + { + return x < y; + } + + static bool lessEqual( double x, double y ) + { + return x <= y; + } + static std::string toString( double x ) { #ifdef DBL_DIG @@ -118,6 +151,82 @@ void CPPUNIT_API assertDoubleEquals( double expected, const std::string &message ); +/*! \brief (Implementation) Asserts that an object is less than another one of the same type + * Use CPPUNIT_ASSERT_LESS, CPPUNIT_ASSERT_GREATER instead of this function. + * \sa assertion_traits, Asserter::failNotLess(). + */ +template <class T> +void assertLess( const T& expected, + const T& actual, + SourceLine sourceLine, + const std::string& message ) +{ + if ( !assertion_traits<T>::less(actual,expected) ) + { + Asserter::failNotLess( assertion_traits<T>::toString(expected), + assertion_traits<T>::toString(actual), + sourceLine, + message ); + } +} + + +/*! \brief (Implementation) Asserts that an object is less than another one of the same type + * Use CPPUNIT_ASSERT_LESS, CPPUNIT_ASSERT_GREATER instead of this function. + * \sa assertion_traits, Asserter::failNotLess(). + */ +template <class T> +void assertGreater( const T& expected, + const T& actual, + SourceLine sourceLine, + const std::string& message ) +{ + if ( !assertion_traits<T>::less(expected,actual) ) + { + Asserter::failNotGreater( assertion_traits<T>::toString(expected), + assertion_traits<T>::toString(actual), + sourceLine, + message ); + } +} + +/*! \brief (Implementation) Asserts that two objects of the same type are equals. + * Use CPPUNIT_ASSERT_LESSEQUAL, CPPUNIT_ASSERT_GREATEREQUAL instead of this function. + * \sa assertion_traits, Asserter::failNotLessEqual(). + */ +template <class T> +void assertLessEqual( const T& expected, + const T& actual, + SourceLine sourceLine, + const std::string& message ) +{ + if ( !assertion_traits<T>::lessEqual(actual,expected) ) + { + Asserter::failNotLessEqual( assertion_traits<T>::toString(expected), + assertion_traits<T>::toString(actual), + sourceLine, + message ); + } +} + +/*! \brief (Implementation) Asserts that two objects of the same type are equals. + * Use CPPUNIT_ASSERT_LESSEQUAL, CPPUNIT_ASSERT_GREATEREQUAL instead of this function. + * \sa assertion_traits, Asserter::failNotLessEqual(). + */ +template <class T> +void assertGreaterEqual( const T& expected, + const T& actual, + SourceLine sourceLine, + const std::string& message ) +{ + if ( !assertion_traits<T>::lessEqual(expected,actual) ) + { + Asserter::failNotGreaterEqual( assertion_traits<T>::toString(expected), + assertion_traits<T>::toString(actual), + sourceLine, + message ); + } +} /* A set of macros which allow us to get the line number * and file name at the point of an error. * Just goes to show that preprocessors do have some @@ -217,6 +326,109 @@ void CPPUNIT_API assertDoubleEquals( double expected, (message) ) ) #endif +/** Asserts that actual is less than expected, provides additional message on failure. + * \ingroup Assertions + * + * Less and string representation can be defined with + * an appropriate assertion_traits class. + * + * A diagnostic is printed if actual is less than expected. + * The message is printed in addition to the expected and actual value + * to provide additional information. + * + * Requirement for \a expected and \a actual parameters: + * - They are exactly of the same type + * - They are serializable into a std::strstream using operator <<. + * - They can be compared using operator <. + * + * The last two requirements (serialization and comparison) can be + * removed by specializing the CppUnit::assertion_traits. + * + * \sa CPPUNIT_ASSERT_GREATER + */ +#define CPPUNIT_ASSERT_LESS(expected, actual) \ + ( CPPUNIT_NS::assertLess( (expected), \ + (actual), \ + CPPUNIT_SOURCELINE(), \ + "" ) ) + +/** Asserts that actual is greater than expected, provides additional message on failure. + * \ingroup Assertions + * + * String representation can be defined with + * an appropriate assertion_traits class. For comparison assertLess is used. + * + * A diagnostic is printed if actual is less than expected. + * The message is printed in addition to the expected and actual value + * to provide additional information. + * + * Requirement for \a expected and \a actual parameters: + * - They are exactly of the same type + * - They are serializable into a std::strstream using operator <<. + * - They can be compared using operator<. + * + * The last two requirements (serialization and comparison) can be + * removed by specializing the CppUnit::assertion_traits. + * + * \sa CPPUNIT_ASSERT_LESS + */ +#define CPPUNIT_ASSERT_GREATER(expected, actual) \ + ( CPPUNIT_NS::assertGreater( (expected), \ + (actual), \ + CPPUNIT_SOURCELINE(), \ + "" ) ) + +/** Asserts that actual is less or equal than expected, provides additional message on failure. + * \ingroup Assertions + * + * LessEqual and string representation can be defined with + * an appropriate assertion_traits class. + * + * A diagnostic is printed if actual is greater than expected. + * The message is printed in addition to the expected and actual value + * to provide additional information. + * + * Requirement for \a expected and \a actual parameters: + * - They are exactly of the same type + * - They are serializable into a std::strstream using operator <<. + * - They can be compared using operator <=. + * + * The last two requirements (serialization and comparison) can be + * removed by specializing the CppUnit::assertion_traits. + * + * \sa CPPUNIT_ASSERT_GREATEREQUAL + */ +#define CPPUNIT_ASSERT_LESSEQUAL(expected, actual) \ + ( CPPUNIT_NS::assertLessEqual( (expected), \ + (actual), \ + CPPUNIT_SOURCELINE(), \ + "" ) ) + +/** Asserts that actual is greater than expected, provides additional message on failure. + * \ingroup Assertions + * + * String representation can be defined with + * an appropriate assertion_traits class. For comparison assertLess is used. + * + * A diagnostic is printed if actual is less than expected. + * The message is printed in addition to the expected and actual value + * to provide additional information. + * + * Requirement for \a expected and \a actual parameters: + * - They are exactly of the same type + * - They are serializable into a std::strstream using operator <<. + * - They can be compared using operator<=. + * + * The last two requirements (serialization and comparison) can be + * removed by specializing the CppUnit::assertion_traits. + * + * \sa CPPUNIT_ASSERT_LESSEQUAL + */ +#define CPPUNIT_ASSERT_GREATEREQUAL(expected, actual) \ + ( CPPUNIT_NS::assertGreaterEqual( (expected), \ + (actual), \ + CPPUNIT_SOURCELINE(), \ + "" ) ) /*! \brief Macro for primitive double value comparisons. * \ingroup Assertions * @@ -263,7 +475,7 @@ void CPPUNIT_API assertDoubleEquals( double expected, // implementation detail -#if CPPUNIT_USE_TYPEINFO_NAME +#if defined(CPPUNIT_USE_TYPEINFO_NAME) #define CPPUNIT_EXTRACT_EXCEPTION_TYPE_( exception, no_rtti_message ) \ CPPUNIT_NS::TypeInfoHelper::getClassName( typeid(exception) ) #else diff --git a/3rdParty/CppUnit/src/include/cppunit/TestCaller.h b/3rdParty/CppUnit/src/include/cppunit/TestCaller.h index dc4d82e..fbf3902 100644 --- a/3rdParty/CppUnit/src/include/cppunit/TestCaller.h +++ b/3rdParty/CppUnit/src/include/cppunit/TestCaller.h @@ -4,8 +4,10 @@ #include <cppunit/Exception.h> #include <cppunit/TestCase.h> +#include <functional> -#if CPPUNIT_USE_TYPEINFO_NAME + +#if defined(CPPUNIT_USE_TYPEINFO_NAME) # include <cppunit/extensions/TypeInfoHelper.h> #endif @@ -33,7 +35,7 @@ struct ExpectedExceptionTraits { static void expectedException() { -#if CPPUNIT_USE_TYPEINFO_NAME +#if defined(CPPUNIT_USE_TYPEINFO_NAME) throw Exception( Message( "expected exception not thrown", "Expected exception type: " + @@ -116,7 +118,7 @@ public: TestCase( name ), m_ownFixture( true ), m_fixture( new Fixture() ), - m_test( test ) + m_test_function( std::bind(test, m_fixture) ) { } @@ -133,7 +135,7 @@ public: TestCase( name ), m_ownFixture( false ), m_fixture( &fixture ), - m_test( test ) + m_test_function( std::bind(test, &fixture) ) { } @@ -150,9 +152,17 @@ public: TestCase( name ), m_ownFixture( true ), m_fixture( fixture ), - m_test( test ) + m_test_function( std::bind(test, fixture) ) { } + + TestCaller(std::string name, std::function<void()> test_function, Fixture* fixture): + TestCase(name), + m_ownFixture(true), + m_fixture(fixture), + m_test_function(test_function) + { + } ~TestCaller() { @@ -162,14 +172,7 @@ public: void runTest() { -// try { - (m_fixture->*m_test)(); -// } -// catch ( ExpectedException & ) { -// return; -// } - -// ExpectedExceptionTraits<ExpectedException>::expectedException(); + m_test_function(); } void setUp() @@ -194,7 +197,7 @@ private: private: bool m_ownFixture; Fixture *m_fixture; - TestMethod m_test; + std::function<void()> m_test_function; }; diff --git a/3rdParty/CppUnit/src/include/cppunit/TestPath.h b/3rdParty/CppUnit/src/include/cppunit/TestPath.h index c3c851c..8934479 100644 --- a/3rdParty/CppUnit/src/include/cppunit/TestPath.h +++ b/3rdParty/CppUnit/src/include/cppunit/TestPath.h @@ -8,7 +8,7 @@ #pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z #endif -#include <cppunit/portability/CppUnitDeque.h> +#include <deque> #include <string> CPPUNIT_NS_BEGIN @@ -16,11 +16,6 @@ CPPUNIT_NS_BEGIN class Test; -#if CPPUNIT_NEED_DLL_DECL -// template class CPPUNIT_API std::deque<Test *>; -#endif - - /*! \brief A List of Test representing a path to access a Test. * \ingroup ExecutingTest * @@ -174,7 +169,7 @@ protected: void checkIndexValid( int index ) const; /// A list of test names. - typedef CppUnitDeque<std::string> PathTestNames; + typedef std::deque<std::string> PathTestNames; /*! \brief Splits a path string into its test name components. * \param pathAsString Path string created with toString(). @@ -199,7 +194,7 @@ protected: PathTestNames &testNames ); protected: - typedef CppUnitDeque<Test *> Tests; + typedef std::deque<Test *> Tests; Tests m_tests; }; diff --git a/3rdParty/CppUnit/src/include/cppunit/TestResult.h b/3rdParty/CppUnit/src/include/cppunit/TestResult.h index e7e1050..aabd80b 100644 --- a/3rdParty/CppUnit/src/include/cppunit/TestResult.h +++ b/3rdParty/CppUnit/src/include/cppunit/TestResult.h @@ -9,7 +9,7 @@ #endif #include <cppunit/SynchronizedObject.h> -#include <cppunit/portability/CppUnitDeque.h> +#include <deque> #include <string> CPPUNIT_NS_BEGIN @@ -24,10 +24,6 @@ class TestFailure; class TestListener; -#if CPPUNIT_NEED_DLL_DECL -// template class CPPUNIT_API std::deque<TestListener *>; -#endif - /*! \brief Manages TestListener. * \ingroup TrackingTestExecution * @@ -133,7 +129,7 @@ protected: virtual void endTestRun( Test *test ); protected: - typedef CppUnitDeque<TestListener *> TestListeners; + typedef std::deque<TestListener *> TestListeners; TestListeners m_listeners; ProtectorChain *m_protectorChain; bool m_stop; diff --git a/3rdParty/CppUnit/src/include/cppunit/TestResultCollector.h b/3rdParty/CppUnit/src/include/cppunit/TestResultCollector.h index 01b0a54..b78c978 100644 --- a/3rdParty/CppUnit/src/include/cppunit/TestResultCollector.h +++ b/3rdParty/CppUnit/src/include/cppunit/TestResultCollector.h @@ -9,16 +9,11 @@ #endif #include <cppunit/TestSuccessListener.h> -#include <cppunit/portability/CppUnitDeque.h> +#include <deque> CPPUNIT_NS_BEGIN -#if CPPUNIT_NEED_DLL_DECL -// template class CPPUNIT_API std::deque<TestFailure *>; -// template class CPPUNIT_API std::deque<Test *>; -#endif - /*! \brief Collects test result. * \ingroup WritingTestResult @@ -36,8 +31,8 @@ CPPUNIT_NS_BEGIN class CPPUNIT_API TestResultCollector : public TestSuccessListener { public: - typedef CppUnitDeque<TestFailure *> TestFailures; - typedef CppUnitDeque<Test *> Tests; + typedef std::deque<TestFailure *> TestFailures; + typedef std::deque<Test *> Tests; /*! Constructs a TestResultCollector object. diff --git a/3rdParty/CppUnit/src/include/cppunit/TestSuite.h b/3rdParty/CppUnit/src/include/cppunit/TestSuite.h index 2b9cd8d..63c0a6b 100644 --- a/3rdParty/CppUnit/src/include/cppunit/TestSuite.h +++ b/3rdParty/CppUnit/src/include/cppunit/TestSuite.h @@ -9,7 +9,7 @@ #endif #include <cppunit/TestComposite.h> -#include <cppunit/portability/CppUnitVector.h> +#include <vector> CPPUNIT_NS_BEGIN @@ -56,7 +56,7 @@ public: * TestComposite interface instead. * \return Reference on a vector that contains the tests of the suite. */ - const CppUnitVector<Test *> &getTests() const; + const std::vector<Test *> &getTests() const; /*! Destroys all the tests of the suite. */ @@ -67,7 +67,7 @@ public: Test *doGetChildTestAt( int index ) const; private: - CppUnitVector<Test *> m_tests; + std::vector<Test *> m_tests; }; diff --git a/3rdParty/CppUnit/src/include/cppunit/TextTestResult.h b/3rdParty/CppUnit/src/include/cppunit/TextTestResult.h index e7b1fa3..63937b0 100644 --- a/3rdParty/CppUnit/src/include/cppunit/TextTestResult.h +++ b/3rdParty/CppUnit/src/include/cppunit/TextTestResult.h @@ -26,6 +26,8 @@ public: virtual void addFailure( const TestFailure &failure ); virtual void startTest( Test *test ); virtual void print( OStream &stream ); + + using TestResult::addFailure; }; /** insertion operator for easy output */ diff --git a/3rdParty/CppUnit/src/include/cppunit/XmlOutputter.h b/3rdParty/CppUnit/src/include/cppunit/XmlOutputter.h index 0de9676..2bf9411 100644 --- a/3rdParty/CppUnit/src/include/cppunit/XmlOutputter.h +++ b/3rdParty/CppUnit/src/include/cppunit/XmlOutputter.h @@ -9,8 +9,8 @@ #endif #include <cppunit/Outputter.h> -#include <cppunit/portability/CppUnitDeque.h> -#include <cppunit/portability/CppUnitMap.h> +#include <deque> +#include <map> #include <cppunit/portability/Stream.h> @@ -46,7 +46,7 @@ public: */ XmlOutputter( TestResultCollector *result, OStream &stream, - std::string encoding = std::string("ISO-8859-1") ); + const std::string& encoding = std::string("ISO-8859-1") ); /// Destructor. virtual ~XmlOutputter(); @@ -85,7 +85,7 @@ public: */ virtual void setStandalone( bool standalone ); - typedef CppUnitMap<Test *,TestFailure*, std::less<Test*> > FailedTests; + typedef std::map<Test *,TestFailure*, std::less<Test*> > FailedTests; /*! \brief Sets the root element and adds its children. * @@ -137,7 +137,7 @@ protected: virtual void fillFailedTestsMap( FailedTests &failedTests ); protected: - typedef CppUnitDeque<XmlOutputterHook *> Hooks; + typedef std::deque<XmlOutputterHook *> Hooks; TestResultCollector *m_result; OStream &m_stream; diff --git a/3rdParty/CppUnit/src/include/cppunit/config-auto.h b/3rdParty/CppUnit/src/include/cppunit/config-auto.h deleted file mode 100644 index 58b3d6e..0000000 --- a/3rdParty/CppUnit/src/include/cppunit/config-auto.h +++ /dev/null @@ -1,161 +0,0 @@ -#ifndef _INCLUDE_CPPUNIT_CONFIG_AUTO_H -#define _INCLUDE_CPPUNIT_CONFIG_AUTO_H 1 - -/* include/cppunit/config-auto.h. Generated automatically at end of configure. */ -/* config/config.h. Generated by configure. */ -/* config/config.h.in. Generated from configure.in by autoheader. */ - -/* define if library uses std::string::compare(string,pos,n) */ -/* #undef CPPUNIT_FUNC_STRING_COMPARE_STRING_FIRST */ - - -#define CPPUNIT_HAVE_CPP_CAST - -/* define if the library defines strstream */ -#ifndef CPPUNIT_HAVE_CLASS_STRSTREAM -#define CPPUNIT_HAVE_CLASS_STRSTREAM 1 -#endif - -/* Define to 1 if you have the <cmath> header file. */ -#ifndef CPPUNIT_HAVE_CMATH -#define CPPUNIT_HAVE_CMATH 1 -#endif - -/* Define if you have the GNU dld library. */ -/* #undef CPPUNIT_HAVE_DLD */ - -/* Define to 1 if you have the `dlerror' function. */ -#ifndef CPPUNIT_HAVE_DLERROR -#define CPPUNIT_HAVE_DLERROR 1 -#endif - -/* Define to 1 if you have the <dlfcn.h> header file. */ -#ifndef CPPUNIT_HAVE_DLFCN_H -#define CPPUNIT_HAVE_DLFCN_H 1 -#endif - -/* define if the compiler supports GCC C++ ABI name demangling */ -#ifndef CPPUNIT_HAVE_GCC_ABI_DEMANGLE -#define CPPUNIT_HAVE_GCC_ABI_DEMANGLE 1 -#endif - -/* Define to 1 if you have the <inttypes.h> header file. */ -#ifndef CPPUNIT_HAVE_INTTYPES_H -#define CPPUNIT_HAVE_INTTYPES_H 1 -#endif - -/* Define if you have the libdl library or equivalent. */ -#ifndef CPPUNIT_HAVE_LIBDL -#define CPPUNIT_HAVE_LIBDL 1 -#endif - -/* Define to 1 if you have the <memory.h> header file. */ -#ifndef CPPUNIT_HAVE_MEMORY_H -#define CPPUNIT_HAVE_MEMORY_H 1 -#endif - -/* define to 1 if the compiler implements namespaces */ -#ifndef CPPUNIT_HAVE_NAMESPACES -#define CPPUNIT_HAVE_NAMESPACES 1 -#endif - -/* define if the compiler supports Run-Time Type Identification */ -#ifndef CPPUNIT_HAVE_RTTI -#define CPPUNIT_HAVE_RTTI 1 -#endif - -/* Define if you have the shl_load function. */ -/* #undef CPPUNIT_HAVE_SHL_LOAD */ - -/* define if the compiler has stringstream */ -#ifndef CPPUNIT_HAVE_SSTREAM -#define CPPUNIT_HAVE_SSTREAM 1 -#endif - -/* Define to 1 if you have the <stdint.h> header file. */ -#ifndef CPPUNIT_HAVE_STDINT_H -#define CPPUNIT_HAVE_STDINT_H 1 -#endif - -/* Define to 1 if you have the <stdlib.h> header file. */ -#ifndef CPPUNIT_HAVE_STDLIB_H -#define CPPUNIT_HAVE_STDLIB_H 1 -#endif - -/* Define to 1 if you have the <strings.h> header file. */ -#ifndef CPPUNIT_HAVE_STRINGS_H -#define CPPUNIT_HAVE_STRINGS_H 1 -#endif - -/* Define to 1 if you have the <string.h> header file. */ -#ifndef CPPUNIT_HAVE_STRING_H -#define CPPUNIT_HAVE_STRING_H 1 -#endif - -/* Define to 1 if you have the <strstream> header file. */ -#ifndef CPPUNIT_HAVE_STRSTREAM -#define CPPUNIT_HAVE_STRSTREAM 1 -#endif - -/* Define to 1 if you have the <sys/stat.h> header file. */ -#ifndef CPPUNIT_HAVE_SYS_STAT_H -#define CPPUNIT_HAVE_SYS_STAT_H 1 -#endif - -/* Define to 1 if you have the <sys/types.h> header file. */ -#ifndef CPPUNIT_HAVE_SYS_TYPES_H -#define CPPUNIT_HAVE_SYS_TYPES_H 1 -#endif - -/* Define to 1 if you have the <unistd.h> header file. */ -#ifndef CPPUNIT_HAVE_UNISTD_H -#define CPPUNIT_HAVE_UNISTD_H 1 -#endif - -/* Name of package */ -#ifndef CPPUNIT_PACKAGE -#define CPPUNIT_PACKAGE "cppunit" -#endif - -/* Define to the address where bug reports for this package should be sent. */ -#ifndef CPPUNIT_PACKAGE_BUGREPORT -#define CPPUNIT_PACKAGE_BUGREPORT "" -#endif - -/* Define to the full name of this package. */ -#ifndef CPPUNIT_PACKAGE_NAME -#define CPPUNIT_PACKAGE_NAME "" -#endif - -/* Define to the full name and version of this package. */ -#ifndef CPPUNIT_PACKAGE_STRING -#define CPPUNIT_PACKAGE_STRING "" -#endif - -/* Define to the one symbol short name of this package. */ -#ifndef CPPUNIT_PACKAGE_TARNAME -#define CPPUNIT_PACKAGE_TARNAME "" -#endif - -/* Define to the version of this package. */ -#ifndef CPPUNIT_PACKAGE_VERSION -#define CPPUNIT_PACKAGE_VERSION "" -#endif - -/* Define to 1 if you have the ANSI C header files. */ -#ifndef CPPUNIT_STDC_HEADERS -#define CPPUNIT_STDC_HEADERS 1 -#endif - -/* Define to 1 to use type_info::name() for class names */ -#ifndef CPPUNIT_USE_TYPEINFO_NAME -#define CPPUNIT_USE_TYPEINFO_NAME CPPUNIT_HAVE_RTTI -#endif - -/* Version number of package */ -#ifndef CPPUNIT_VERSION -#define CPPUNIT_VERSION "1.12.0" -#endif - -/* _INCLUDE_CPPUNIT_CONFIG_AUTO_H */ -#endif diff --git a/3rdParty/CppUnit/src/include/cppunit/config/SelectDllLoader.h b/3rdParty/CppUnit/src/include/cppunit/config/SelectDllLoader.h index dc1c011..9f8c0d6 100644 --- a/3rdParty/CppUnit/src/include/cppunit/config/SelectDllLoader.h +++ b/3rdParty/CppUnit/src/include/cppunit/config/SelectDllLoader.h @@ -15,9 +15,6 @@ * CPPUNIT_HAVE_WIN32_DLL_LOADER * If defined, Win32 implementation of DynamicLibraryManager will be used. * - * CPPUNIT_HAVE_BEOS_DLL_LOADER - * If defined, BeOs implementation of DynamicLibraryManager will be used. - * * CPPUNIT_HAVE_UNIX_DLL_LOADER * If defined, Unix implementation (dlfcn.h) of DynamicLibraryManager will be used. */ @@ -50,10 +47,6 @@ #undef CPPUNIT_PLUGIN_EXPORT #define CPPUNIT_PLUGIN_EXPORT extern "C" __declspec(dllexport) -// Is BeOS platform ? -#elif defined(__BEOS__) -#define CPPUNIT_HAVE_BEOS_DLL_LOADER 1 - // Is Unix platform and have shl_load() (hp-ux) #elif defined(CPPUNIT_HAVE_SHL_LOAD) #define CPPUNIT_HAVE_UNIX_SHL_LOADER 1 diff --git a/3rdParty/CppUnit/src/include/cppunit/config/config-msvc6.h b/3rdParty/CppUnit/src/include/cppunit/config/config-msvc6.h index d688171..0edc059 100644 --- a/3rdParty/CppUnit/src/include/cppunit/config/config-msvc6.h +++ b/3rdParty/CppUnit/src/include/cppunit/config/config-msvc6.h @@ -30,20 +30,6 @@ #define CPPUNIT_HAVE_NAMESPACES 1 #endif -/* define if the compiler supports Run-Time Type Identification */ -#ifndef CPPUNIT_HAVE_RTTI -# ifdef _CPPRTTI // Defined by the compiler option /GR -# define CPPUNIT_HAVE_RTTI 1 -# else -# define CPPUNIT_HAVE_RTTI 0 -# endif -#endif - -/* Define to 1 to use type_info::name() for class names */ -#ifndef CPPUNIT_USE_TYPEINFO_NAME -#define CPPUNIT_USE_TYPEINFO_NAME CPPUNIT_HAVE_RTTI -#endif - #define CPPUNIT_HAVE_SSTREAM 1 /* Name of package */ @@ -73,11 +59,12 @@ // Uncomment to turn on STL wrapping => use this to test compilation. // This will make CppUnit subclass std::vector & co to provide default // parameter. -/*#define CPPUNIT_STD_NEED_ALLOCATOR 1 -#define CPPUNIT_STD_ALLOCATOR std::allocator<T> -//#define CPPUNIT_NO_NAMESPACE 1 +/*#define CPPUNIT_NO_NAMESPACE 1 */ +#if _MSC_VER >= 1300 // VS 7.0 +#define CPPUNIT_UNIQUE_COUNTER __COUNTER__ +#endif // if _MSC_VER >= 1300 // VS 7.0 /* _INCLUDE_CPPUNIT_CONFIG_MSVC6_H */ #endif diff --git a/3rdParty/CppUnit/src/include/cppunit/extensions/ExceptionTestCaseDecorator.h b/3rdParty/CppUnit/src/include/cppunit/extensions/ExceptionTestCaseDecorator.h index 9c816ad..a3f2b3e 100644 --- a/3rdParty/CppUnit/src/include/cppunit/extensions/ExceptionTestCaseDecorator.h +++ b/3rdParty/CppUnit/src/include/cppunit/extensions/ExceptionTestCaseDecorator.h @@ -76,7 +76,7 @@ public: // Moved outside the try{} statement to handle the case where the // expected exception type is Exception (expecting assertion failure). -#if CPPUNIT_USE_TYPEINFO_NAME +#if defined(CPPUNIT_USE_TYPEINFO_NAME) throw Exception( Message( "expected exception not thrown", "Expected exception type: " + @@ -92,7 +92,7 @@ private: * * Should be overriden to check the exception. */ - virtual void checkException( ExpectedExceptionType &e ) + virtual void checkException( ExpectedExceptionType & ) { } }; diff --git a/3rdParty/CppUnit/src/include/cppunit/extensions/HelperMacros.h b/3rdParty/CppUnit/src/include/cppunit/extensions/HelperMacros.h index 12431e4..4c30319 100644 --- a/3rdParty/CppUnit/src/include/cppunit/extensions/HelperMacros.h +++ b/3rdParty/CppUnit/src/include/cppunit/extensions/HelperMacros.h @@ -166,17 +166,18 @@ #define CPPUNIT_TEST_SUITE_END() \ } \ \ +public: \ static CPPUNIT_NS::TestSuite *suite() \ { \ const CPPUNIT_NS::TestNamer &namer = getTestNamer__(); \ - std::auto_ptr<CPPUNIT_NS::TestSuite> suite( \ - new CPPUNIT_NS::TestSuite( namer.getFixtureName() )); \ + std::unique_ptr<CPPUNIT_NS::TestSuite> guard( \ + new CPPUNIT_NS::TestSuite( namer.getFixtureName() )); \ CPPUNIT_NS::ConcretTestFixtureFactory<TestFixtureType> factory; \ - CPPUNIT_NS::TestSuiteBuilderContextBase context( *suite.get(), \ + CPPUNIT_NS::TestSuiteBuilderContextBase context( *guard.get(), \ namer, \ factory ); \ TestFixtureType::addTestsToSuite( context ); \ - return suite.release(); \ + return guard.release(); \ } \ private: /* dummy typedef so that the macro can still end with ';'*/ \ typedef int CppUnitDummyTypedefForSemiColonEnding__ @@ -300,6 +301,17 @@ &TestFixtureType::testMethod, \ context.makeFixture() ) ) ) +#define CPPUNIT_TEST_PARAMETERIZED( testMethod, ... ) \ + for (auto& i : __VA_ARGS__) \ + { \ + TestFixtureType* fixture = context.makeFixture(); \ + CPPUNIT_TEST_SUITE_ADD_TEST( \ + ( new CPPUNIT_NS::TestCaller<TestFixtureType>( \ + context.getTestNameFor(#testMethod, i), \ + std::bind(&TestFixtureType::testMethod, fixture, i), \ + fixture))); \ + } + /*! \brief Add a test which fail if the specified exception is not caught. * * Example: @@ -308,13 +320,13 @@ * #include <vector> * class MyTest : public CppUnit::TestFixture { * CPPUNIT_TEST_SUITE( MyTest ); - * CPPUNIT_TEST_EXCEPTION( testVectorAtThrow, std::invalid_argument ); + * CPPUNIT_TEST_EXCEPTION( testVectorAtThrow, std::out_of_range ); * CPPUNIT_TEST_SUITE_END(); * public: * void testVectorAtThrow() * { * std::vector<int> v; - * v.at( 1 ); // must throw exception std::invalid_argument + * v.at( 1 ); // must throw exception std::out_of_range * } * }; * \endcode diff --git a/3rdParty/CppUnit/src/include/cppunit/extensions/TestCaseDecorator.h b/3rdParty/CppUnit/src/include/cppunit/extensions/TestCaseDecorator.h index 3a15ba9..effde25 100644 --- a/3rdParty/CppUnit/src/include/cppunit/extensions/TestCaseDecorator.h +++ b/3rdParty/CppUnit/src/include/cppunit/extensions/TestCaseDecorator.h @@ -13,7 +13,7 @@ CPPUNIT_NS_BEGIN * of a test class without subclassing the test. Instead, one can * subclass the decorater and use it to wrap the test class. * - * Does not assume ownership of the test it decorates + * Assumes ownership of the test it decorates */ class CPPUNIT_API TestCaseDecorator : public TestCase { @@ -31,6 +31,13 @@ public: protected: TestCase *m_test; + +private: + + //prevent the creation of copy c'tor and operator= + TestCaseDecorator( const TestCaseDecorator& ); + TestCaseDecorator& operator=( const TestCaseDecorator& ); + }; diff --git a/3rdParty/CppUnit/src/include/cppunit/extensions/TestFactoryRegistry.h b/3rdParty/CppUnit/src/include/cppunit/extensions/TestFactoryRegistry.h index fc8723e..9d10c94 100644 --- a/3rdParty/CppUnit/src/include/cppunit/extensions/TestFactoryRegistry.h +++ b/3rdParty/CppUnit/src/include/cppunit/extensions/TestFactoryRegistry.h @@ -8,7 +8,7 @@ #pragma warning( disable: 4251) // X needs to have dll-interface to be used by clients of class Z #endif -#include <cppunit/portability/CppUnitSet.h> +#include <set> #include <cppunit/extensions/TestFactory.h> #include <string> @@ -17,11 +17,6 @@ CPPUNIT_NS_BEGIN class TestSuite; -#if CPPUNIT_NEED_DLL_DECL -// template class CPPUNIT_API std::set<TestFactory *>; -#endif - - /*! \brief Registry for TestFactory. * \ingroup CreatingTestSuite * @@ -165,7 +160,7 @@ private: void operator =( const TestFactoryRegistry © ); private: - typedef CppUnitSet<TestFactory *, std::less<TestFactory*> > Factories; + typedef std::set<TestFactory *, std::less<TestFactory*> > Factories; Factories m_factories; std::string m_name; diff --git a/3rdParty/CppUnit/src/include/cppunit/extensions/TestNamer.h b/3rdParty/CppUnit/src/include/cppunit/extensions/TestNamer.h index 5a6471c..0c8fb31 100644 --- a/3rdParty/CppUnit/src/include/cppunit/extensions/TestNamer.h +++ b/3rdParty/CppUnit/src/include/cppunit/extensions/TestNamer.h @@ -3,20 +3,16 @@ #include <cppunit/Portability.h> #include <string> +#include <cppunit/tools/StringHelper.h> -#if CPPUNIT_HAVE_RTTI -# include <typeinfo> -#endif +#include <typeinfo> /*! \def CPPUNIT_TESTNAMER_DECL( variableName, FixtureType ) * \brief Declares a TestNamer. * - * Declares a TestNamer for the specified type, using RTTI if enabled, otherwise - * using macro string expansion. - * - * RTTI is used if CPPUNIT_USE_TYPEINFO_NAME is defined and not null. + * Declares a TestNamer for the specified type * * \code * void someMethod() @@ -29,19 +25,11 @@ * \relates TestNamer * \see TestNamer */ -#if CPPUNIT_USE_TYPEINFO_NAME # define CPPUNIT_TESTNAMER_DECL( variableName, FixtureType ) \ CPPUNIT_NS::TestNamer variableName( typeid(FixtureType) ) -#else -# define CPPUNIT_TESTNAMER_DECL( variableName, FixtureType ) \ - CPPUNIT_NS::TestNamer variableName( std::string(#FixtureType) ) -#endif - - CPPUNIT_NS_BEGIN - /*! \brief Names a test or a fixture suite. * * TestNamer is usually instantiated using CPPUNIT_TESTNAMER_DECL. @@ -50,12 +38,10 @@ CPPUNIT_NS_BEGIN class CPPUNIT_API TestNamer { public: -#if CPPUNIT_HAVE_RTTI /*! \brief Constructs a namer using the fixture's type-info. * \param typeInfo Type-info of the fixture type. Use to name the fixture suite. */ TestNamer( const std::type_info &typeInfo ); -#endif /*! \brief Constructs a namer using the specified fixture name. * \param fixtureName Name of the fixture suite. Usually extracted using a macro. @@ -78,11 +64,16 @@ public: */ virtual std::string getTestNameFor( const std::string &testMethodName ) const; + template<typename E> + std::string getTestNameFor( const std::string& testMethodName, const E& val) const + { + return getTestNameFor(testMethodName) + " with parameter: " + CPPUNIT_NS::StringHelper::toString(val); + } + protected: std::string m_fixtureName; }; - CPPUNIT_NS_END #endif // CPPUNIT_EXTENSIONS_TESTNAMER_H diff --git a/3rdParty/CppUnit/src/include/cppunit/extensions/TestSuiteBuilderContext.h b/3rdParty/CppUnit/src/include/cppunit/extensions/TestSuiteBuilderContext.h index db26926..72bfa70 100644 --- a/3rdParty/CppUnit/src/include/cppunit/extensions/TestSuiteBuilderContext.h +++ b/3rdParty/CppUnit/src/include/cppunit/extensions/TestSuiteBuilderContext.h @@ -2,7 +2,7 @@ #define CPPUNIT_HELPER_TESTSUITEBUILDERCONTEXT_H #include <cppunit/Portability.h> -#include <cppunit/portability/CppUnitMap.h> +#include <map> #include <string> #if CPPUNIT_NEED_DLL_DECL @@ -62,6 +62,21 @@ public: */ std::string getTestNameFor( const std::string &testMethodName ) const; + /*! \brief Returns the name of the test for the specified method with the corresponding parameter. + * + * \param testMethodName Name (including a parameter) of the method that implements a test. + * \return A string that is the concatenation of the test fixture name + * (returned by getFixtureName()), \a testMethodName, + * separated using '::' and the parameter. This provides a fairly unique name for a given + * test. The parameter must be convertable to std::string through operator<< + * or a specialization of CPPUNIT_NS::StringHelper::toString needs to exist. + */ + template<typename T> + std::string getTestNameFor( const std::string &testMethodName, const T& value ) const + { + return m_namer.getTestNameFor(testMethodName, value); + } + /*! \brief Adds property pair. * \param key PropertyKey string to add. * \param value PropertyValue string to add. @@ -81,7 +96,7 @@ protected: // shared std::map in dll bug in VC6. // See http://www.dinkumware.com/vc_fixes.html for detail. typedef std::pair<std::string,std::string> Property; - typedef CppUnitVector<Property> Properties; + typedef std::vector<Property> Properties; TestSuite &m_suite; const TestNamer &m_namer; diff --git a/3rdParty/CppUnit/src/include/cppunit/extensions/TypeInfoHelper.h b/3rdParty/CppUnit/src/include/cppunit/extensions/TypeInfoHelper.h index c0ecdbc..1adec83 100644 --- a/3rdParty/CppUnit/src/include/cppunit/extensions/TypeInfoHelper.h +++ b/3rdParty/CppUnit/src/include/cppunit/extensions/TypeInfoHelper.h @@ -3,14 +3,11 @@ #include <cppunit/Portability.h> -#if CPPUNIT_HAVE_RTTI - #include <typeinfo> #include <string> CPPUNIT_NS_BEGIN - /**! \brief Helper to use type_info. */ class CPPUNIT_API TypeInfoHelper @@ -25,9 +22,6 @@ CPPUNIT_NS_BEGIN static std::string getClassName( const std::type_info &info ); }; - CPPUNIT_NS_END -#endif // CPPUNIT_HAVE_RTTI - #endif // CPPUNIT_TYPEINFOHELPER_H diff --git a/3rdParty/CppUnit/src/include/cppunit/portability/CppUnitDeque.h b/3rdParty/CppUnit/src/include/cppunit/portability/CppUnitDeque.h deleted file mode 100644 index bbab21f..0000000 --- a/3rdParty/CppUnit/src/include/cppunit/portability/CppUnitDeque.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef CPPUNIT_PORTABILITY_CPPUNITDEQUE_H -#define CPPUNIT_PORTABILITY_CPPUNITDEQUE_H - -// The technic used is similar to the wrapper of STLPort. - -#include <cppunit/Portability.h> -#include <deque> - - -#if CPPUNIT_STD_NEED_ALLOCATOR - -template<class T> -class CppUnitDeque : public std::deque<T,CPPUNIT_STD_ALLOCATOR> -{ -public: -}; - -#else // CPPUNIT_STD_NEED_ALLOCATOR - -#define CppUnitDeque std::deque - -#endif - -#endif // CPPUNIT_PORTABILITY_CPPUNITDEQUE_H - diff --git a/3rdParty/CppUnit/src/include/cppunit/portability/CppUnitMap.h b/3rdParty/CppUnit/src/include/cppunit/portability/CppUnitMap.h deleted file mode 100644 index 0cdc723..0000000 --- a/3rdParty/CppUnit/src/include/cppunit/portability/CppUnitMap.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef CPPUNIT_PORTABILITY_CPPUNITMAP_H -#define CPPUNIT_PORTABILITY_CPPUNITMAP_H - -// The technic used is similar to the wrapper of STLPort. - -#include <cppunit/Portability.h> -#include <functional> -#include <map> - - -#if CPPUNIT_STD_NEED_ALLOCATOR - -template<class Key, class T> -class CppUnitMap : public std::map<Key - ,T - ,std::less<Key> - ,CPPUNIT_STD_ALLOCATOR> -{ -public: -}; - -#else // CPPUNIT_STD_NEED_ALLOCATOR - -#define CppUnitMap std::map - -#endif - -#endif // CPPUNIT_PORTABILITY_CPPUNITMAP_H - diff --git a/3rdParty/CppUnit/src/include/cppunit/portability/CppUnitSet.h b/3rdParty/CppUnit/src/include/cppunit/portability/CppUnitSet.h deleted file mode 100644 index 18b8662..0000000 --- a/3rdParty/CppUnit/src/include/cppunit/portability/CppUnitSet.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef CPPUNIT_PORTABILITY_CPPUNITSET_H -#define CPPUNIT_PORTABILITY_CPPUNITSET_H - -// The technic used is similar to the wrapper of STLPort. - -#include <cppunit/Portability.h> -#include <functional> -#include <set> - - -#if CPPUNIT_STD_NEED_ALLOCATOR - -template<class T> -class CppUnitSet : public std::set<T - ,std::less<T> - ,CPPUNIT_STD_ALLOCATOR> -{ -public: -}; - -#else // CPPUNIT_STD_NEED_ALLOCATOR - -#define CppUnitSet std::set - -#endif - -#endif // CPPUNIT_PORTABILITY_CPPUNITSET_H - diff --git a/3rdParty/CppUnit/src/include/cppunit/portability/CppUnitVector.h b/3rdParty/CppUnit/src/include/cppunit/portability/CppUnitVector.h deleted file mode 100644 index 6666a63..0000000 --- a/3rdParty/CppUnit/src/include/cppunit/portability/CppUnitVector.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef CPPUNIT_PORTABILITY_CPPUNITVECTOR_H -#define CPPUNIT_PORTABILITY_CPPUNITVECTOR_H - -// The technic used is similar to the wrapper of STLPort. - -#include <cppunit/Portability.h> -#include <vector> - - -#if CPPUNIT_STD_NEED_ALLOCATOR - -template<class T> -class CppUnitVector : public std::vector<T,CPPUNIT_STD_ALLOCATOR> -{ -public: -}; - -#else // CPPUNIT_STD_NEED_ALLOCATOR - -#define CppUnitVector std::vector - -#endif - -#endif // CPPUNIT_PORTABILITY_CPPUNITVECTOR_H - diff --git a/3rdParty/CppUnit/src/include/cppunit/tools/StringHelper.h b/3rdParty/CppUnit/src/include/cppunit/tools/StringHelper.h new file mode 100644 index 0000000..3301045 --- /dev/null +++ b/3rdParty/CppUnit/src/include/cppunit/tools/StringHelper.h @@ -0,0 +1,45 @@ +#ifndef CPPUNIT_TOOLS_STRINGHELPER_H +#define CPPUNIT_TOOLS_STRINGHELPER_H + +#include <cppunit/Portability.h> +#include <cppunit/portability/Stream.h> +#include <string> +#include <type_traits> + + +CPPUNIT_NS_BEGIN + + +/*! \brief Methods for converting values to strings. Replaces CPPUNIT_NS::StringTools::toString + */ +namespace StringHelper +{ + +// work around to handle C++11 enum class correctly. We need an own conversion to std::string +// as there is no implicit coversion to int for enum class. + +template<typename T> +typename std::enable_if<!std::is_enum<T>::value, std::string>::type toString(const T& x) +{ + OStringStream ost; + ost << x; + + return ost.str(); +} + +template<typename T> +typename std::enable_if<std::is_enum<T>::value, std::string>::type toString(const T& x) +{ + OStringStream ost; + ost << static_cast<typename std::underlying_type<T>::type>(x); + + return ost.str(); +} + +} + + +CPPUNIT_NS_END + +#endif // CPPUNIT_TOOLS_STRINGHELPER_H + diff --git a/3rdParty/CppUnit/src/include/cppunit/tools/StringTools.h b/3rdParty/CppUnit/src/include/cppunit/tools/StringTools.h index 7a6b6d7..d08c6e0 100644 --- a/3rdParty/CppUnit/src/include/cppunit/tools/StringTools.h +++ b/3rdParty/CppUnit/src/include/cppunit/tools/StringTools.h @@ -3,7 +3,7 @@ #include <cppunit/Portability.h> #include <string> -#include <cppunit/portability/CppUnitVector.h> +#include <vector> CPPUNIT_NS_BEGIN @@ -14,7 +14,7 @@ CPPUNIT_NS_BEGIN struct StringTools { - typedef CppUnitVector<std::string> Strings; + typedef std::vector<std::string> Strings; static std::string CPPUNIT_API toString( int value ); diff --git a/3rdParty/CppUnit/src/include/cppunit/tools/XmlElement.h b/3rdParty/CppUnit/src/include/cppunit/tools/XmlElement.h index 0b36bd2..70e21f8 100644 --- a/3rdParty/CppUnit/src/include/cppunit/tools/XmlElement.h +++ b/3rdParty/CppUnit/src/include/cppunit/tools/XmlElement.h @@ -8,7 +8,7 @@ #pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z #endif -#include <cppunit/portability/CppUnitDeque.h> +#include <deque> #include <string> @@ -131,10 +131,10 @@ private: std::string m_name; std::string m_content; - typedef CppUnitDeque<Attribute> Attributes; + typedef std::deque<Attribute> Attributes; Attributes m_attributes; - typedef CppUnitDeque<XmlElement *> Elements; + typedef std::deque<XmlElement *> Elements; Elements m_elements; }; diff --git a/3rdParty/CppUnit/src/include/cppunit/ui/text/TextTestRunner.h b/3rdParty/CppUnit/src/include/cppunit/ui/text/TextTestRunner.h index 86da4d4..6250166 100644 --- a/3rdParty/CppUnit/src/include/cppunit/ui/text/TextTestRunner.h +++ b/3rdParty/CppUnit/src/include/cppunit/ui/text/TextTestRunner.h @@ -86,6 +86,12 @@ protected: virtual void wait( bool doWait ); virtual void printResult( bool doPrintResult ); +private: + // prohibit copying + TextTestRunner( const TextTestRunner& ); + // prohibit copying + TextTestRunner& operator=( const TextTestRunner& ); + TestResultCollector *m_result; TestResult *m_eventManager; Outputter *m_outputter; |