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 <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_CASE( foo_bar )
{
}
And to compile it:
$ g++ testsuite_foo.cc -lboost_unit_test_framework
How do you use the utf regarding to this aspect?
Best regards
Georg Sauthoff
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
> 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.
> 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 <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_CASE( foo )
{
}
//b.cc
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE b
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_CASE( bar )
{
}
//main.cc
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
$ g++ -c a.cc
$ g++ -c b.cc
$ g++ -c main.cc
$ g++ a.o b.o main.o -lboost_unit_test_framework
b.o: In function `main':
b.cc:(.text+0x21c): multiple definition of `main'
a.o:a.cc:(.text+0x21c): first defined here
b.o: In function `init_unit_test()':
b.cc:(.text+0x250): multiple definition of `init_unit_test()'
a.o:a.cc:(.text+0x250): first defined here
main.o: In function `init_unit_test()':
main.cc:(.text+0x0): multiple definition of `init_unit_test()'
a.o:a.cc:(.text+0x250): first defined here
main.o: In function `main':
main.cc:(.text+0x168): multiple definition of `main'
a.o:a.cc:(.text+0x21c): first defined here
collect2: ld returned 1 exit status
Sure, this usage is just a wild guess, extrapolated from the working single
translation unit usage I posted in the original mail. Perhaps I
overlooked it in the boost utf documentation, but I found nothing
specific about this use case there.
Thus, the question is: How to do it right?
Best regards
Georg
> > 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
>> 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