diff options
Diffstat (limited to '3rdParty/CppUnit/src/include/cppunit/extensions')
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: | |||
| 76 | 76 | ||
| 77 | // Moved outside the try{} statement to handle the case where the | 77 | // Moved outside the try{} statement to handle the case where the |
| 78 | // expected exception type is Exception (expecting assertion failure). | 78 | // expected exception type is Exception (expecting assertion failure). |
| 79 | #if CPPUNIT_USE_TYPEINFO_NAME | 79 | #if defined(CPPUNIT_USE_TYPEINFO_NAME) |
| 80 | throw Exception( Message( | 80 | throw Exception( Message( |
| 81 | "expected exception not thrown", | 81 | "expected exception not thrown", |
| 82 | "Expected exception type: " + | 82 | "Expected exception type: " + |
| @@ -92,7 +92,7 @@ private: | |||
| 92 | * | 92 | * |
| 93 | * Should be overriden to check the exception. | 93 | * Should be overriden to check the exception. |
| 94 | */ | 94 | */ |
| 95 | virtual void checkException( ExpectedExceptionType &e ) | 95 | virtual void checkException( ExpectedExceptionType & ) |
| 96 | { | 96 | { |
| 97 | } | 97 | } |
| 98 | }; | 98 | }; |
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 @@ | |||
| 166 | #define CPPUNIT_TEST_SUITE_END() \ | 166 | #define CPPUNIT_TEST_SUITE_END() \ |
| 167 | } \ | 167 | } \ |
| 168 | \ | 168 | \ |
| 169 | public: \ | ||
| 169 | static CPPUNIT_NS::TestSuite *suite() \ | 170 | static CPPUNIT_NS::TestSuite *suite() \ |
| 170 | { \ | 171 | { \ |
| 171 | const CPPUNIT_NS::TestNamer &namer = getTestNamer__(); \ | 172 | const CPPUNIT_NS::TestNamer &namer = getTestNamer__(); \ |
| 172 | std::auto_ptr<CPPUNIT_NS::TestSuite> suite( \ | 173 | std::unique_ptr<CPPUNIT_NS::TestSuite> guard( \ |
| 173 | new CPPUNIT_NS::TestSuite( namer.getFixtureName() )); \ | 174 | new CPPUNIT_NS::TestSuite( namer.getFixtureName() )); \ |
| 174 | CPPUNIT_NS::ConcretTestFixtureFactory<TestFixtureType> factory; \ | 175 | CPPUNIT_NS::ConcretTestFixtureFactory<TestFixtureType> factory; \ |
| 175 | CPPUNIT_NS::TestSuiteBuilderContextBase context( *suite.get(), \ | 176 | CPPUNIT_NS::TestSuiteBuilderContextBase context( *guard.get(), \ |
| 176 | namer, \ | 177 | namer, \ |
| 177 | factory ); \ | 178 | factory ); \ |
| 178 | TestFixtureType::addTestsToSuite( context ); \ | 179 | TestFixtureType::addTestsToSuite( context ); \ |
| 179 | return suite.release(); \ | 180 | return guard.release(); \ |
| 180 | } \ | 181 | } \ |
| 181 | private: /* dummy typedef so that the macro can still end with ';'*/ \ | 182 | private: /* dummy typedef so that the macro can still end with ';'*/ \ |
| 182 | typedef int CppUnitDummyTypedefForSemiColonEnding__ | 183 | typedef int CppUnitDummyTypedefForSemiColonEnding__ |
| @@ -300,6 +301,17 @@ | |||
| 300 | &TestFixtureType::testMethod, \ | 301 | &TestFixtureType::testMethod, \ |
| 301 | context.makeFixture() ) ) ) | 302 | context.makeFixture() ) ) ) |
| 302 | 303 | ||
| 304 | #define CPPUNIT_TEST_PARAMETERIZED( testMethod, ... ) \ | ||
| 305 | for (auto& i : __VA_ARGS__) \ | ||
| 306 | { \ | ||
| 307 | TestFixtureType* fixture = context.makeFixture(); \ | ||
| 308 | CPPUNIT_TEST_SUITE_ADD_TEST( \ | ||
| 309 | ( new CPPUNIT_NS::TestCaller<TestFixtureType>( \ | ||
| 310 | context.getTestNameFor(#testMethod, i), \ | ||
| 311 | std::bind(&TestFixtureType::testMethod, fixture, i), \ | ||
| 312 | fixture))); \ | ||
| 313 | } | ||
| 314 | |||
| 303 | /*! \brief Add a test which fail if the specified exception is not caught. | 315 | /*! \brief Add a test which fail if the specified exception is not caught. |
| 304 | * | 316 | * |
| 305 | * Example: | 317 | * Example: |
| @@ -308,13 +320,13 @@ | |||
| 308 | * #include <vector> | 320 | * #include <vector> |
| 309 | * class MyTest : public CppUnit::TestFixture { | 321 | * class MyTest : public CppUnit::TestFixture { |
| 310 | * CPPUNIT_TEST_SUITE( MyTest ); | 322 | * CPPUNIT_TEST_SUITE( MyTest ); |
| 311 | * CPPUNIT_TEST_EXCEPTION( testVectorAtThrow, std::invalid_argument ); | 323 | * CPPUNIT_TEST_EXCEPTION( testVectorAtThrow, std::out_of_range ); |
| 312 | * CPPUNIT_TEST_SUITE_END(); | 324 | * CPPUNIT_TEST_SUITE_END(); |
| 313 | * public: | 325 | * public: |
| 314 | * void testVectorAtThrow() | 326 | * void testVectorAtThrow() |
| 315 | * { | 327 | * { |
| 316 | * std::vector<int> v; | 328 | * std::vector<int> v; |
| 317 | * v.at( 1 ); // must throw exception std::invalid_argument | 329 | * v.at( 1 ); // must throw exception std::out_of_range |
| 318 | * } | 330 | * } |
| 319 | * }; | 331 | * }; |
| 320 | * \endcode | 332 | * \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 | |||
| 13 | * of a test class without subclassing the test. Instead, one can | 13 | * of a test class without subclassing the test. Instead, one can |
| 14 | * subclass the decorater and use it to wrap the test class. | 14 | * subclass the decorater and use it to wrap the test class. |
| 15 | * | 15 | * |
| 16 | * Does not assume ownership of the test it decorates | 16 | * Assumes ownership of the test it decorates |
| 17 | */ | 17 | */ |
| 18 | class CPPUNIT_API TestCaseDecorator : public TestCase | 18 | class CPPUNIT_API TestCaseDecorator : public TestCase |
| 19 | { | 19 | { |
| @@ -31,6 +31,13 @@ public: | |||
| 31 | 31 | ||
| 32 | protected: | 32 | protected: |
| 33 | TestCase *m_test; | 33 | TestCase *m_test; |
| 34 | |||
| 35 | private: | ||
| 36 | |||
| 37 | //prevent the creation of copy c'tor and operator= | ||
| 38 | TestCaseDecorator( const TestCaseDecorator& ); | ||
| 39 | TestCaseDecorator& operator=( const TestCaseDecorator& ); | ||
| 40 | |||
| 34 | }; | 41 | }; |
| 35 | 42 | ||
| 36 | 43 | ||
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 @@ | |||
| 8 | #pragma warning( disable: 4251) // X needs to have dll-interface to be used by clients of class Z | 8 | #pragma warning( disable: 4251) // X needs to have dll-interface to be used by clients of class Z |
| 9 | #endif | 9 | #endif |
| 10 | 10 | ||
| 11 | #include <cppunit/portability/CppUnitSet.h> | 11 | #include <set> |
| 12 | #include <cppunit/extensions/TestFactory.h> | 12 | #include <cppunit/extensions/TestFactory.h> |
| 13 | #include <string> | 13 | #include <string> |
| 14 | 14 | ||
| @@ -17,11 +17,6 @@ CPPUNIT_NS_BEGIN | |||
| 17 | 17 | ||
| 18 | class TestSuite; | 18 | class TestSuite; |
| 19 | 19 | ||
| 20 | #if CPPUNIT_NEED_DLL_DECL | ||
| 21 | // template class CPPUNIT_API std::set<TestFactory *>; | ||
| 22 | #endif | ||
| 23 | |||
| 24 | |||
| 25 | /*! \brief Registry for TestFactory. | 20 | /*! \brief Registry for TestFactory. |
| 26 | * \ingroup CreatingTestSuite | 21 | * \ingroup CreatingTestSuite |
| 27 | * | 22 | * |
| @@ -165,7 +160,7 @@ private: | |||
| 165 | void operator =( const TestFactoryRegistry © ); | 160 | void operator =( const TestFactoryRegistry © ); |
| 166 | 161 | ||
| 167 | private: | 162 | private: |
| 168 | typedef CppUnitSet<TestFactory *, std::less<TestFactory*> > Factories; | 163 | typedef std::set<TestFactory *, std::less<TestFactory*> > Factories; |
| 169 | Factories m_factories; | 164 | Factories m_factories; |
| 170 | 165 | ||
| 171 | std::string m_name; | 166 | 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 @@ | |||
| 3 | 3 | ||
| 4 | #include <cppunit/Portability.h> | 4 | #include <cppunit/Portability.h> |
| 5 | #include <string> | 5 | #include <string> |
| 6 | #include <cppunit/tools/StringHelper.h> | ||
| 6 | 7 | ||
| 7 | #if CPPUNIT_HAVE_RTTI | 8 | #include <typeinfo> |
| 8 | # include <typeinfo> | ||
| 9 | #endif | ||
| 10 | 9 | ||
| 11 | 10 | ||
| 12 | 11 | ||
| 13 | /*! \def CPPUNIT_TESTNAMER_DECL( variableName, FixtureType ) | 12 | /*! \def CPPUNIT_TESTNAMER_DECL( variableName, FixtureType ) |
| 14 | * \brief Declares a TestNamer. | 13 | * \brief Declares a TestNamer. |
| 15 | * | 14 | * |
| 16 | * Declares a TestNamer for the specified type, using RTTI if enabled, otherwise | 15 | * Declares a TestNamer for the specified type |
| 17 | * using macro string expansion. | ||
| 18 | * | ||
| 19 | * RTTI is used if CPPUNIT_USE_TYPEINFO_NAME is defined and not null. | ||
| 20 | * | 16 | * |
| 21 | * \code | 17 | * \code |
| 22 | * void someMethod() | 18 | * void someMethod() |
| @@ -29,19 +25,11 @@ | |||
| 29 | * \relates TestNamer | 25 | * \relates TestNamer |
| 30 | * \see TestNamer | 26 | * \see TestNamer |
| 31 | */ | 27 | */ |
| 32 | #if CPPUNIT_USE_TYPEINFO_NAME | ||
| 33 | # define CPPUNIT_TESTNAMER_DECL( variableName, FixtureType ) \ | 28 | # define CPPUNIT_TESTNAMER_DECL( variableName, FixtureType ) \ |
| 34 | CPPUNIT_NS::TestNamer variableName( typeid(FixtureType) ) | 29 | CPPUNIT_NS::TestNamer variableName( typeid(FixtureType) ) |
| 35 | #else | ||
| 36 | # define CPPUNIT_TESTNAMER_DECL( variableName, FixtureType ) \ | ||
| 37 | CPPUNIT_NS::TestNamer variableName( std::string(#FixtureType) ) | ||
| 38 | #endif | ||
| 39 | |||
| 40 | |||
| 41 | 30 | ||
| 42 | CPPUNIT_NS_BEGIN | 31 | CPPUNIT_NS_BEGIN |
| 43 | 32 | ||
| 44 | |||
| 45 | /*! \brief Names a test or a fixture suite. | 33 | /*! \brief Names a test or a fixture suite. |
| 46 | * | 34 | * |
| 47 | * TestNamer is usually instantiated using CPPUNIT_TESTNAMER_DECL. | 35 | * TestNamer is usually instantiated using CPPUNIT_TESTNAMER_DECL. |
| @@ -50,12 +38,10 @@ CPPUNIT_NS_BEGIN | |||
| 50 | class CPPUNIT_API TestNamer | 38 | class CPPUNIT_API TestNamer |
| 51 | { | 39 | { |
| 52 | public: | 40 | public: |
| 53 | #if CPPUNIT_HAVE_RTTI | ||
| 54 | /*! \brief Constructs a namer using the fixture's type-info. | 41 | /*! \brief Constructs a namer using the fixture's type-info. |
| 55 | * \param typeInfo Type-info of the fixture type. Use to name the fixture suite. | 42 | * \param typeInfo Type-info of the fixture type. Use to name the fixture suite. |
| 56 | */ | 43 | */ |
| 57 | TestNamer( const std::type_info &typeInfo ); | 44 | TestNamer( const std::type_info &typeInfo ); |
| 58 | #endif | ||
| 59 | 45 | ||
| 60 | /*! \brief Constructs a namer using the specified fixture name. | 46 | /*! \brief Constructs a namer using the specified fixture name. |
| 61 | * \param fixtureName Name of the fixture suite. Usually extracted using a macro. | 47 | * \param fixtureName Name of the fixture suite. Usually extracted using a macro. |
| @@ -78,11 +64,16 @@ public: | |||
| 78 | */ | 64 | */ |
| 79 | virtual std::string getTestNameFor( const std::string &testMethodName ) const; | 65 | virtual std::string getTestNameFor( const std::string &testMethodName ) const; |
| 80 | 66 | ||
| 67 | template<typename E> | ||
| 68 | std::string getTestNameFor( const std::string& testMethodName, const E& val) const | ||
| 69 | { | ||
| 70 | return getTestNameFor(testMethodName) + " with parameter: " + CPPUNIT_NS::StringHelper::toString(val); | ||
| 71 | } | ||
| 72 | |||
| 81 | protected: | 73 | protected: |
| 82 | std::string m_fixtureName; | 74 | std::string m_fixtureName; |
| 83 | }; | 75 | }; |
| 84 | 76 | ||
| 85 | |||
| 86 | CPPUNIT_NS_END | 77 | CPPUNIT_NS_END |
| 87 | 78 | ||
| 88 | #endif // CPPUNIT_EXTENSIONS_TESTNAMER_H | 79 | #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 @@ | |||
| 2 | #define CPPUNIT_HELPER_TESTSUITEBUILDERCONTEXT_H | 2 | #define CPPUNIT_HELPER_TESTSUITEBUILDERCONTEXT_H |
| 3 | 3 | ||
| 4 | #include <cppunit/Portability.h> | 4 | #include <cppunit/Portability.h> |
| 5 | #include <cppunit/portability/CppUnitMap.h> | 5 | #include <map> |
| 6 | #include <string> | 6 | #include <string> |
| 7 | 7 | ||
| 8 | #if CPPUNIT_NEED_DLL_DECL | 8 | #if CPPUNIT_NEED_DLL_DECL |
| @@ -62,6 +62,21 @@ public: | |||
| 62 | */ | 62 | */ |
| 63 | std::string getTestNameFor( const std::string &testMethodName ) const; | 63 | std::string getTestNameFor( const std::string &testMethodName ) const; |
| 64 | 64 | ||
| 65 | /*! \brief Returns the name of the test for the specified method with the corresponding parameter. | ||
| 66 | * | ||
| 67 | * \param testMethodName Name (including a parameter) of the method that implements a test. | ||
| 68 | * \return A string that is the concatenation of the test fixture name | ||
| 69 | * (returned by getFixtureName()), \a testMethodName, | ||
| 70 | * separated using '::' and the parameter. This provides a fairly unique name for a given | ||
| 71 | * test. The parameter must be convertable to std::string through operator<< | ||
| 72 | * or a specialization of CPPUNIT_NS::StringHelper::toString needs to exist. | ||
| 73 | */ | ||
| 74 | template<typename T> | ||
| 75 | std::string getTestNameFor( const std::string &testMethodName, const T& value ) const | ||
| 76 | { | ||
| 77 | return m_namer.getTestNameFor(testMethodName, value); | ||
| 78 | } | ||
| 79 | |||
| 65 | /*! \brief Adds property pair. | 80 | /*! \brief Adds property pair. |
| 66 | * \param key PropertyKey string to add. | 81 | * \param key PropertyKey string to add. |
| 67 | * \param value PropertyValue string to add. | 82 | * \param value PropertyValue string to add. |
| @@ -81,7 +96,7 @@ protected: | |||
| 81 | // shared std::map in dll bug in VC6. | 96 | // shared std::map in dll bug in VC6. |
| 82 | // See http://www.dinkumware.com/vc_fixes.html for detail. | 97 | // See http://www.dinkumware.com/vc_fixes.html for detail. |
| 83 | typedef std::pair<std::string,std::string> Property; | 98 | typedef std::pair<std::string,std::string> Property; |
| 84 | typedef CppUnitVector<Property> Properties; | 99 | typedef std::vector<Property> Properties; |
| 85 | 100 | ||
| 86 | TestSuite &m_suite; | 101 | TestSuite &m_suite; |
| 87 | const TestNamer &m_namer; | 102 | 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 @@ | |||
| 3 | 3 | ||
| 4 | #include <cppunit/Portability.h> | 4 | #include <cppunit/Portability.h> |
| 5 | 5 | ||
| 6 | #if CPPUNIT_HAVE_RTTI | ||
| 7 | |||
| 8 | #include <typeinfo> | 6 | #include <typeinfo> |
| 9 | #include <string> | 7 | #include <string> |
| 10 | 8 | ||
| 11 | CPPUNIT_NS_BEGIN | 9 | CPPUNIT_NS_BEGIN |
| 12 | 10 | ||
| 13 | |||
| 14 | /**! \brief Helper to use type_info. | 11 | /**! \brief Helper to use type_info. |
| 15 | */ | 12 | */ |
| 16 | class CPPUNIT_API TypeInfoHelper | 13 | class CPPUNIT_API TypeInfoHelper |
| @@ -25,9 +22,6 @@ CPPUNIT_NS_BEGIN | |||
| 25 | static std::string getClassName( const std::type_info &info ); | 22 | static std::string getClassName( const std::type_info &info ); |
| 26 | }; | 23 | }; |
| 27 | 24 | ||
| 28 | |||
| 29 | CPPUNIT_NS_END | 25 | CPPUNIT_NS_END |
| 30 | 26 | ||
| 31 | #endif // CPPUNIT_HAVE_RTTI | ||
| 32 | |||
| 33 | #endif // CPPUNIT_TYPEINFOHELPER_H | 27 | #endif // CPPUNIT_TYPEINFOHELPER_H |
Swift