Boost logo

Boost Users :

Subject: Re: [Boost-users] [Test] main for BOOST_TEST_DYN_LINK with manual registration
From: Rhys Ulerich (rhys.ulerich_at_[hidden])
Date: 2012-05-25 17:39:50


> What from example 15 from the Boost.Test "Manually registered test
> suites" documentation[1] needs to change if instead of
>   #include <boost/test/included/unit_test.hpp>
> one used
>   #define BOOST_TEST_DYN_LINK
>   #include <boost/test/unit_test.hpp>
> ?
>
> [1] http://www.boost.org/doc/libs/1_49_0/libs/test/doc/html/utf/user-guide/test-organization/manual-test-suite.html

This appears to work but I would certainly appreciate a prettier solution...

#ifdef BOOST_TEST_ALTERNATIVE_INIT_API
bool init_unit_test() {
#else
::boost::unit_test::test_suite*
init_unit_test_suite( int, char* [] ) {
#endif

  // Register some stuff

#ifdef BOOST_TEST_ALTERNATIVE_INIT_API
    return true;
}
#else
    return 0;
}
#endif

int main( int argc, char* argv[] )
{
#ifdef BOOST_TEST_ALTERNATIVE_INIT_API
    return ::boost::unit_test::unit_test_main( &init_unit_test, argc, argv );
#else
    return ::boost::unit_test::unit_test_main( &init_unit_test_suite,
argc, argv );
#endif
}

Regardless of the prettiness of the solution, this would be helpful to
include in the manual at
http://www.boost.org/doc/libs/1_49_0/libs/test/doc/html/utf/user-guide/test-organization/manual-test-suite.html

- Rhys


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