diff options
| author | Steve M. Robbins <smr@sumost.ca> | 2001-07-15 17:42:32 +0000 |
|---|---|---|
| committer | Steve M. Robbins <smr@sumost.ca> | 2001-07-15 17:42:32 +0000 |
| commit | c866084c8b86aa76c3565958fad8553c43bc3306 (patch) | |
| tree | 997582228a56fecc5db33ec6fed3e967d0aecf1b /include/cppunit | |
| parent | 08b4a5c444044db09dc5c668390e9f40663210ff (diff) | |
| download | cppunit-c866084c8b86aa76c3565958fad8553c43bc3306.tar.gz | |
TextFixture introduced. First steps at using it.
Diffstat (limited to 'include/cppunit')
| -rw-r--r-- | include/cppunit/Makefile.am | 3 | ||||
| -rw-r--r-- | include/cppunit/TestCaller.h | 4 | ||||
| -rw-r--r-- | include/cppunit/TestCase.h | 7 | ||||
| -rw-r--r-- | include/cppunit/TestFixture.h | 29 |
4 files changed, 37 insertions, 6 deletions
diff --git a/include/cppunit/Makefile.am b/include/cppunit/Makefile.am index 6e2f9f8..7cd590d 100644 --- a/include/cppunit/Makefile.am +++ b/include/cppunit/Makefile.am @@ -12,8 +12,9 @@ libcppunitinclude_HEADERS = \ Portability.h \ Test.h \ TestAssert.h \ - TestCaller.h \ + TestFixture.h \ TestCase.h \ + TestCaller.h \ TestFailure.h \ TestResult.h \ TestRegistry.h \ diff --git a/include/cppunit/TestCaller.h b/include/cppunit/TestCaller.h index 96908d0..65ae00c 100644 --- a/include/cppunit/TestCaller.h +++ b/include/cppunit/TestCaller.h @@ -1,8 +1,10 @@ #ifndef CPPUNIT_TESTCALLER_H // -*- C++ -*- #define CPPUNIT_TESTCALLER_H -#include <cppunit/TestCase.h> #include <cppunit/Exception.h> +#include <cppunit/TestCase.h> +#include <cppunit/TestFixture.h> + #if CPPUNIT_USE_TYPEINFO_NAME # include <cppunit/extensions/TypeInfoHelper.h> diff --git a/include/cppunit/TestCase.h b/include/cppunit/TestCase.h index 30124d8..4073665 100644 --- a/include/cppunit/TestCase.h +++ b/include/cppunit/TestCase.h @@ -4,6 +4,8 @@ #include <string> #include <cppunit/Test.h> #include <cppunit/TestAssert.h> +#include <cppunit/TestFixture.h> + namespace CppUnit { @@ -88,7 +90,7 @@ class TestResult; * */ -class TestCase : public Test +class TestCase : public Test, public TestFixture { public: @@ -106,9 +108,6 @@ public: virtual TestResult *run (); - virtual void setUp (); - virtual void tearDown (); - protected: //! FIXME: this should probably be pure virtual. virtual void runTest (); diff --git a/include/cppunit/TestFixture.h b/include/cppunit/TestFixture.h new file mode 100644 index 0000000..8fc840d --- /dev/null +++ b/include/cppunit/TestFixture.h @@ -0,0 +1,29 @@ +#ifndef CPPUNIT_TESTFIXTURE_H // -*- C++ -*- +#define CPPUNIT_TESTFIXTURE_H + + +namespace CppUnit { + + +/*! Wrap a test case with setUp and tearDown methods. + * + * A TestFixture is used to provide a common environment for a set + * of test cases. + * + */ +class TestFixture +{ +public: + virtual ~TestFixture() {}; + + //! \brief Set up context before running a test. + virtual void setUp() {}; + + //! Clean up after the test run. + virtual void tearDown() {}; +}; + + +} + +#endif |
