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 an older version of Boost and was released in 2019. The current version is 1.89.0.
Typically, every C++ program contains exactly one definition of function
main: the program's entry
point. When using the Unit Test Framework
you do not have to define one. Function main
will be generated for you by the framework. The only thing you are required
to do in case your program consists of more than one translation unit (cpp file) is to indicate to the framework
in which of the files it is supposed to generate function main.
You do it by defining macro BOOST_TEST_MODULE before the inclusion
of any of the framework files. The value of this macro is used as a name
of the test module as well as the
master
test suite.
The reason for defining function main
for you is twofold:
main,
and accidentally forgetting to run all the test (in which case running
the program would incorrectly indicate a clean run).
By default, the test module's entry point is defined with signature:
int main(int argc, char* argv[]);
It calls test module initialization function, then calls the test module runner and forwards its return value to environment.
The default entry point is sufficient in most of the cases. Occasionally, a need may arise to declare an entry point with a different name or signature. For overriding the definition of the default test module's entry point: