2 / Copyright (c) 2003 Boost.Test contributors
4 / Distributed under the Boost Software License, Version 1.0. (See accompanying
5 / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 [section:single_header_customizations Single-header variant customizations]
10 [section:entry_point Customizing the module's entry point]
12 In this usage variant, in your single translation unit, you need to define macros __BOOST_TEST_NO_MAIN__ and
13 __BOOST_TEST_ALTERNATIVE_INIT_API__ (their values are irrelevant) prior to including any of the framework's headers.
14 Next, you have to define your custom entry point, and invoke the default [link
15 boost_test.adv_scenarios.test_module_runner_overview test runner] `unit_test_main` manually with the default [link
16 boost_test.adv_scenarios.test_module_init_overview initialization function] `init_unit_test` as argument.
19 [bt_example custom_main..using custom entry point..run-fail]
21 In the above example, a custom entry point was selected because the test module, in addition to command line arguments
22 needs to obtain also the information about environment variables.
24 [note The above example also illustrates that it makes sense to define both __BOOST_TEST_MODULE__ and
25 __BOOST_TEST_NO_MAIN__. This way, no `main` is generated by the framework, but the specified name is assigned to the
26 [link boost_test.tests_organization.test_suite.master_test_suite Master Test Suite].]
28 [note The reason for defining __BOOST_TEST_ALTERNATIVE_INIT_API__ is described [link
29 boost_test.adv_scenarios.obsolete_init_func here].]
32 [endsect] [/section:entry_point]
34 [section:init_func Customizing the module's initialization function]
36 In this usage variant, you do not define macro __BOOST_TEST_MODULE__ and instead provide the definition of function
37 `init_unit_test`. This is going to be the custom initialization function. The default [link
38 boost_test.adv_scenarios.test_module_runner_overview test runner] will use it to initialize the test module.
41 [bt_example custom_init..using custom initialization function..run-fail]
43 [note Because we overwrote the default initialization function, it does no longer assign any name to the [link
44 boost_test.tests_organization.test_suite.master_test_suite master test suite]. Therefore the default name ("Master Test
47 [note The reason for defining __BOOST_TEST_ALTERNATIVE_INIT_API__ is described [link
48 boost_test.adv_scenarios.obsolete_init_func here].]
52 [endsect] [/section:init_func]
54 [endsect] [/section:single_header_customizations]