link_reference.qbk 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. [/
  2. / Copyright (c) 2003 Boost.Test contributors
  3. /
  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)
  6. /]
  7. [section:link_references Build scenarios and behaviors]
  8. [/-----------------------------------------------------------------]
  9. [section:link_boost_test_main_macro `BOOST_TEST_MAIN`]
  10. When defined, this macro creates a stub for the test module initialization (the main entry part). This
  11. macro also expands properly into a `main` function in case the shared library variant of the __UTF__ is used.
  12. [caution This macro should
  13. # be defined before any inclusion directive to __UTF__ headers
  14. # be defined exactly for one compilation unit of your test module
  15. ]
  16. [tip The macro __BOOST_TEST_MODULE__ should be preferred]
  17. [endsect]
  18. [/-----------------------------------------------------------------]
  19. [section:link_boost_test_module_macro `BOOST_TEST_MODULE`]
  20. Serves the same purpose as the macro __BOOST_TEST_MAIN__ but, in addition, defines the name of the master test suite.
  21. [caution As __BOOST_TEST_MAIN__, this macro should
  22. # be defined before any inclusion directive to __UTF__ headers
  23. # be defined exactly for one compilation unit of your test module
  24. ]
  25. An example may be found [link ref_BOOST_TEST_MODULE here].
  26. [endsect]
  27. [/-----------------------------------------------------------------]
  28. [section:link_boost_test_alternative_init_macro `BOOST_TEST_ALTERNATIVE_INIT_API`]
  29. [warning This macro should be defined before any include directive to the __UTF__ headers and is
  30. mutually exclusive with the __BOOST_TEST_MODULE__ macro.]
  31. In case of custom initialization of the test module entry point, this macro indicates the __UTF__ to
  32. use the new API. The differences between the new and old APIs are described in [link
  33. boost_test.adv_scenarios.obsolete_init_func this section].
  34. The way to customize the entry point of the test-module depends on the variant of the __UTF__ in use.
  35. Several sections in the documentation are devoted to this:
  36. * [link boost_test.adv_scenarios.single_header_customizations.entry_point this section] for single header variant,
  37. * [link boost_test.adv_scenarios.static_lib_customizations.init_func this section] for static link variant,
  38. * [link boost_test.adv_scenarios.shared_lib_customizations.init_func this section] for shared link variant
  39. [endsect]
  40. [/-----------------------------------------------------------------]
  41. [section:link_boost_test_no_lib `BOOST_TEST_NO_LIB`]
  42. Define this flag to prevent auto-linking.
  43. [note The same flag is used for the __UTF__ and the __PEM__ components.]
  44. [endsect]
  45. [/-----------------------------------------------------------------]
  46. [section:link_boost_test_dyn_link `BOOST_TEST_DYN_LINK`]
  47. Define this flag to link against the __UTF__ shared library.
  48. [note The same flag is used for the __UTF__ and the __PEM__ components.]
  49. [endsect]
  50. [/-----------------------------------------------------------------]
  51. [section:link_boost_test_no_main `BOOST_TEST_NO_MAIN`]
  52. Prevents the auto generation of the test module initialization functions. This macro is particularly relevant for
  53. manually registered tests in conjunction with dynamic variant of the __UTF__. When defined, a `main` function
  54. registering all the tests should be implemented.
  55. An example of a module initialization would be
  56. ``
  57. #define __BOOST_TEST_NO_MAIN__
  58. #include <boost/test/unit_test.hpp>
  59. // a function in another compilation unit registering tests under the master test suite.
  60. void register_some_tests_manually(test_suite* test);
  61. bool registering_all_tests()
  62. {
  63. test_suite* test_master_suite = &boost::unit_test::framework::master_test_suite();
  64. register_some_tests_manually(test_master_suite);
  65. // register any other tests function or test suite to the master test suite
  66. // ...
  67. return true;
  68. }
  69. int main(int argc, char* argv[])
  70. {
  71. return ::boost::unit_test::unit_test_main(&registering_all_tests, argc, argv);
  72. }
  73. ``
  74. [endsect]
  75. [/-----------------------------------------------------------------]
  76. [section:link_boost_test_global_configuration `BOOST_TEST_GLOBAL_CONFIGURATION`]
  77. Declares a class that will be constructed during the initialization of the test framework, and destructed afterwards.
  78. The framework will not call any other member function than the constructor and destructor.
  79. In particular the constructor and destructor will be called prior and after to the [link boost_test.tests_organization.fixtures.global global fixtures]
  80. setup and teardown.
  81. This facility is provided to perform additional configuration, in particular programmatic configuration
  82. of the loggers and reporters. See [link boost_test.test_output.logging_api this section] for more details.
  83. [warning No logging or any other call to the framework assertion is allowed in the constructor and destructor, as its purpose is
  84. to set-up the loggers/reporters, and the assertions are calling the logging/reporting facility.
  85. Any such assertion during the execution of the will result in the abortion of the test module .]
  86. [endsect]
  87. [/-----------------------------------------------------------------]
  88. [section:config_disable_alt_stack `BOOST_TEST_DISABLE_ALT_STACK`]
  89. Disables the support of the alternative stack.
  90. Define this macro before the inclusion of any __UTF__ header to disable the support
  91. of the [@http://www.gnu.org/software/libc/manual/html_node/Signal-Stack.html alternative stack],
  92. in case your compiler does not support it and the __UTF__ cannot automatically guess the lack of support.
  93. See [link boost_test.utf_reference.rt_param_reference.use_alt_stack `use_alt_stack`]
  94. and [macroref BOOST_TEST_DISABLE_ALT_STACK `BOOST_TEST_DISABLE_ALT_STACK`] for more details.
  95. [endsect]
  96. [endsect]