CppUnit project page FAQ CppUnit home page

TestNamer.h
Go to the documentation of this file.
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 #if CPPUNIT_NEED_DLL_DECL
00041 #pragma warning( push )
00042 #pragma warning( disable: 4251 )  // X needs to have dll-interface to be used by clients of class Z
00043 #endif 
00044 
00045 CPPUNIT_NS_BEGIN
00046 
00047 
00053 class CPPUNIT_API TestNamer
00054 {
00055 public:
00056 #if CPPUNIT_HAVE_RTTI
00057 
00060   TestNamer( const std::type_info &typeInfo );
00061 #endif
00062 
00066   TestNamer( const std::string &fixtureName );
00067 
00068   virtual ~TestNamer();
00069 
00073   virtual std::string getFixtureName() const;
00074 
00082   virtual std::string getTestNameFor( const std::string &testMethodName ) const;
00083 
00084 protected:
00085   std::string m_fixtureName;
00086 };
00087 
00088 
00089 CPPUNIT_NS_END
00090 
00091 #if CPPUNIT_NEED_DLL_DECL
00092 #pragma warning( pop )
00093 #endif
00094 
00095 #endif // CPPUNIT_EXTENSIONS_TESTNAMER_H
00096 

SourceForge Logo hosts this site. Send comments to:
CppUnit Developers