
"Dave Steffen" <dgsteffen@numerica.us> wrote in message news:17874.12117.50555.431498@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