From 251c1ff8aecaa608ef9e6041c2691d369430bf7b Mon Sep 17 00:00:00 2001 From: Baptiste Lepilleur Date: Sun, 14 Jul 2002 18:48:32 +0000 Subject: CodingGuideLines. CodingGuideLines.txt: added. CppUnit's coding guidelines for portability. * include/cppunit/portability/CppUnitStack.h: added. wrapper for std::stack. * include/cppunit/portability/CppUnitSet.h: added. wrapper for std::set. * include/cppunit/ui/text/TestRunner.h: fixed namespace definition for deprecated TestRunner. * include/cppunit/TestAssert.h: * src/cppunit/TestAssert.cpp: removed old deprecated functions that did not use SourceLine. Moved assertEquals() and assertDoubleEquals() into CppUnit namespace. * src/cppunit/TestFactoryRegistry.cpp: use CppUnitMap instead of std::map. * src/DllPlugInTester/CommandLineParser.h: use CppUnitDeque instead std::deque. * examples/cppunittest/*.h: * examples/cppunittest/*.cpp: removed all usage of CppUnitTest namespace. Everything is now in global space. * examples/*/*.h: * examples/*/*.cpp: replaced usage of CppUnit:: with CPPUNIT_NS::. * examples/ClockerPlugIn/ClockerModel.h: use CppUnit STL wrapper instead of STL container. --- src/cppunit/TestAssert.cpp | 55 ++++------------------------------------------ 1 file changed, 4 insertions(+), 51 deletions(-) (limited to 'src/cppunit/TestAssert.cpp') diff --git a/src/cppunit/TestAssert.cpp b/src/cppunit/TestAssert.cpp index 8d9ad80..484f372 100644 --- a/src/cppunit/TestAssert.cpp +++ b/src/cppunit/TestAssert.cpp @@ -10,55 +10,11 @@ CPPUNIT_NS_BEGIN -#ifdef CPPUNIT_ENABLE_SOURCELINE_DEPRECATED -/// Check for a failed general assertion void -TestAssert::assertImplementation( bool condition, - std::string conditionExpression, - long lineNumber, - std::string fileName ) -{ - Asserter::failIf( condition, - conditionExpression, - SourceLine( fileName, lineNumber ) ); -} - - -/// Reports failed equality -void -TestAssert::assertNotEqualImplementation( std::string expected, - std::string actual, - long lineNumber, - std::string fileName ) -{ - Asserter::failNotEqual( expected, - actual, - SouceLine( fileName, lineNumber ), "" ); -} - - -/// Check for a failed equality assertion -void -TestAssert::assertEquals( double expected, - double actual, - double delta, - long lineNumber, - std::string fileName ) -{ - if (fabs (expected - actual) > delta) - assertNotEqualImplementation( assertion_traits::toString(expected), - assertion_traits::toString(actual), - lineNumber, - fileName ); -} - -#else // CPPUNIT_ENABLE_SOURCELINE_DEPRECATED - -void -TestAssert::assertDoubleEquals( double expected, - double actual, - double delta, - SourceLine sourceLine ) +assertDoubleEquals( double expected, + double actual, + double delta, + SourceLine sourceLine ) { Asserter::failNotEqualIf( fabs( expected - actual ) > delta, assertion_traits::toString(expected), @@ -67,7 +23,4 @@ TestAssert::assertDoubleEquals( double expected, } -#endif - - CPPUNIT_NS_END -- cgit v1.2.1