Boost logo

Boost :

From: Johan Nilsson (r.johan.nilsson_at_[hidden])
Date: 2007-02-23 02:32:50


Gennadiy Rozental wrote:
> "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 ) )

That would also be ok with me, and equally clear. Made me worry about
possible macro name clashes until I read the below ...

>
> We could either use macro based solution
>
> BOOST_CHECK_DIFF( a,b, c ) \
> BOOST_CHECK_DIFF_IMPL( a,b, BOOST_CHECK_DIFF_TOL_ # c )

_TOOL_ ?

>
> or function overloading based. But it could be less convinient even
> if a bit safer (from macro redefinitions)

Safety is important, but I'd still go for convenience in this case. One of
the main reasons I use Boost.Test is for convenience (auto-registration
etc).

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

Great.

/ Johan


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