Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.Test] reporting tests with warnings
From: Richard (legalize+jeeves_at_[hidden])
Date: 2011-11-20 01:03:40


[Please do not mail me a copy of your followup]

boost-users_at_[hidden] spake the secret code
<4EC71EEB.6000206_at_[hidden]> thusly:

>BOOST_AUTO_TEST_CASE(test_f)
>{
> BOOST_CHECK_EQUAL(f(0), 0);
> BOOST_CHECK_EQUAL(f(1), 1);
> BOOST_CHECK_EQUAL(f(2), 1);
> BOOST_CHECK_EQUAL(f(6), 8);
> BOOST_CHECK_EQUAL(f(15), 610);
> BOOST_CHECK_EQUAL(f(47), 2971215073);
>}

IMO, this is poor test design because its testing a whole bunch of
different scenarios in a single test.

>BOOST_AUTO_TEST_CASE(test_C)
>{
> C c1(1, 2);
> C c2(3, 4);
> C c3 = c1 * c2;
>
> BOOST_CHECK_EQUAL(c3.real(), -5);
> BOOST_CHECK_EQUAL(c3.imag(), 10);
>}

In this case the problem is that you're testing equality by pieces
instead of by the whole.

Again, all my opinion, but I find the above tests poorly written.

-- 
"The Direct3D Graphics Pipeline" -- DirectX 9 version available for download
 <http://legalizeadulthood.wordpress.com/the-direct3d-graphics-pipeline/>
      Legalize Adulthood! <http://legalizeadulthood.wordpress.com>

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