summaryrefslogtreecommitdiff
path: root/include/cppunit/extensions/TestDecorator.h
diff options
context:
space:
mode:
authorBastiaan Bakker <bastiaan.bakker@lifeline.nl>2001-04-22 22:09:57 +0000
committerBastiaan Bakker <bastiaan.bakker@lifeline.nl>2001-04-22 22:09:57 +0000
commitc910c4cc5cde77b7ef034c50058d8d5f11bd4b71 (patch)
treeb6150386cb0a000c96ac573ac161e262231ba42e /include/cppunit/extensions/TestDecorator.h
parent788f81ef8dac04bb5fd0b88cc6d0ef150c4c5a6f (diff)
downloadcppunit-c910c4cc5cde77b7ef034c50058d8d5f11bd4b71.tar.gz
Merged extension headers back in from Micheal Feathers version.
Diffstat (limited to 'include/cppunit/extensions/TestDecorator.h')
-rw-r--r--include/cppunit/extensions/TestDecorator.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/include/cppunit/extensions/TestDecorator.h b/include/cppunit/extensions/TestDecorator.h
new file mode 100644
index 0000000..54494f3
--- /dev/null
+++ b/include/cppunit/extensions/TestDecorator.h
@@ -0,0 +1,67 @@
+
+
+#ifndef CPPUNIT_TESTDECORATOR_H
+#define CPPUNIT_TESTDECORATOR_H
+
+#ifndef CPPUNIT_TEST_H
+#include "../Test.h"
+#endif
+
+namespace CppUnit {
+
+class TestResult;
+
+/*
+ * A Decorator for Tests
+ *
+ * Does not assume ownership of the test it decorates
+ *
+ */
+
+class TestDecorator : public Test
+{
+public:
+ TestDecorator (Test *test);
+ ~TestDecorator ();
+
+ int countTestCases () const;
+ void run (TestResult *result) const;
+ std::string toString () const;
+ std::string getName () const;
+
+protected:
+ Test *m_test;
+
+private:
+ TestDecorator( const TestDecorator &);
+ void operator =( const TestDecorator & );
+};
+
+
+inline TestDecorator::TestDecorator (Test *test)
+{ m_test = test; }
+
+
+inline TestDecorator::~TestDecorator ()
+{}
+
+
+inline TestDecorator::countTestCases () const
+{ return m_test->countTestCases (); }
+
+
+inline void TestDecorator::run (TestResult *result) const
+{ m_test->run (result); }
+
+
+inline std::string TestDecorator::toString () const
+{ return m_test->toString (); }
+
+
+inline std::string TestDecorator::getName () const
+{ return m_test->getName(); }
+
+} // namespace CppUnit
+
+#endif
+