00001 #ifndef CPPUNIT_EXTENSIONS_TESTNAMER_H
00002 #define CPPUNIT_EXTENSIONS_TESTNAMER_H
00003
00004 #include <cppunit/Portability.h>
00005 #include <string>
00006 #include <cppunit/tools/StringHelper.h>
00007
00008 #include <typeinfo>
00009
00010
00011
00028 # define CPPUNIT_TESTNAMER_DECL( variableName, FixtureType ) \
00029 CPPUNIT_NS::TestNamer variableName( typeid(FixtureType) )
00030
00031 CPPUNIT_NS_BEGIN
00032
00038 class CPPUNIT_API TestNamer
00039 {
00040 public:
00044 TestNamer( const std::type_info &typeInfo );
00045
00049 TestNamer( const std::string &fixtureName );
00050
00051 virtual ~TestNamer();
00052
00056 virtual std::string getFixtureName() const;
00057
00065 virtual std::string getTestNameFor( const std::string &testMethodName ) const;
00066
00067 template<typename E>
00068 std::string getTestNameFor( const std::string& testMethodName, const E& val) const
00069 {
00070 return getTestNameFor(testMethodName) + " with parameter: " + CPPUNIT_NS::StringHelper::toString(val);
00071 }
00072
00073 protected:
00074 std::string m_fixtureName;
00075 };
00076
00077 CPPUNIT_NS_END
00078
00079 #endif // CPPUNIT_EXTENSIONS_TESTNAMER_H
00080