Boost logo

Boost :

From: Johan Nilsson (r.johan.nilsson_at_[hidden])
Date: 2006-01-31 06:56:45


Gennadiy Rozental wrote:
>>>> Please don't tell me that I no longer can specify the name of the
>>>> master test suite.
>>>
>>> No. You could. But I found relying on macro is both inconvinient and
>>> unhealthy.
>>
>> On the contrary, I found it most convenient (even though the macro
>> name is a bit misleading). Compare:
>>
>> --- w/ macro ---
>>
>> #define BOOST_AUTO_TEST_MAIN "foo"
>> #include <boost/test/auto_unit_test.hpp>
>
> Note:
>
> 1 .You are required to put the name in quotes it fales otherwise
> 2. Marco name is misleading and nonobvios(BTW proper name now is
> BOOST_TEST_MAIN)

That's what I said (the misleading part).

> 3. It's usually bad idea to give the same entity two different
> purposes. It backfire one way or another.

I agree. How about:

#include <boost/test/unit_test.hpp>
BOOST_TEST_MASTER_SUITE_NAME(foo);

> 4. It's usually preferable to employ nonmacro mechanisms, unless macro
> provide real advantage.

I can agree with that (to a certain degree).

[snip]

>
> With alternative init API (to became default 1.35 release) it would
> look like:
>
> bool init_unit_test()
> {
> framework::master_test_suite().p_name.value = "foo";
> return true;
> }

Well, to be pedantic:

#include <boost/test/unit_test.hpp>
using namespace boost::unit_test;
bool init_unit_test()
{
    framework::master_test_suite().p_name.value = "foo";
    return true;
}

>
> It doesn't look that bad.
>

Agreed.

>> ---
>>
>> As a side note, why does the above work? I'm not returning a pointer
>> to a test suite.
>
> Read an update note.

Sure.

[snip]

>
>> What would the simplest steps be to provide something similar using
>> Boost.Test? Perhaps some section in the docs for xUnit users -
>> nailing down how to get the same output / summary using Boost.Test.
>
> Most of the output is configurable by submitting custom report/log
> formatters.

I realize that, I was just looking for more of a "cookbook" example ...
"Introducing Boost.Test for CppUnit users" perhaps.

Most my points above are less than essential - they're all minor details.
The main thing is that the bugs I've seen have been fixed, and that the
documentation will hopefully be up-to-date in the 1.34 release(?).

Thanks // Johan


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk