summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
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
@@ -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 &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
@@ -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