00001 #ifndef CPPUNIT_EXTENSIONS_TESTNAMER_H
00002 #define CPPUNIT_EXTENSIONS_TESTNAMER_H
00003 
00004 #include <cppunit/Portability.h>
00005 #include <string>
00006 
00007 #if CPPUNIT_HAVE_RTTI
00008 #  include <typeinfo>
00009 #endif
00010 
00011 
00012 
00032 #if CPPUNIT_USE_TYPEINFO_NAME
00033 #  define CPPUNIT_TESTNAMER_DECL( variableName, FixtureType )       \
00034               CPPUNIT_NS::TestNamer variableName( typeid(FixtureType) )
00035 #else
00036 #  define CPPUNIT_TESTNAMER_DECL( variableName, FixtureType )       \
00037               CPPUNIT_NS::TestNamer variableName( std::string(#FixtureType) )
00038 #endif
00039 
00040 
00041 
00042 CPPUNIT_NS_BEGIN
00043 
00044 
00050 class CPPUNIT_API TestNamer
00051 {
00052 public:
00053 #if CPPUNIT_HAVE_RTTI
00054 
00057   TestNamer( const std::type_info &typeInfo );
00058 #endif
00059 
00063   TestNamer( const std::string &fixtureName );
00064 
00068   virtual std::string getFixtureName() const;
00069 
00077   virtual std::string getTestNameFor( const std::string &testMethodName ) const;
00078 
00079 protected:
00080   std::string m_fixtureName;
00081 };
00082 
00083 
00084 CPPUNIT_NS_END
00085 
00086 #endif // CPPUNIT_EXTENSIONS_TESTNAMER_H
00087