TestFixtureFactory.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef CPPUNIT_EXTENSIONS_TESTFIXTUREFACTORY_H
  2. #define CPPUNIT_EXTENSIONS_TESTFIXTUREFACTORY_H
  3. #include <cppunit/Portability.h>
  4. CPPUNIT_NS_BEGIN
  5. class TestFixture;
  6. /*! \brief Abstract TestFixture factory (Implementation).
  7. *
  8. * Implementation detail. Use by HelperMacros to handle TestFixture hierarchy.
  9. */
  10. class TestFixtureFactory
  11. {
  12. public:
  13. //! Creates a new TestFixture instance.
  14. virtual TestFixture *makeFixture() =0;
  15. virtual ~TestFixtureFactory() {}
  16. };
  17. /*! \brief Concret TestFixture factory (Implementation).
  18. *
  19. * Implementation detail. Use by HelperMacros to handle TestFixture hierarchy.
  20. */
  21. template<class TestFixtureType>
  22. class ConcretTestFixtureFactory : public CPPUNIT_NS::TestFixtureFactory
  23. {
  24. /*! \brief Returns a new TestFixture instance.
  25. * \return A new fixture instance. The fixture instance is returned by
  26. * the TestFixtureFactory passed on construction. The actual type
  27. * is that of the fixture on which the static method suite()
  28. * was called.
  29. */
  30. TestFixture *makeFixture()
  31. {
  32. return new TestFixtureType();
  33. }
  34. };
  35. CPPUNIT_NS_END
  36. #endif // CPPUNIT_EXTENSIONS_TESTFIXTUREFACTORY_H