1
#ifndef CPPUNIT_EXTENSIONS_TESTNAMER_H
2
#define CPPUNIT_EXTENSIONS_TESTNAMER_H
4
#include <cppunit/Portability.h>
13
/*! \def CPPUNIT_TESTNAMER_DECL( variableName, FixtureType )
14
* \brief Declares a TestNamer.
16
* Declares a TestNamer for the specified type, using RTTI if enabled, otherwise
17
* using macro string expansion.
19
* RTTI is used if CPPUNIT_USE_TYPEINFO_NAME is defined and not null.
24
* CPPUNIT_TESTNAMER_DECL( namer, AFixtureType );
25
* std::string fixtureName = namer.getFixtureName();
32
#if CPPUNIT_USE_TYPEINFO_NAME
33
# define CPPUNIT_TESTNAMER_DECL( variableName, FixtureType ) \
34
CPPUNIT_NS::TestNamer variableName( typeid(FixtureType) )
36
# define CPPUNIT_TESTNAMER_DECL( variableName, FixtureType ) \
37
CPPUNIT_NS::TestNamer variableName( std::string(#FixtureType) )
45
/*! \brief Names a test or a fixture suite.
47
* TestNamer is usually instantiated using CPPUNIT_TESTNAMER_DECL.
50
class CPPUNIT_API TestNamer
54
/*! \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.
57
TestNamer( const std::type_info &typeInfo );
60
/*! \brief Constructs a namer using the specified fixture name.
61
* \param fixtureName Name of the fixture suite. Usually extracted using a macro.
63
TestNamer( const std::string &fixtureName );
67
/*! \brief Returns the name of the fixture.
68
* \return Name of the fixture.
70
virtual std::string getFixtureName() const;
72
/*! \brief Returns the name of the test for the specified method.
73
* \param testMethodName Name of the method that implements a test.
74
* \return A string that is the concatenation of the test fixture name
75
* (returned by getFixtureName()) and\a testMethodName,
76
* separated using '::'. This provides a fairly unique name for a given
79
virtual std::string getTestNameFor( const std::string &testMethodName ) const;
82
std::string m_fixtureName;
88
#endif // CPPUNIT_EXTENSIONS_TESTNAMER_H