...one of the most highly
regarded and expertly designed C++ library projects in the
world. — Herb Sutter and Andrei
In order for a unit test module to successfully link and execute, it has
to have access to the test module's initialization function.
the module's initialization function is called only once during the execution
of the program, just before the test
module runner is run. By default, the Unit Test
Framework provides a default definition of initialization function.
The only thing you have to do is to instruct the framework in which translation
cpp file) it needs
to provide the definition. You do it by defining macro
BOOST_TEST_MODULE in the designated
file. The default implementation assigns the name to the test
module as well as the master
test suite. The name to be assigned is specified by the value of the
For a test module consisting of multiple source files you have to define
There is practically no need to ever alter the default behavior of the test module's initialization function. The Unit Test Framework provides superior tools for performing customization tasks:
BOOST_TEST_MODULEto desired value;
The default initialization function provided by the framework is defined with the following signature in the global namespace:
a successful initialization. Value
indicates initialization failure.
For overriding the default definition: