diff options
| author | Baptiste Lepilleur <gaiacrtn@free.fr> | 2002-08-28 21:20:52 +0000 |
|---|---|---|
| committer | Baptiste Lepilleur <gaiacrtn@free.fr> | 2002-08-28 21:20:52 +0000 |
| commit | edf9c347bd42b7940d39dd70049fb9895d3a3c5a (patch) | |
| tree | a7cc6c6c82375385c16aa2d19aec7f534a3e8614 /include/cppunit/extensions/TestFixtureFactory.h | |
| parent | 878a1e56ef0858e44310e48fa21781c13a2c0b53 (diff) | |
| download | cppunit-edf9c347bd42b7940d39dd70049fb9895d3a3c5a.tar.gz | |
Include/cppunit/Portability.
include/cppunit/Portability.h: added CPPUNIT_STATIC_CAST.
* include/cppunit/extensions/TestFixtureFactory.h: extracted from
HelperMacros.h. Added template class ConcretTestFixtureFactory.
* include/cppunit/extensions/TestSuiteBuilderContext.h:
* src/cppunit/TestSuiteBuilderContext.cpp: added. Context used
to add test case to the fixture suite. Prevent future
compatibility break for custom test API.
* include/cppunit/extensions/HelperMacros.h: mostly rewritten. No
longer use TestSuiteBuilder. Added support for abstract test fixture
through macro CPPUNIT_TEST_SUITE_END_ABSTRACT. Made custom test API
easier to use.
* examples/cppunittest/HelperMacrosTest.h:
* examples/cppunittest/HelperMacrosTest.cpp: updated against
HelperMacros.h changes.
Diffstat (limited to 'include/cppunit/extensions/TestFixtureFactory.h')
| -rw-r--r-- | include/cppunit/extensions/TestFixtureFactory.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/include/cppunit/extensions/TestFixtureFactory.h b/include/cppunit/extensions/TestFixtureFactory.h new file mode 100644 index 0000000..17a0b4a --- /dev/null +++ b/include/cppunit/extensions/TestFixtureFactory.h @@ -0,0 +1,47 @@ +#ifndef CPPUNIT_EXTENSIONS_TESTFIXTUREFACTORY_H +#define CPPUNIT_EXTENSIONS_TESTFIXTUREFACTORY_H + +#include <cppunit/Portability.h> + + +CPPUNIT_NS_BEGIN + + +class TestFixture; + +/*! \brief Abstract TestFixture factory (Implementation). + * + * Implementation detail. Use by HelperMacros to handle TestFixture hierarchy. + */ +class TestFixtureFactory +{ +public: + //! Creates a new TestFixture instance. + virtual TestFixture *makeFixture() =0; +}; + + +/*! \brief Concret TestFixture factory (Implementation). + * + * Implementation detail. Use by HelperMacros to handle TestFixture hierarchy. + */ +template<class TestFixtureType> +class ConcretTestFixtureFactory : public CPPUNIT_NS::TestFixtureFactory +{ + /*! \brief Returns a new TestFixture instance. + * \return A new fixture instance. The fixture instance is returned by + * the TestFixtureFactory passed on construction. The actual type + * is that of the fixture on which the static method suite() + * was called. + */ + TestFixture *makeFixture() + { + return new TestFixtureType(); + } +}; + + +CPPUNIT_NS_END + + +#endif // CPPUNIT_EXTENSIONS_TESTFIXTUREFACTORY_H
\ No newline at end of file |
