Boost logo

Boost :

Subject: Re: [boost] [test] BOOST_TEST - universal testing tool
From: Gennadiy Rozenal (rogeeff_at_[hidden])
Date: 2012-11-06 07:56:35

Rhys Ulerich <rhys.ulerich <at>> writes:

> > BOOST_TEST(a == 0.003, unit_test::percent_tolerance(1e-6) );
> >
> > ...
> >
> > BOOST_TEST( expr == std::vector<int>{1,2,3,4});
> Can combine these constructs to perform floating point tests with
> tolerance on a collection?
> That is,
> BOOST_TEST( expr == std::vector<double>{1,2,3,4},
> unit_test::percent_tolerance(1e-6));

Hmmm... Good point. I'll see if this is possible.

As for "default tolerance", I am afraid it might be a bit surprising if plain
comparison of doubles suddenly will start to use tolerance without user say so.
Unless it is set to zero by default in which case we are back to usual semantic.
Once you set it to something non zero we can probably switch to "close"

What about the scope of the tolerance? Should it be global or per test case?


Boost list run by bdawes at, gregod at, cpdaniel at, john at