Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2007-02-22 21:10:34


"Johan Nilsson" <r.johan.nilsson_at_[hidden]> wrote in message
news:erc3he$lfo$1_at_sea.gmane.org...
>> How about a compromise:
>>
>> BOOST_CHECK_PERCENT_DIFF
>> BOOST_CHECK_RELATIVE_DIFF
>> BOOST_CHECK_EPSILON_DIFF
>> BOOST_CHECK_ABSOLUTE_DIFF (do we need this one?)
>
> I "need" it - as an example, I'm using absolute diffs to verify that the
> outcome of conversions back and forth between different coordinate systems
> are correct within a certain amount of (length) units.
>
> As I've mentioned in another place in this thread, I'd personally prefer
> to
> have the type of difference check encoded at the end of the macro names. A
> matter of personal taste, I guess.

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 ) )

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)

> I assume that the WARN/REQUIRE variants would be added as well?

Yes

Gennadiy


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk