diff options
author | Tobias Markmann <tobias.markmann@isode.com> | 2019-11-14 21:08:53 (GMT) |
---|---|---|
committer | Tobias Markmann <tobias.markmann@isode.com> | 2019-11-15 11:58:11 (GMT) |
commit | 8230b23238b4d0ef0fcde01a799758558d502fa1 (patch) | |
tree | 849251b42e457357b86a2ba91e9b78f635cc55a3 | |
parent | caca46ceedddd43c707e7eda9b4c765d61730ccb (diff) | |
download | swift-8230b23238b4d0ef0fcde01a799758558d502fa1.zip swift-8230b23238b4d0ef0fcde01a799758558d502fa1.tar.bz2 |
Update 3rdParty/CppUnit to version 1.14.0
This gets rid of std::auto_ptr usage and its deprecation
warnings.
Test-Information:
Builds and tests pass on macOS.
Change-Id: I299a0a8d9aa2ead15c933e83a2e3e53f84a4f5b7
55 files changed, 705 insertions, 482 deletions
diff --git a/3rdParty/CppUnit/src/COPYING b/3rdParty/CppUnit/src/COPYING index b1e3f5a..0a41847 100644 --- a/3rdParty/CppUnit/src/COPYING +++ b/3rdParty/CppUnit/src/COPYING @@ -2,7 +2,7 @@ Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. 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; diff --git a/3rdParty/CppUnit/src/src/cppunit/Asserter.cpp b/3rdParty/CppUnit/src/src/cppunit/Asserter.cpp index a9cf95c..79fcb2e 100644 --- a/3rdParty/CppUnit/src/src/cppunit/Asserter.cpp +++ b/3rdParty/CppUnit/src/src/cppunit/Asserter.cpp @@ -6,6 +6,7 @@ CPPUNIT_NS_BEGIN +// coverity[+kill] void Asserter::fail( std::string message, const SourceLine &sourceLine ) @@ -13,7 +14,7 @@ Asserter::fail( std::string message, fail( Message( "assertion failed", message ), sourceLine ); } - +// coverity[+kill] void Asserter::fail( const Message &message, const SourceLine &sourceLine ) @@ -40,13 +41,41 @@ Asserter::failIf( bool shouldFail, failIf( shouldFail, Message( "assertion failed", message ), sourceLine ); } - std::string Asserter::makeExpected( const std::string &expectedValue ) { return "Expected: " + expectedValue; } +std::string +Asserter::makeExpectedEqual( const std::string &expectedValue ) +{ + return "Expected: " + expectedValue; +} + +std::string +Asserter::makeExpectedLess( const std::string& expectedValue ) +{ + return "Expected less than: " + expectedValue; +} + +std::string +Asserter::makeExpectedLessEqual( const std::string& expectedValue ) +{ + return "Expected less or equal than: " + expectedValue; +} + +std::string +Asserter::makeExpectedGreater( const std::string& expectedValue ) +{ + return "Expected greater than: " + expectedValue; +} + +std::string +Asserter::makeExpectedGreaterEqual( const std::string& expectedValue ) +{ + return "Expected greater or equal than: " + expectedValue; +} std::string Asserter::makeActual( const std::string &actualValue ) @@ -55,18 +84,28 @@ Asserter::makeActual( const std::string &actualValue ) } +Message +Asserter::makeMessage( const std::string& expectedMessage, + const std::string& actualMessage, + const std::string& shortDescription, + const AdditionalMessage& additionalMessage) +{ + Message message( shortDescription, + expectedMessage, + actualMessage ); + message.addDetail( additionalMessage ); + + return message; +} + + Message Asserter::makeNotEqualMessage( const std::string &expectedValue, const std::string &actualValue, const AdditionalMessage &additionalMessage, const std::string &shortDescription ) { - Message message( shortDescription, - makeExpected( expectedValue ), - makeActual( actualValue ) ); - message.addDetail( additionalMessage ); - - return message; + return makeMessage(makeExpectedEqual(expectedValue), makeActual(actualValue), shortDescription, additionalMessage); } @@ -77,15 +116,71 @@ Asserter::failNotEqual( std::string expected, const AdditionalMessage &additionalMessage, std::string shortDescription ) { - fail( makeNotEqualMessage( expected, - actual, - additionalMessage, - shortDescription ), + fail( makeMessage( makeExpectedEqual(expected), + makeActual(actual), + shortDescription, + additionalMessage ), + sourceLine ); +} + + +void +Asserter::failNotLess( std::string expected, + std::string actual, + const SourceLine &sourceLine, + const AdditionalMessage &additionalMessage, + std::string shortDescription ) +{ + fail( makeMessage( makeExpectedLess(expected), + makeActual(actual), + shortDescription, + additionalMessage), sourceLine ); } void +Asserter::failNotGreater( std::string expected, + std::string actual, + const SourceLine &sourceLine, + const AdditionalMessage &additionalMessage, + std::string shortDescription ) +{ + fail( makeMessage( makeExpectedGreater(expected), + makeActual(actual), + shortDescription, + additionalMessage), + sourceLine ); +} + +void +Asserter::failNotLessEqual( std::string expected, + std::string actual, + const SourceLine &sourceLine, + const AdditionalMessage &additionalMessage, + std::string shortDescription ) +{ + fail( makeMessage( makeExpectedLessEqual(expected), + makeActual(actual), + shortDescription, + additionalMessage ), + sourceLine ); +} + +void +Asserter::failNotGreaterEqual( std::string expected, + std::string actual, + const SourceLine &sourceLine, + const AdditionalMessage &additionalMessage, + std::string shortDescription ) +{ + fail( makeMessage( makeExpectedGreaterEqual(expected), + makeActual(actual), + shortDescription, + additionalMessage ), + sourceLine ); +} +void Asserter::failNotEqualIf( bool shouldFail, std::string expected, std::string actual, diff --git a/3rdParty/CppUnit/src/src/cppunit/BriefTestProgressListener.cpp b/3rdParty/CppUnit/src/src/cppunit/BriefTestProgressListener.cpp index 120e6d5..4ea8d35 100644 --- a/3rdParty/CppUnit/src/src/cppunit/BriefTestProgressListener.cpp +++ b/3rdParty/CppUnit/src/src/cppunit/BriefTestProgressListener.cpp @@ -37,7 +37,7 @@ BriefTestProgressListener::addFailure( const TestFailure &failure ) void -BriefTestProgressListener::endTest( Test *) +BriefTestProgressListener::endTest( Test * ) { if ( !m_lastTestFailed ) stdCOut() << " : OK"; diff --git a/3rdParty/CppUnit/src/src/cppunit/DefaultProtector.cpp b/3rdParty/CppUnit/src/src/cppunit/DefaultProtector.cpp index 6fb306b..fa6ac87 100644 --- a/3rdParty/CppUnit/src/src/cppunit/DefaultProtector.cpp +++ b/3rdParty/CppUnit/src/src/cppunit/DefaultProtector.cpp @@ -21,7 +21,7 @@ DefaultProtector::protect( const Functor &functor, catch ( std::exception &e ) { std::string shortDescription( "uncaught exception of type " ); -#if CPPUNIT_USE_TYPEINFO_NAME +#if defined(CPPUNIT_USE_TYPEINFO_NAME) shortDescription += TypeInfoHelper::getClassName( typeid(e) ); #else shortDescription += "std::exception (or derived)."; diff --git a/3rdParty/CppUnit/src/src/cppunit/Exception.cpp b/3rdParty/CppUnit/src/src/cppunit/Exception.cpp index 3bbe24b..6685480 100644 --- a/3rdParty/CppUnit/src/src/cppunit/Exception.cpp +++ b/3rdParty/CppUnit/src/src/cppunit/Exception.cpp @@ -19,20 +19,20 @@ const long Exception::UNKNOWNLINENUMBER = -1; Exception::Exception( const Exception &other ) : std::exception( other ) + , m_message(other.m_message) + , m_sourceLine(other.m_sourceLine) + , m_whatMessage(other.m_whatMessage) { - m_message = other.m_message; - m_sourceLine = other.m_sourceLine; } - Exception::Exception( const Message &message, const SourceLine &sourceLine ) : m_message( message ) , m_sourceLine( sourceLine ) + , m_whatMessage() { } - #ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED Exception::Exception( std::string message, long lineNumber, diff --git a/3rdParty/CppUnit/src/src/cppunit/Message.cpp b/3rdParty/CppUnit/src/src/cppunit/Message.cpp index 9d6a0e9..ad2efd9 100644 --- a/3rdParty/CppUnit/src/src/cppunit/Message.cpp +++ b/3rdParty/CppUnit/src/src/cppunit/Message.cpp @@ -4,19 +4,16 @@ CPPUNIT_NS_BEGIN - -Message::Message() -{ -} - Message::Message( const Message &other ) + : m_shortDescription() + , m_details() { *this = other; } - Message::Message( const std::string &shortDescription ) : m_shortDescription( shortDescription ) + , m_details() { } @@ -24,6 +21,7 @@ Message::Message( const std::string &shortDescription ) Message::Message( const std::string &shortDescription, const std::string &detail1 ) : m_shortDescription( shortDescription ) + , m_details() { addDetail( detail1 ); } @@ -33,6 +31,7 @@ Message::Message( const std::string &shortDescription, const std::string &detail1, const std::string &detail2 ) : m_shortDescription( shortDescription ) + , m_details() { addDetail( detail1, detail2 ); } @@ -43,10 +42,15 @@ Message::Message( const std::string &shortDescription, const std::string &detail2, const std::string &detail3 ) : m_shortDescription( shortDescription ) + , m_details() { addDetail( detail1, detail2, detail3 ); } +Message::~Message() +{ +} + Message & Message::operator =( const Message &other ) { diff --git a/3rdParty/CppUnit/src/src/cppunit/Protector.cpp b/3rdParty/CppUnit/src/src/cppunit/Protector.cpp index 5c171ec..99188bb 100644 --- a/3rdParty/CppUnit/src/src/cppunit/Protector.cpp +++ b/3rdParty/CppUnit/src/src/cppunit/Protector.cpp @@ -21,7 +21,7 @@ void Protector::reportError( const ProtectorContext &context, const Exception &error ) const { - std::auto_ptr<Exception> actualError( error.clone() ); + std::unique_ptr<Exception> actualError( error.clone() ); actualError->setMessage( actualMessage( actualError->message(), context ) ); context.m_result->addError( context.m_test, actualError.release() ); @@ -42,7 +42,7 @@ void Protector::reportFailure( const ProtectorContext &context, const Exception &failure ) const { - std::auto_ptr<Exception> actualFailure( failure.clone() ); + std::unique_ptr<Exception> actualFailure( failure.clone() ); actualFailure->setMessage( actualMessage( actualFailure->message(), context ) ); context.m_result->addFailure( context.m_test, actualFailure.release() ); diff --git a/3rdParty/CppUnit/src/src/cppunit/ProtectorChain.cpp b/3rdParty/CppUnit/src/src/cppunit/ProtectorChain.cpp index f528341..db7744a 100644 --- a/3rdParty/CppUnit/src/src/cppunit/ProtectorChain.cpp +++ b/3rdParty/CppUnit/src/src/cppunit/ProtectorChain.cpp @@ -21,11 +21,20 @@ public: } private: + // disable copying + ProtectFunctor( const ProtectFunctor& ); + // disable copying + ProtectFunctor& operator=( const ProtectFunctor& ); + Protector *m_protector; const Functor &m_functor; const ProtectorContext &m_context; }; +ProtectorChain::ProtectorChain() + : m_protectors(0) +{ +} ProtectorChain::~ProtectorChain() { diff --git a/3rdParty/CppUnit/src/src/cppunit/ProtectorChain.h b/3rdParty/CppUnit/src/src/cppunit/ProtectorChain.h index 711b56f..9123782 100644 --- a/3rdParty/CppUnit/src/src/cppunit/ProtectorChain.h +++ b/3rdParty/CppUnit/src/src/cppunit/ProtectorChain.h @@ -2,7 +2,7 @@ #define CPPUNIT_PROTECTORCHAIN_H #include <cppunit/Protector.h> -#include <cppunit/portability/CppUnitDeque.h> +#include <deque> #if CPPUNIT_NEED_DLL_DECL #pragma warning( push ) @@ -19,6 +19,8 @@ CPPUNIT_NS_BEGIN class CPPUNIT_API ProtectorChain : public Protector { public: + ProtectorChain(); + ~ProtectorChain(); void push( Protector *protector ); @@ -34,10 +36,10 @@ private: class ProtectFunctor; private: - typedef CppUnitDeque<Protector *> Protectors; + typedef std::deque<Protector *> Protectors; Protectors m_protectors; - typedef CppUnitDeque<Functor *> Functors; + typedef std::deque<Functor *> Functors; }; diff --git a/3rdParty/CppUnit/src/src/cppunit/ProtectorContext.h b/3rdParty/CppUnit/src/src/cppunit/ProtectorContext.h index c3d496c..4957e05 100644 --- a/3rdParty/CppUnit/src/src/cppunit/ProtectorContext.h +++ b/3rdParty/CppUnit/src/src/cppunit/ProtectorContext.h @@ -26,6 +26,13 @@ public: { } +private: + /// disable copy construction + ProtectorContext( const ProtectorContext& ); + /// disable assignment + ProtectorContext& operator=(const ProtectorContext&); + +public: Test *m_test; TestResult *m_result; std::string m_shortDescription; diff --git a/3rdParty/CppUnit/src/src/cppunit/SourceLine.cpp b/3rdParty/CppUnit/src/src/cppunit/SourceLine.cpp index dfadae3..ecc9558 100644 --- a/3rdParty/CppUnit/src/src/cppunit/SourceLine.cpp +++ b/3rdParty/CppUnit/src/src/cppunit/SourceLine.cpp @@ -5,6 +5,7 @@ CPPUNIT_NS_BEGIN SourceLine::SourceLine() : + m_fileName(), m_lineNumber( -1 ) { } diff --git a/3rdParty/CppUnit/src/src/cppunit/TestCase.cpp b/3rdParty/CppUnit/src/src/cppunit/TestCase.cpp index 13c0525..431a0c5 100644 --- a/3rdParty/CppUnit/src/src/cppunit/TestCase.cpp +++ b/3rdParty/CppUnit/src/src/cppunit/TestCase.cpp @@ -5,7 +5,7 @@ #include <cppunit/TestResult.h> #include <stdexcept> -#if CPPUNIT_USE_TYPEINFO_NAME +#if defined(CPPUNIT_USE_TYPEINFO_NAME) # include <typeinfo> #endif diff --git a/3rdParty/CppUnit/src/src/cppunit/TestFactoryRegistry.cpp b/3rdParty/CppUnit/src/src/cppunit/TestFactoryRegistry.cpp index 3457da3..f1623cc 100644 --- a/3rdParty/CppUnit/src/src/cppunit/TestFactoryRegistry.cpp +++ b/3rdParty/CppUnit/src/src/cppunit/TestFactoryRegistry.cpp @@ -1,6 +1,6 @@ #include <cppunit/config/SourcePrefix.h> #include <cppunit/extensions/TestFactoryRegistry.h> -#include <cppunit/portability/CppUnitMap.h> +#include <map> #include <cppunit/TestSuite.h> #include <assert.h> @@ -12,7 +12,7 @@ CPPUNIT_NS_BEGIN class TestFactoryRegistryList { private: - typedef CppUnitMap<std::string, TestFactoryRegistry *, std::less<std::string> > Registries; + typedef std::map<std::string, TestFactoryRegistry *, std::less<std::string> > Registries; Registries m_registries; enum State { @@ -50,6 +50,7 @@ private: public: TestFactoryRegistryList() + : m_registries() { stateFlag( exist ); } @@ -83,6 +84,7 @@ public: TestFactoryRegistry::TestFactoryRegistry( std::string name ) : + m_factories(), m_name( name ) { } diff --git a/3rdParty/CppUnit/src/src/cppunit/TestNamer.cpp b/3rdParty/CppUnit/src/src/cppunit/TestNamer.cpp index eec9be9..1eb6c5f 100644 --- a/3rdParty/CppUnit/src/src/cppunit/TestNamer.cpp +++ b/3rdParty/CppUnit/src/src/cppunit/TestNamer.cpp @@ -1,44 +1,34 @@ #include <cppunit/extensions/TestNamer.h> #include <cppunit/extensions/TypeInfoHelper.h> +#include <cppunit/tools/StringHelper.h> #include <string> - CPPUNIT_NS_BEGIN - -#if CPPUNIT_HAVE_RTTI TestNamer::TestNamer( const std::type_info &typeInfo ) + : m_fixtureName( TypeInfoHelper::getClassName( typeInfo ) ) { - m_fixtureName = TypeInfoHelper::getClassName( typeInfo ); } -#endif - TestNamer::TestNamer( const std::string &fixtureName ) : m_fixtureName( fixtureName ) { } - TestNamer::~TestNamer() { } - std::string TestNamer::getFixtureName() const { return m_fixtureName; } - std::string TestNamer::getTestNameFor( const std::string &testMethodName ) const { return getFixtureName() + "::" + testMethodName; } - - - CPPUNIT_NS_END diff --git a/3rdParty/CppUnit/src/src/cppunit/TestPath.cpp b/3rdParty/CppUnit/src/src/cppunit/TestPath.cpp index a2783a2..5affffb 100644 --- a/3rdParty/CppUnit/src/src/cppunit/TestPath.cpp +++ b/3rdParty/CppUnit/src/src/cppunit/TestPath.cpp @@ -8,11 +8,13 @@ CPPUNIT_NS_BEGIN TestPath::TestPath() + : m_tests() { } TestPath::TestPath( Test *root ) + : m_tests() { add( root ); } @@ -21,6 +23,7 @@ TestPath::TestPath( Test *root ) TestPath::TestPath( const TestPath &other, int indexFirst, int count ) + : m_tests() { int countAdjustment = 0; if ( indexFirst < 0 ) @@ -42,6 +45,7 @@ TestPath::TestPath( const TestPath &other, TestPath::TestPath( Test *searchRoot, const std::string &pathAsString ) + : m_tests() { PathTestNames testNames; diff --git a/3rdParty/CppUnit/src/src/cppunit/TestResult.cpp b/3rdParty/CppUnit/src/src/cppunit/TestResult.cpp index 6be19f1..ad880bc 100644 --- a/3rdParty/CppUnit/src/src/cppunit/TestResult.cpp +++ b/3rdParty/CppUnit/src/src/cppunit/TestResult.cpp @@ -3,6 +3,7 @@ #include <cppunit/TestListener.h> #include <cppunit/TestResult.h> #include <cppunit/tools/Algorithm.h> +#include <cppunit/portability/Stream.h> #include <algorithm> #include "DefaultProtector.h" #include "ProtectorChain.h" @@ -13,7 +14,8 @@ CPPUNIT_NS_BEGIN TestResult::TestResult( SynchronizationObject *syncObject ) : SynchronizedObject( syncObject ) - , m_protectorChain( new ProtectorChain() ) + , m_listeners() + , m_protectorChain( new ProtectorChain ) , m_stop( false ) { m_protectorChain->push( new DefaultProtector() ); @@ -22,6 +24,8 @@ TestResult::TestResult( SynchronizationObject *syncObject ) TestResult::~TestResult() { + stdCOut().flush(); + stdCErr().flush(); delete m_protectorChain; } diff --git a/3rdParty/CppUnit/src/src/cppunit/TestResultCollector.cpp b/3rdParty/CppUnit/src/src/cppunit/TestResultCollector.cpp index 4371c50..73f81da 100644 --- a/3rdParty/CppUnit/src/src/cppunit/TestResultCollector.cpp +++ b/3rdParty/CppUnit/src/src/cppunit/TestResultCollector.cpp @@ -7,6 +7,9 @@ CPPUNIT_NS_BEGIN TestResultCollector::TestResultCollector( SynchronizationObject *syncObject ) : TestSuccessListener( syncObject ) + , m_tests() + , m_failures() + , m_testErrors(0) { reset(); } diff --git a/3rdParty/CppUnit/src/src/cppunit/TestSuite.cpp b/3rdParty/CppUnit/src/src/cppunit/TestSuite.cpp index 8dd2ea6..b5d6db3 100644 --- a/3rdParty/CppUnit/src/src/cppunit/TestSuite.cpp +++ b/3rdParty/CppUnit/src/src/cppunit/TestSuite.cpp @@ -8,6 +8,7 @@ CPPUNIT_NS_BEGIN /// Default constructor TestSuite::TestSuite( std::string name ) : TestComposite( name ) + , m_tests() { } @@ -39,7 +40,7 @@ TestSuite::addTest( Test *test ) } -const CppUnitVector<Test *> & +const std::vector<Test *> & TestSuite::getTests() const { return m_tests; diff --git a/3rdParty/CppUnit/src/src/cppunit/TestSuiteBuilderContext.cpp b/3rdParty/CppUnit/src/src/cppunit/TestSuiteBuilderContext.cpp index ff71b52..5e4347e 100644 --- a/3rdParty/CppUnit/src/src/cppunit/TestSuiteBuilderContext.cpp +++ b/3rdParty/CppUnit/src/src/cppunit/TestSuiteBuilderContext.cpp @@ -13,6 +13,7 @@ TestSuiteBuilderContextBase::TestSuiteBuilderContextBase( : m_suite( suite ) , m_namer( namer ) , m_factory( factory ) + , m_properties() { } diff --git a/3rdParty/CppUnit/src/src/cppunit/TextTestProgressListener.cpp b/3rdParty/CppUnit/src/src/cppunit/TextTestProgressListener.cpp index 5bbe768..ea4fb17 100644 --- a/3rdParty/CppUnit/src/src/cppunit/TextTestProgressListener.cpp +++ b/3rdParty/CppUnit/src/src/cppunit/TextTestProgressListener.cpp @@ -20,6 +20,7 @@ void TextTestProgressListener::startTest( Test * ) { stdCOut() << "."; + stdCOut().flush(); } @@ -27,6 +28,7 @@ void TextTestProgressListener::addFailure( const TestFailure &failure ) { stdCOut() << ( failure.isError() ? "E" : "F" ); + stdCOut().flush(); } diff --git a/3rdParty/CppUnit/src/src/cppunit/TypeInfoHelper.cpp b/3rdParty/CppUnit/src/src/cppunit/TypeInfoHelper.cpp index 2febac6..aa24a80 100644 --- a/3rdParty/CppUnit/src/src/cppunit/TypeInfoHelper.cpp +++ b/3rdParty/CppUnit/src/src/cppunit/TypeInfoHelper.cpp @@ -1,19 +1,16 @@ #include <cppunit/Portability.h> #include <cppunit/extensions/TypeInfoHelper.h> -#include <stdlib.h> - -#if CPPUNIT_HAVE_RTTI #include <string> #if CPPUNIT_HAVE_GCC_ABI_DEMANGLE +#include <cstdlib> #include <cxxabi.h> #endif CPPUNIT_NS_BEGIN - std::string TypeInfoHelper::getClassName( const std::type_info &info ) { @@ -22,10 +19,21 @@ TypeInfoHelper::getClassName( const std::type_info &info ) int status = 0; char* c_name = 0; - c_name = abi::__cxa_demangle( info.name(), 0, 0, &status ); - - std::string name( c_name ); - free( c_name ); + const char* c_origName = info.name(); + if(c_origName[0] == '*') + ++c_origName; + c_name = abi::__cxa_demangle( c_origName, 0, 0, &status ); + + std::string name; + if(c_name) + { + name = std::string( c_name ); + free( c_name ); + } + else + { + name = std::string( c_origName ); + } #else // CPPUNIT_HAVE_GCC_ABI_DEMANGLE @@ -48,7 +56,4 @@ TypeInfoHelper::getClassName( const std::type_info &info ) return name; } - CPPUNIT_NS_END - -#endif // CPPUNIT_HAVE_RTTI diff --git a/3rdParty/CppUnit/src/src/cppunit/XmlDocument.cpp b/3rdParty/CppUnit/src/src/cppunit/XmlDocument.cpp index 31f9115..4b09769 100644 --- a/3rdParty/CppUnit/src/src/cppunit/XmlDocument.cpp +++ b/3rdParty/CppUnit/src/src/cppunit/XmlDocument.cpp @@ -5,7 +5,6 @@ CPPUNIT_NS_BEGIN - XmlDocument::XmlDocument( const std::string &encoding, const std::string &styleSheet ) : m_styleSheet( styleSheet ) @@ -15,7 +14,6 @@ XmlDocument::XmlDocument( const std::string &encoding, setEncoding( encoding ); } - XmlDocument::~XmlDocument() { delete m_rootElement; diff --git a/3rdParty/CppUnit/src/src/cppunit/XmlElement.cpp b/3rdParty/CppUnit/src/src/cppunit/XmlElement.cpp index f930ad4..b16d2fe 100644 --- a/3rdParty/CppUnit/src/src/cppunit/XmlElement.cpp +++ b/3rdParty/CppUnit/src/src/cppunit/XmlElement.cpp @@ -10,6 +10,8 @@ XmlElement::XmlElement( std::string elementName, std::string content ) : m_name( elementName ) , m_content( content ) + , m_attributes() + , m_elements() { } @@ -17,6 +19,9 @@ XmlElement::XmlElement( std::string elementName, XmlElement::XmlElement( std::string elementName, int numericContent ) : m_name( elementName ) + , m_content() + , m_attributes() + , m_elements() { setContent( numericContent ); } diff --git a/3rdParty/CppUnit/src/src/cppunit/XmlOutputter.cpp b/3rdParty/CppUnit/src/src/cppunit/XmlOutputter.cpp index c605e33..e1cb690 100644 --- a/3rdParty/CppUnit/src/src/cppunit/XmlOutputter.cpp +++ b/3rdParty/CppUnit/src/src/cppunit/XmlOutputter.cpp @@ -15,10 +15,13 @@ CPPUNIT_NS_BEGIN XmlOutputter::XmlOutputter( TestResultCollector *result, OStream &stream, - std::string encoding ) + const std::string& encoding ) : m_result( result ) , m_stream( stream ) + , m_encoding( encoding ) + , m_styleSheet() , m_xml( new XmlDocument( encoding ) ) + , m_hooks() { } |