summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/CppUnit/src/include/cppunit/extensions/TestNamer.h')
-rw-r--r--3rdParty/CppUnit/src/include/cppunit/extensions/TestNamer.h27
1 files changed, 9 insertions, 18 deletions
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
42CPPUNIT_NS_BEGIN 31CPPUNIT_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
50class CPPUNIT_API TestNamer 38class CPPUNIT_API TestNamer
51{ 39{
52public: 40public:
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
81protected: 73protected:
82 std::string m_fixtureName; 74 std::string m_fixtureName;
83}; 75};
84 76
85
86CPPUNIT_NS_END 77CPPUNIT_NS_END
87 78
88#endif // CPPUNIT_EXTENSIONS_TESTNAMER_H 79#endif // CPPUNIT_EXTENSIONS_TESTNAMER_H