Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost.test applicability
From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2009-06-30 15:06:13


Joel Falcou <joel.falcou <at> lri.fr> writes:

>
> I have a alrge number of numeric functions (~300) overloaded on various
> types. What I want to do is having some automated test that check if
> those functions returns proper values and behave correctly in term of

How automated? Are you going to write these assertions?

> precision. I get a look at Boost.Test but i can't really see if it's
> applicable to my need and, if it is, how exactly am I supposed to
> generate that much test and cover all cases (random value testing,
> singular value test, nan/inf handling etc...).

Boost.Test by itself do not have test suite of checks to validate your
factions. At the end of the day you are the one who will have to
implement them. Boost.Test does provides some help for you though to
simplify the task.
 
> My first idea was to use Boost.preprcoessor file iteration to quickly
> generate
> BOOST_TEST_CASE functions but I'm not sure this is a scalable practice.

You can probably use Boost.PP, but I'd recommend looking into Boost.Test's
BOOST_AUTO_TEST_CASE_TEMPLATE (http://tinyurl.com/n28zj8)

This should allow you to write single test case template and run it with a
collection of different types (if that what you need).

You can also look into BOOST_PARAM_TEST_CASE (http://tinyurl.com/maq4tj)

which will allow you to run the test assertions against different runtime
parameters.

As for the loating point comparison tools, Boost.Test provides you
several of those:

BOOST_CHECK_CLOSE, BOOST_CHECK_CLOSE_FRACTION, BOOST_CHECK_SMALL

(see reference
http://www.boost.org/doc/libs/1_39_0/libs/test/doc/html/utf/testing-tools/reference.html
for more info )

They follow slightly different logic in selecting tolerance.

> Other point, I saw that there is check in Boost.test which check for an
> arbitrary precision result. However it uses raw value (like 0.001) where
> having a check based on ULP or RMS maybe better. Is there anyway to
> integrate those test using existing test framework ?

There was a discussion about adding a tool that checks based on number of ULP.
For now you can mimic it yourself with proper tolerance specification.

Not sure what you mean by RMS,

Regards,

Gennadiy


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net