|
Boost : |
From: Paul A Bristow (pbristow_at_[hidden])
Date: 2007-02-23 04:50:00
>-----Original Message-----
>From: boost-bounces_at_[hidden]
>[mailto:boost-bounces_at_[hidden]] On Behalf Of Gennadiy Rozental
>Sent: 23 February 2007 02:11
>To: boost_at_[hidden]
>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_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk