diff options
Diffstat (limited to 'examples/cppunittest/TestSetUpTest.h')
-rw-r--r-- | examples/cppunittest/TestSetUpTest.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/examples/cppunittest/TestSetUpTest.h b/examples/cppunittest/TestSetUpTest.h new file mode 100644 index 0000000..854be0a --- /dev/null +++ b/examples/cppunittest/TestSetUpTest.h @@ -0,0 +1,59 @@ +#ifndef TESTSETUPTEST_H +#define TESTSETUPTEST_H + +#include <cppunit/extensions/HelperMacros.h> +#include <cppunit/extensions/TestSetUp.h> +#include "FailingTestCase.h" + + +class TestSetUpTest : public CppUnit::TestCase +{ + CPPUNIT_TEST_SUITE( TestSetUpTest ); + CPPUNIT_TEST( testRun ); + CPPUNIT_TEST_SUITE_END(); + +public: + TestSetUpTest(); + virtual ~TestSetUpTest(); + + virtual void setUp(); + virtual void tearDown(); + + void testRun(); + +private: + class SetUp : public CppUnit::TestSetUp + { + public: + SetUp( CppUnit::Test *test ) : + TestSetUp( test ), + m_setUpCalled( false ), + m_tearDownCalled( false ) + { + } + + void setUp() + { + m_setUpCalled = true; + } + + void tearDown() + { + m_tearDownCalled = true; + } + + bool m_setUpCalled; + bool m_tearDownCalled; + }; + + TestSetUpTest( const TestSetUpTest © ); + void operator =( const TestSetUpTest © ); + +private: + SetUp *m_setUp; + FailingTestCase *m_test; +}; + + + +#endif // TESTSETUPTEST_H |