Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Customizing the module's entry point

In this variant, in one of the source files, you now have to define your custom entry point, and invoke the default test runner unit_test_main manually with the default initialization function init_unit_test as argument. You need to define BOOST_TEST_NO_MAIN (its value is irrelevant) in the main file:

In exactly one file

In all other files

#define BOOST_TEST_MODULE test module name
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_NO_MAIN
#include <boost/test/unit_test.hpp>

// entry point:
int main(int argc, char* argv[], char* envp[])
{
  return boost::unit_test::unit_test_main( &init_unit_test, argc, argv );
}
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>

//
// test cases
//

//
// test cases
//

PrevUpHomeNext