Boost logo

Boost Users :

From: Ákos Maróy (akos_at_[hidden])
Date: 2008-06-19 07:07:28


I'm trying to use the boost unit test framework, and I have a question
regarding automatic test module registration and the automatic
definition of the init_unit_test_suite() function.

I'm organizing unit tests into a range of source files:


where each file is set up as follows:

#define BOOST_TEST_MODULE moduleX
#include <boost/test/unit_test.hpp>

BOOST_AUTO_TEST_CASE(test1) { ... }
BOOST_AUTO_TEST_CASE(test2) { ... }

and I'm linking this all with -lboost_unit_test_framework-mt

Intersestingly, as soon as I have two or more test module files, I get
the following linker error:

/usr/include/boost/test/unit_test_suite.hpp:187: multiple definition of
`init_unit_test_suite(int, char**)'
first defined here

This seems to be a bit counter-intuitive - after all, isn't one supposed
to be able to use a number of test modules as above? (for me,
intuitively, yes :)

but if this is not the intended way of using the boost unit test
library, how would one go about this using auto-registration? it would
be really nice to spare the hassle of manual registration, but still be
able to partition test cases into separate modules / files.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at