Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2007-02-13 17:30:29


"Dave Steffen" <dgsteffen_at_[hidden]> wrote in message
news:17874.12117.50555.431498_at_yttrium.numerica.us...
>
> Hi folks,
>
> This is probably a question aimed at Gennadiy Rozental, but it may be
> of interest to the community in general.
>
> We've been using the boost test library for about a year and a half
> now, and are happy customers. I'm revamping our unit test framework
> (e.g. revisiting the way we use boost test), and am specifically
> looking at the floating point comparisons.
>
> One thing that I'm changing / hacking is the use of percentages to
> specify tolerance. We usually want answers to agree to (say) 1 part
> in 10^-12, and remembering to multiply or divide that by 100 is
> annoying.

1.34 RC version of Boost.Test contains both BOOST_CHECK_CLOSE and
BOOST_CHECK_CLOSE_FRACTION. Later is what you probably you want to use.
boost/test/floating_point_comparison.hpp contains now algorithms for both
types of comparison.

> Fine. Now, we want to be able to compare more complicated
> mathematical objects, such as vectors and matrices.
>
> After some thought, we decided the responsibility for providing such
> functions is the responsibility of the mathematical object, not the
> unit test framework. That is to say, a function "relative difference
> between matrices" should be in Matrix.h, not some unit test thing.

Yes. That's what is expected. You may use BOOST_CHECK_PREDICATE after that.

> Which leads to the idea of Matrix.h #including
> "boost/test/floating_point_comparison.hpp", which strikes me as rather
> odd.

I don't see anything wrong with that. The header itself is standalone and
does not casue a lot of dependencies.

Gennadiy


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