|
Boost Users : |
From: Ãkos Maróy (akos_at_[hidden])
Date: 2008-06-19 07:07:28
Hi,
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:
tests1.cpp
tests2.cpp
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
-lboost_test_exec_monitor-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**)'
debug/testGeometry.o:/usr/include/boost/test/unit_test_suite.hpp:187:
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.
Akos
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