From c7a4dccd9f1b1fadcd47afe482c8a8ff9e05ea8f Mon Sep 17 00:00:00 2001 From: Baptiste Lepilleur Date: Mon, 11 Jun 2001 18:59:15 +0000 Subject: 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. --- src/cppunit/RepeatedTest.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/cppunit/RepeatedTest.cpp (limited to 'src/cppunit/RepeatedTest.cpp') 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 +#include + +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 -- cgit v1.2.1