Boost logo

Boost :

From: Bjørn Roald (bjorn_at_[hidden])
Date: 2005-11-14 15:27:55


On Sunday 13 November 2005 15:43, Gennadiy Rozental wrote:
> Ok. So be it. Actually An ideal solution would be somethind like:
>
> BOOST_CHECK_CLOSE( a, b , 0.5% ) - test in percents
> BOOST_CHECK_CLOSE( a, b , 0.05) - test in epsilon
>
> But I couldn't figure out how implement it

I guess one approach would be to make percent and epsilon
small concrete types:

BOOST_CHECK_CLOSE( a, b , percent(0.5) )
BOOST_CHECK_CLOSE( a, b , epsilon(0.05))

can then both map to functions of different signatures from current
implementation which I guess take a double.

In principle you could use boost::rational
BOOST_CHECK_CLOSE( a, b , rational(3,5000))
but then the tester uses what is tested, not good :-\

Bjørn


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