[Test] Reviving BOOST_*_CLOSE_COLLECTIONS request
Hello,
We are in the process of creating unit tests for our in-house application development and have selected Boot.Test as a library. I’ve been toying with the library for a while now and there is one feature that I feel is missing. It is the capacity to check a whole collection for close values, i.e. the “close” equivalent of BOOST_*_EQUAL_COLLECTIONS.
From what I can tell, this has already been discussed (old threads from 2007 http://boost.2283326.n4.nabble.com/Boost-Test-request-BOOST-CLOSE-COLLECTION...) and did not end-up in the library (at least from what I can tell from my version of boost (1.57). Other more recent threads (2012, http://boost.2283326.n4.nabble.com/test-BOOST-TEST-universal-testing-tool-td...) seem to suggest that the library is undergoing under the hood changes (I might be wrong here). So this request might be completely inappropriate, given the timing.
Nevertheless, I have come up with an implementation for those macros. I wanted to share them here on the list (code at the end of the mail). It might be useful for some people. If Gennadiy (library maintainer) reads this mail and finds the macros adequate for use, great. If not, too bad.
Anyhow, thanks.
Ghyslain
namespace boost_hlp
{
template
Ghyslain Leclerc
Hello,
We are in the process of creating unit tests for our in-house application development and have selected Boot.Test as a library. I’ve been toying with the library for a while now and there is one feature that I feel is missing. It is the capacity to check a whole collection for close
values,
i.e. the “close” equivalent of BOOST_*_EQUAL_COLLECTIONS.
Devel Boost.Test can do much better: BOOST_AUTO_TEST_CASE(foo) { vector<float> a, b; BOOST_TEST( a == b, tolerance(1e-5) ); BOOST_TEST( a <= b, percent_tolerance = 1e-5 ); } BOOST_TEST_DECORATOR( -tolerance = 1e-7 ) BOOST_AUTO_TEST_CASE(goo) { vector<float> a, b; BOOST_TEST( a > b ); BOOST_TEST( a != b ); } e.t.c. Gennadiy
What else is in "Devel Boost.Test"? And how can I acces?
On Thu, Dec 11, 2014 at 4:21 PM, Gennadiy Rozental
Ghyslain Leclerc
writes: Hello,
We are in the process of creating unit tests for our in-house application development and have selected Boot.Test as a library. I’ve been toying with the library for a while now and there is one feature that I feel is missing. It is the capacity to check a whole collection for close
values,
i.e. the “close” equivalent of BOOST_*_EQUAL_COLLECTIONS.
Devel Boost.Test can do much better:
BOOST_AUTO_TEST_CASE(foo) { vector<float> a, b;
BOOST_TEST( a == b, tolerance(1e-5) ); BOOST_TEST( a <= b, percent_tolerance = 1e-5 ); }
BOOST_TEST_DECORATOR( -tolerance = 1e-7 ) BOOST_AUTO_TEST_CASE(goo) { vector<float> a, b; BOOST_TEST( a > b ); BOOST_TEST( a != b ); }
e.t.c.
Gennadiy
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Chris Cleeland
Chris Cleeland
What else is in "Devel Boost.Test"? And how can I acces?
Work in progress is here: https://github.com/boostorg/test/tree/feature/quickbookdoc Gennadiy
participants (3)
-
Chris Cleeland
-
Gennadiy Rozental
-
Ghyslain Leclerc