TestCase.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef CPPUNIT_TESTCASE_H
  2. #define CPPUNIT_TESTCASE_H
  3. #include <cppunit/Portability.h>
  4. #include <cppunit/TestLeaf.h>
  5. #include <cppunit/TestAssert.h>
  6. #include <cppunit/TestFixture.h>
  7. #include <string>
  8. CPPUNIT_NS_BEGIN
  9. class TestResult;
  10. /*! \brief A single test object.
  11. *
  12. * This class is used to implement a simple test case: define a subclass
  13. * that overrides the runTest method.
  14. *
  15. * You don't usually need to use that class, but TestFixture and TestCaller instead.
  16. *
  17. * You are expected to subclass TestCase is you need to write a class similiar
  18. * to TestCaller.
  19. */
  20. class CPPUNIT_API TestCase : public TestLeaf,
  21. public TestFixture
  22. {
  23. public:
  24. TestCase( const std::string &name );
  25. TestCase();
  26. ~TestCase();
  27. virtual void run(TestResult *result);
  28. std::string getName() const;
  29. //! FIXME: this should probably be pure virtual.
  30. virtual void runTest();
  31. private:
  32. TestCase( const TestCase &other );
  33. TestCase &operator=( const TestCase &other );
  34. private:
  35. const std::string m_name;
  36. };
  37. CPPUNIT_NS_END
  38. #endif // CPPUNIT_TESTCASE_H