diff options
| author | Bastiaan Bakker <bastiaan.bakker@lifeline.nl> | 2001-04-29 13:09:16 +0000 |
|---|---|---|
| committer | Bastiaan Bakker <bastiaan.bakker@lifeline.nl> | 2001-04-29 13:09:16 +0000 |
| commit | b08ecaecc1e39b7b01e02b7b73559d8b34ff46a5 (patch) | |
| tree | bf1ed1e3680cb0256e73336e22fb70c692524fcb /src/cppunit/TestCase.cpp | |
| parent | 5ce1a68589aa3ea4f9ee255cfecc94cc1730c6fa (diff) | |
| download | cppunit-b08ecaecc1e39b7b01e02b7b73559d8b34ff46a5.tar.gz | |
Merged Baptiste Lepilleurs CppUnitW 1.2.
Some differences:
TypeInfo stuff (in TestSuite) compiled in only if USE_TYPEINFO is set.
TestSuite.getTests now returns a const ref instead of taking a ref as param.
Removed auto_ptr stuff from TestFactoryRegistry: auto_ptr cannot be used in
containers.
Diffstat (limited to 'src/cppunit/TestCase.cpp')
| -rw-r--r-- | src/cppunit/TestCase.cpp | 55 |
1 files changed, 1 insertions, 54 deletions
diff --git a/src/cppunit/TestCase.cpp b/src/cppunit/TestCase.cpp index f1e5198..5d89eaf 100644 --- a/src/cppunit/TestCase.cpp +++ b/src/cppunit/TestCase.cpp @@ -13,42 +13,6 @@ namespace CppUnit { CppUnit::TestResult* TestCase::defaultResult () { return new TestResult; } - -/// Check for a failed general assertion -void TestCase::assertImplementation (bool condition, - std::string conditionExpression, - long lineNumber, - std::string fileName) -{ - if (!condition) - throw Exception (conditionExpression, lineNumber, fileName); -} - - -/// Check for a failed equality assertion -void TestCase::assertEquals (long expected, - long actual, - long lineNumber, - std::string fileName) -{ - if (expected != actual) - assertImplementation (false, notEqualsMessage(expected, actual), lineNumber, fileName); -} - - -/// Check for a failed equality assertion -void TestCase::assertEquals (double expected, - double actual, - double delta, - long lineNumber, - std::string fileName) -{ - if (fabs (expected - actual) > delta) - assertImplementation (false, notEqualsMessage(expected, actual), lineNumber, fileName); - -} - - /// Run the test and catch any exceptions that are triggered by it void TestCase::run (TestResult *result) @@ -94,31 +58,14 @@ TestResult *TestCase::run () } - /// All the work for runTest is deferred to subclasses void TestCase::runTest () { } - -/// Build a message about a failed equality check -std::string TestCase::notEqualsMessage (long expected, long actual) -{ - return "expected: " + estring (expected) + " but was: " + estring (actual); -} - - -/// Build a message about a failed equality check -std::string TestCase::notEqualsMessage (double expected, double actual) -{ - return "expected: " + estring (expected) + " but was: " + estring (actual); -} - - - /** Constructs a test case. * \param name the name of the TestCase. - */ + **/ TestCase::TestCase (std::string name) : m_name (name) { |
