Boost logo

Boost :

From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2008-03-05 04:42:52


Hello Markus,

>> The simplest way to avoid any link hassle there is to have a single
>> cpp
>> file containing
>>
>> #define BOOST_AUTO_TEST_MAIN
>> #include <boost/test/auto_unit_test.hpp>
>> #include <boost/test/included/unit_test_framework.hpp>
>
> I looked into the test program he is trying to link.
> It has a main() which does some initialization,
> and the adds some test cases. Should this be changed to
> be a init_unit_test_suite instead of main? If yes,
> does this work on all platforms, or is this just a windows thing?

For me "boost::unit_test::test_suite* init_unit_test_suite( int argc,
char* argv[] )" instead of "int main( int argc, char* argv[] )" works on
all platforms, but I'm using boost 1.34.1, so I can't tell whether this
is also true for boost 1.33.0. I have a globally defined
"BOOST_TEST_INCLUDED" (in the same way that "NDEBUG" is globally
defined) instead of the local "#define BOOST_AUTO_TEST_MAIN", but this
may also be related to boost 1.34.1.

> Also i cannot find BOOST_AUTO_TEST_MAIN anywhere in the source,
> and boost/test/unit_test.hpp is included instead of
auto_unit_test.hpp.
> unit_test_framework.hpp is also not included...

strange, for boost 1.33.0, it is used in "boost/test/auto_unit_test.hpp"
(line 211), while for boost 1.34.1, it is used in
"boost/test/detail/config.hpp" (line 98).

I think I can remember that both the globally defined
"BOOST_TEST_INCLUDED" and the locally defined "#define
BOOST_AUTO_TEST_MAIN" are "lazy" solutions that are not recommended.
Still, they are simply convenient and probably the simplest way to make
boost/test work.

Regards,
Thomas


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