Boost logo

Boost :

From: Noel Llopis (nll_pub_at_[hidden])
Date: 2005-01-11 20:38:21

On Tuesday 11 January 2005 16:32, Beman Dawes wrote:
> I beg to differ. Having to supply all that boilerplate would be a huge
> disincentive.

If that functionality were exposed separately, putting it together in one
macro with all the options you want to would be absolutely trivial. Then
all you would write is


And if that's not good enough, then you get your hands dirty and write main.

> If Gennadiy can provide addition functionality making it easier for those
> needing more startup/shutdown control, great. But it shouldn't come at
> any cost to those who don't need that functionality.

>From my point of view, it's more important to provide that functionality
than to keep the ease of use. Otherwise it might simply come a time that
you can't use it (combining it with another library that also provides its
own custom main). Fortunately, once that functionality is provided,
wrapping it in your own macro with the exact options you want is quite

The more I think about it though, the more I see that the problem lies in
the fact that Boost.Test is trying to do double-duty. On one hand, it's a
unit-test framework to efficiently create and run unit tests. On the other
hand, it's a part of the Boost.Test library, and tries to conform to
certain outputs and command-line arguments, and that's why main is tightly

Those two aspects should really be separated. The Boost.Test component can
provide a main function that parses the command-line in a certain way, and
calls the unit test framework accordingly. But people should also be free
to use the unit test framework without being tied to that.

For example, I might want to set different options (like what log to use)
based on a command-line parameter, or set exception-handling on/off based
on whether the debugger is present.

Another way of separating those two aspects would be simply to create
another library with what's right now in test_main.cpp. If you link to that
library, you get the standard main. Otherwise you need to provide your own.

Does that make sense?

Games from Within

Boost list run by bdawes at, gregod at, cpdaniel at, john at