summaryrefslogtreecommitdiff
path: root/src/cppunit/RepeatedTest.cpp
diff options
context:
space:
mode:
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