Boost logo

Boost Users :

From: Thijs Koerselman (thijskoerselman_at_[hidden])
Date: 2008-08-25 07:08:03


Hi,

On Mon, Aug 25, 2008 at 11:08 AM, Gennaidy Rozental <rogeeff_at_[hidden]>wrote:

>
> What you describe is well beyond newbie usage, but let me give it a try.

Newbie as in "I only just started using boost and it's the first time I try
to integrate unit testing in a project" :)

>
> > It's something like this
> > #define BOOST_TEST_NO_MAIN
> > #include <boost/test/included/unit_test.hpp>
>
> [...]
>
> > So one testing module would have a source file with something like:
> > #define BOOST_TEST_MODULE Example
> > #define BOOST_TEST_NO_MAIN
> > #include <boost/test/included/unit_test.hpp>
>
> I am not sure I follow all of the details, but the fact that you have
> single-header version of UTF included in 2 different compilation units
> seems
> suspicious and might be a source of your problem.
>

That was just the little hint I needed. All of the documentation examples
use these include statements. I didn't quite understand it was only for
single-header includes. I remember trying out the other includes
(boost/test/unit_test.hpp) but apparently I had other flags set wrong, so it
didn't compile either.

It turns out to be very simple after all. To link with the dynamic library I
now use:

#define BOOST_TEST_NO_MAIN
#define BOOST_TEST_DYN_LINK
#undef nil
#include <boost/test/unit_test.hpp>

I think I've tried every wrong combination possible before.

> > void UnitTest::run()
> > {
> > BOOST_GLOBAL_FIXTURE( MyConfig ); // setting log output
> stream etc.
> > unit_test_main( &init_mylib_test_suite, 0, 0 );
> > }
>
> Another comment: you are using yur own main. No reason to employ
> BOOST_GLOBAL_FIXTURE. Just do what you need pre and post unit test main.
>

Ah ok.

Thanks a lot for your help and your time. I can finally start testing:)

Best,
Thijs



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