summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tobias.markmann@isode.com>2019-11-14 21:08:53 (GMT)
committerTobias Markmann <tobias.markmann@isode.com>2019-11-15 11:58:11 (GMT)
commit8230b23238b4d0ef0fcde01a799758558d502fa1 (patch)
tree849251b42e457357b86a2ba91e9b78f635cc55a3 /3rdParty/CppUnit/src/include/cppunit/extensions
parentcaca46ceedddd43c707e7eda9b4c765d61730ccb (diff)
downloadswift-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
Diffstat (limited to '3rdParty/CppUnit/src/include/cppunit/extensions')
-rw-r--r--3rdParty/CppUnit/src/include/cppunit/extensions/ExceptionTestCaseDecorator.h4
-rw-r--r--3rdParty/CppUnit/src/include/cppunit/extensions/HelperMacros.h24
-rw-r--r--3rdParty/CppUnit/src/include/cppunit/extensions/TestCaseDecorator.h9
-rw-r--r--3rdParty/CppUnit/src/include/cppunit/extensions/TestFactoryRegistry.h9
-rw-r--r--3rdParty/CppUnit/src/include/cppunit/extensions/TestNamer.h27
-rw-r--r--3rdParty/CppUnit/src/include/cppunit/extensions/TestSuiteBuilderContext.h19
-rw-r--r--3rdParty/CppUnit/src/include/cppunit/extensions/TypeInfoHelper.h6
7 files changed, 56 insertions, 42 deletions
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
@@ -73,13 +73,13 @@ public:
checkException( e );
return;
}
// 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: " +
TypeInfoHelper::getClassName(
typeid( ExpectedExceptionType ) ) ) );
#else
@@ -89,13 +89,13 @@ public:
private:
/*! \brief Called when the exception is caught.
*
* Should be overriden to check the exception.
*/
- virtual void checkException( ExpectedExceptionType &e )
+ virtual void checkException( ExpectedExceptionType & )
{
}
};
CPPUNIT_NS_END
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
@@ -163,23 +163,24 @@
* \see CPPUNIT_TEST_SUITE.
* \see CPPUNIT_TEST_SUITE_REGISTRATION.
*/
#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__
/*! \brief End declaration of an abstract test suite.
*
@@ -297,27 +298,38 @@
CPPUNIT_TEST_SUITE_ADD_TEST( \
( new CPPUNIT_NS::TestCaller<TestFixtureType>( \
context.getTestNameFor( #testMethod), \
&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:
* \code
* #include <cppunit/extensions/HelperMacros.h>
* #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
*
* \param testMethod Name of the method of the test case to add to the suite.
* \param ExceptionType Type of the exception that must be thrown by the test
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
@@ -10,13 +10,13 @@ CPPUNIT_NS_BEGIN
/*! \brief Decorator for Test cases.
*
* TestCaseDecorator provides an alternate means to extend functionality
* 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
{
public:
TestCaseDecorator( TestCase *test );
~TestCaseDecorator();
@@ -28,12 +28,19 @@ public:
void tearDown();
void runTest();
protected:
TestCase *m_test;
+
+private:
+
+ //prevent the creation of copy c'tor and operator=
+ TestCaseDecorator( const TestCaseDecorator& );
+ TestCaseDecorator& operator=( const TestCaseDecorator& );
+
};
CPPUNIT_NS_END
#endif
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
@@ -5,26 +5,21 @@
#if CPPUNIT_NEED_DLL_DECL
#pragma warning( push )
#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>
CPPUNIT_NS_BEGIN
class TestSuite;
-#if CPPUNIT_NEED_DLL_DECL
-// template class CPPUNIT_API std::set<TestFactory *>;
-#endif
-
-
/*! \brief Registry for TestFactory.
* \ingroup CreatingTestSuite
*
* Notes that the registry \b DON'T assumes lifetime control for any registered tests
* anymore.
*
@@ -162,13 +157,13 @@ public:
private:
TestFactoryRegistry( const TestFactoryRegistry &copy );
void operator =( const TestFactoryRegistry &copy );
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
@@ -1,64 +1,50 @@
#ifndef CPPUNIT_EXTENSIONS_TESTNAMER_H
#define CPPUNIT_EXTENSIONS_TESTNAMER_H
#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()
* {
* CPPUNIT_TESTNAMER_DECL( namer, AFixtureType );
* std::string fixtureName = namer.getFixtureName();
* ...
* \endcode
*
* \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.
*
*/
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.
*/
TestNamer( const std::string &fixtureName );
@@ -75,15 +61,20 @@ public:
* (returned by getFixtureName()) and\a testMethodName,
* separated using '::'. This provides a fairly unique name for a given
* test.
*/
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
@@ -1,11 +1,11 @@
#ifndef CPPUNIT_HELPER_TESTSUITEBUILDERCONTEXT_H
#define CPPUNIT_HELPER_TESTSUITEBUILDERCONTEXT_H
#include <cppunit/Portability.h>
-#include <cppunit/portability/CppUnitMap.h>
+#include <map>
#include <string>
#if CPPUNIT_NEED_DLL_DECL
#pragma warning( push )
#pragma warning( disable: 4251 ) // X needs to have dll-interface to be used by clients of class Z
#endif
@@ -59,12 +59,27 @@ public:
* (returned by getFixtureName()) and\a testMethodName,
* separated using '::'. This provides a fairly unique name for a given
* test.
*/
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.
*/
void addProperty( const std::string &key,
const std::string &value );
@@ -78,13 +93,13 @@ protected:
TestFixture *makeTestFixture() const;
// Notes: we use a vector here instead of a map to work-around the
// 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;
TestFixtureFactory &m_factory;
private:
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
@@ -1,19 +1,16 @@
#ifndef CPPUNIT_TYPEINFOHELPER_H
#define CPPUNIT_TYPEINFOHELPER_H
#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
{
public:
/*! \brief Get the class name of the specified type_info.
@@ -22,12 +19,9 @@ CPPUNIT_NS_BEGIN
* the "class" prefix. If the name is not prefixed
* by "class", it is returned as this.
*/
static std::string getClassName( const std::type_info &info );
};
-
CPPUNIT_NS_END
-#endif // CPPUNIT_HAVE_RTTI
-
#endif // CPPUNIT_TYPEINFOHELPER_H