summaryrefslogtreecommitdiff
path: root/src/cppunit/RepeatedTest.cpp
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2001-06-11 18:59:15 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2001-06-11 18:59:15 +0000
commitc7a4dccd9f1b1fadcd47afe482c8a8ff9e05ea8f (patch)
treef0bb90d0fd555bbf07646380c6cab7bf06254620 /src/cppunit/RepeatedTest.cpp
parent1806e9640462461fba3e1149c7b2c4a31805ec5e (diff)
downloadcppunit-c7a4dccd9f1b1fadcd47afe482c8a8ff9e05ea8f.tar.gz
Include/cppunit/NotEqualException.
include/cppunit/NotEqualException.cpp: addded, exception to be used with assertEquals(). * src/cppunit/RepeatedTest.cpp: added to reduce header dependency (TestResult.h was missing). * src/cppunit/TestAssert.cpp: added to put non template functions there. * src/cppunit/TestCase.cpp: added std:: prefix to catch (exception& e). Integrated a modified version of Tim Jansen patch (#403745) for TestCase to make the unit test (TestCaseTest) pass. If the setUp() fail then neither the runTest() nor the tearDown() method is called.
Diffstat (limited to 'src/cppunit/RepeatedTest.cpp')
-rw-r--r--src/cppunit/RepeatedTest.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/cppunit/RepeatedTest.cpp b/src/cppunit/RepeatedTest.cpp
new file mode 100644
index 0000000..10f99d0
--- /dev/null
+++ b/src/cppunit/RepeatedTest.cpp
@@ -0,0 +1,37 @@
+#include <cppunit/extensions/RepeatedTest.h>
+#include <cppunit/TestResult.h>
+
+namespace CppUnit {
+
+
+
+// Counts the number of test cases that will be run by this test.
+int
+RepeatedTest::countTestCases()
+{
+ return TestDecorator::countTestCases () * m_timesRepeat;
+}
+
+
+// Returns the name of the test instance.
+std::string
+RepeatedTest::toString()
+{
+ return TestDecorator::toString () + " (repeated)";
+}
+
+// Runs a repeated test
+void
+RepeatedTest::run( TestResult *result )
+{
+ for ( int n = 0; n < m_timesRepeat; n++ )
+ {
+ if ( result->shouldStop() )
+ break;
+
+ TestDecorator::run( result );
+ }
+}
+
+
+} // namespace TestAssert