
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Gennadiy Rozental Sent: 23 February 2007 02:11 To: boost@lists.boost.org Subject: Re: [boost] Boost Test Library: general floating point comparisons
There is another alternatve:
BOOST_CHECK_DIFF( a,b, PERCENT( t ) ) BOOST_CHECK_DIFF( a,b, RELATIVE( t ) ) BOOST_CHECK_DIFF( a,b, EPSILON( t ) ) BOOST_CHECK_DIFF( a,b, ABSOLUTE( t ) )
This seems unambiguous and reads well (though I would prefer DIFFERENCE spelt out in full - nearly everyone is going to use copy'n'paste fir this job rather than typing, so it isn't more trouble and reads better, especially for those whose 1st language isn't english ;-)
We could either use macro based solution
BOOST_CHECK_DIFF( a,b, c ) \ BOOST_CHECK_DIFF_IMPL( a,b, BOOST_CHECK_DIFF_TOL_ # c )
or function overloading based. But it could be less convinient even if a bit safer (from macro redefinitions)
Safely seems less (even un-) important for Unit Testing. Paul --- Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB +44 1539561830 & SMS, Mobile +44 7714 330204 & SMS pbristow@hetp.u-net.com