[test framework] one testsuite over multiple translation units

Hi,
I am using the unittest framework from boost 1.34 and it is really
usefull (starting with the BOOST_CHECK_EQ style macros are great, since they
print out the values of the arguments, etc.).
Currently I am using a set of testsuites, i.e. one testsuite consistst
of one translation unit, and each translation unit is linked to the main
from the boost test framework (utf). Thus I get n test executables for n
testsuites.
Is it possible (and/or intended) to link a set of different testsuites in
different translation together to one test executable?
I looked at different versions of utf documentation, but couldn't find
something specific about this use case.
Currently I am using utf for the single translation unit case like this:
//testsuite_foo.cc
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MAIN
#define BOOST_TEST_MODULE foo
#include

Georg Sauthoff
Hi,
Hi, guys I am back to answer all the questions.
Is it possible (and/or intended) to link a set of different testsuites in different translation together to one test executable?
Yes. It's possible if you are not using single header variant of UTF. Moreover you can have the same test suite spawn multiple translation units if you opt to. Do you have any specific problems? Gennadiy.

Gennadiy Rozental
Georg Sauthoff
writes: Is it possible (and/or intended) to link a set of different testsuites in different translation together to one test executable?
Yes. It's possible if you are not using single header variant of UTF. Moreover you can have the same test suite spawn multiple translation units if you opt to.
Do you have any specific problems?
Yes, from the documentation I don't see how to do multiple translation
units/testsuites and linking against utf library.
I basically tried this:
//a.cc
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE a
#include

Georg Sauthoff
Do you have any specific problems?
Yes, from the documentation I don't see how to do multiple translation units/testsuites and linking against utf library.
I basically tried this: //a.cc #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE a
Thus, the question is: How to do it right?
You need to define BOOST_TEST_MODULE only in one translation unit in test module. I believe it's covered in documentation. Gennadiy

On 2008-12-19, Gennadiy Rozental
Georg Sauthoff
writes: Yes, from the documentation I don't see how to do multiple translation units/testsuites and linking against utf library.
I basically tried this: //a.cc #define BOOST_TEST_DYN_LINK #define BOOST_TEST_MODULE a
Thus, the question is: How to do it right?
You need to define BOOST_TEST_MODULE only in one translation unit in test module. I believe it's covered in documentation.
Thanks! Defining BOOST_TEST_MODULE multiple times was the problem - now it works like expected. Best regards Georg Sauthoff
participants (2)
-
Gennadiy Rozental
-
Georg Sauthoff