[Cppunit-cvs] cppunit/include/cppunit TestAssert.h,1.29,1.30
Brought to you by:
blep
From: Baptiste L. <bl...@us...> - 2007-02-24 21:13:12
|
Update of /cvsroot/cppunit/cppunit/include/cppunit In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv9552/include/cppunit Modified Files: TestAssert.h Log Message: * src/cppunit/TestAssert.cpp (assertDoubleEquals): Moved finite & NaN tests to include/cppunit/portability/FloatingPoint.h. Changed implementation assertDoubleEquals to explicitly test for NaN in case of non-finite values to force equality failure in the presence of NaN. Previous implementation failed on Microsoft Visual Studio 6 (on this platform: NaN == NaN). * examples/cppunittest/TestAssertTest.cpp: Add more unit tests to test the portable floating-point primitive. Added missing include <limits>. * include/cppunit/portability/Makefile.am: * include/cppunit/portability/FloatingPoint.h: Added file. Extracted isfinite() from TestAssert.cpp. * include/cppunit/config-evc4: * include/cppunit/config-msvc6: Added support for _finite(). Index: TestAssert.h =================================================================== RCS file: /cvsroot/cppunit/cppunit/include/cppunit/TestAssert.h,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** TestAssert.h 6 Nov 2005 16:58:21 -0000 1.29 --- TestAssert.h 24 Feb 2007 21:13:04 -0000 1.30 *************** *** 110,113 **** --- 110,114 ---- * Use CPPUNIT_ASSERT_DOUBLES_EQUAL instead of this function. * \sa Asserter::failNotEqual(). + * \sa CPPUNIT_ASSERT_DOUBLES_EQUAL for detailed semantic of the assertion. */ void CPPUNIT_API assertDoubleEquals( double expected, *************** *** 219,222 **** --- 220,230 ---- /*! \brief Macro for primitive double value comparisons. * \ingroup Assertions + * + * The assertion pass if both expected and actual are finite and + * \c fabs( \c expected - \c actual ) <= \c delta. + * If either \c expected or actual are infinite (+/- inf), the + * assertion pass if \c expected == \c actual. + * If either \c expected or \c actual is a NaN (not a number), then + * the assertion fails. */ #define CPPUNIT_ASSERT_DOUBLES_EQUAL(expected,actual,delta) \ *************** *** 231,234 **** --- 239,243 ---- * user-supplied message in case of failure. * \ingroup Assertions + * \sa CPPUNIT_ASSERT_DOUBLES_EQUAL for detailed semantic of the assertion. */ #define CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE(message,expected,actual,delta) \ |