From: CppUnit development mailing list <cppunit-devel@li...> - 2006-11-16 06:10:42
The macro CPPUNIT_ASSERT_EQUAL uses a templated traits class,
CppUnit::assertion_traits<T> with member function equals() to test for =20
For the generic case, equals() is defined using operator=3D=3D(), which is
reasonable for most types. Except for floating point. Thus the macro
CPPUNIT_ASSERT_DOUBLES_EQUAL() is provided. This macro does *NOT* use
assertion_traits<double>. Rather, it uses special logic embodied in functio=
Note that since there are no specializations of assertion_traits<> provided =
CppUnit, the user is free to define their own. For example, I frequently
specialize assertion_traits<double>, defining equals() using a global =20
In revision 1.26 of include/cppunit/TestAssert.h, the specialization
assertion_traits<double> was introduced. I propose that this is a mistake
that should be reverted.
The main reason is that one can no longer define one's own specialization.
Furthermore, contrary to the comment above it, assertion_traits<double>
is *NOT* used by CPPUNIT_ASSERT_DOUBLES_EQUAL.
Get latest updates about Open Source Projects, Conferences and News.