testing_tools_reference.qbk 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  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:testing_tool_ref Reference API for writing tests]
  8. [/ ###############################################################################################]
  9. [section:assertion_boost_test_universal_macro `BOOST_TEST`]
  10. ``
  11. BOOST_TEST(statement);
  12. BOOST_TEST_<level>(statement);
  13. // replacement failure message, requires variadic macros
  14. BOOST_TEST(statement, "failure message");
  15. // Floating point comparison, requires variadic macros, auto and decltype
  16. BOOST_TEST(statement, floating_point_comparison_manipulation);
  17. // bitwise comparison, requires variadic macros, auto and decltype
  18. BOOST_TEST(statement, boost::test_tools::bitwise() );
  19. // element-wise comparison, for containers
  20. BOOST_TEST(statement, boost::test_tools::per_element() );
  21. // lexicographic comparison, for containers
  22. BOOST_TEST(statement, boost::test_tools::lexicographic() );
  23. ``
  24. The full documentation of this macro is located [link boost_test.testing_tools.boost_test_universal_macro here].
  25. The macro is available in three variants, corresponding to different [link boost_test.testing_tools.tools_assertion_severity_level assertion severity levels]:
  26. ``
  27. BOOST_TEST // or BOOST_TEST_CHECK
  28. BOOST_TEST_REQUIRE
  29. BOOST_TEST_WARN
  30. ``
  31. * `"failure message"` is a C-string printed in case of failure in place of the default message.
  32. See [link boost_test.testing_tools.reports this section] for
  33. more details.
  34. * `floating_point_comparison_manipulation` is one of the floating point comparison manipulators.
  35. See [link boost_test.testing_tools.boost_test_universal_macro this section]
  36. for more details.
  37. * [classref boost::test_tools::bitwise] is a manipulator indicating that the comparison should be performed bitwise. See
  38. [link boost_test.testing_tools.extended_comparison.bitwise this section] for more details
  39. * [classref boost::test_tools::per_element] is a manipulator indicating that the comparison should be performed on each element, in sequence, rather
  40. than on containers. See
  41. [link boost_test_coll_perelement this section] for more details
  42. * [classref boost::test_tools::lexicographic] is a manipulator indicating that the comparison should be performed with the lexicographic order. See
  43. [link boost_test_coll_default_lex this section] for more details
  44. [h3 Limitations and workaround]
  45. There are some restrictions on the statements that are supported by this tool. Those are explained in details in
  46. [link boost_test_statement_limitations this] section.
  47. [endsect]
  48. [/ DECORATORS ###############################################################################################]
  49. [/-----------------------------------------------------------------]
  50. [section:decorator_expected_failures expected_failures (decorator)]
  51. ``
  52. expected_failures(counter_t number);
  53. ``
  54. Indicates the expected failures for a test unit.
  55. See [link boost_test.testing_tools.expected_failures here] for more details.
  56. [endsect] [/ section expected_failures]
  57. [/-----------------------------------------------------------------]
  58. [section:decorator_timeout timeout (decorator)]
  59. ``
  60. timeout(unsigned int seconds);
  61. ``
  62. Specifies a time-out for a *test-case* or a *test-suite*, in wall-clock time.
  63. If a test-case lasts longer than the timeout, the test is flagged as failed. On some systems (see below),
  64. the test-case is forced to stop.
  65. For test-suites, the mechanism is similar: every test-unit under the test-suite is allocated a maximum
  66. duration time that is the remainder of the timeout after the previous tests have been executed. If a timeout occurs
  67. during the execution of the suite, the suite is flagged as timed-out and the remaining test-units are skipped.
  68. See [link boost_test.testing_tools.timeout here] for more details.
  69. [note The macro
  70. `BOOST_SIGACTION_BASED_SIGNAL_HANDLING` is defined
  71. if Boost.Test is able to force the test-case to stop.]
  72. [note The support for test suites has been added in [link ref_CHANGE_LOG_3_10 Boost 1.70 / __UTF__ v3.10]]
  73. [endsect] [/ section timeout]
  74. [/-----------------------------------------------------------------]
  75. [section:decorator_tolerance tolerance (decorator)]
  76. ``
  77. template <typename FPT>
  78. tolerance(FPT eps);
  79. template <typename FPT>
  80. tolerance(test_tools::fpc::percent_tolerance_t<FPT> eps)
  81. ``
  82. Decorator `tolerance` specifies the default comparison tolerance for floating point type `FTP` in the decorated test
  83. unit. The default tolerance only applies to a particular type, so it makes sense to provide more than one `tolerance`
  84. decorator if we are comparing different floating point types.
  85. The variant with `percent_tolerance` uses value ``eps / 100`` as tolerance.
  86. [note For more details see the
  87. [link boost_test.testing_tools.extended_comparison.floating_point floating points comparison] section.
  88. ]
  89. [bt_example decorator_13..decorator tolerance..run-fail]
  90. In the above example, in `test1`, checks on `double`s fail because they differ by more what tolerance for `double`s
  91. specifies. In `test2` the tolerance for `double`s is greater and therefore the checks succeed. In `test3`, we specify
  92. only tolerance for type `float`, and since the checks use type `double` the specified tolerance does not apply. Tolerance
  93. in `test4` is equivalent to that in `test1`, therefore its checks also fail. Tolerance in `test5` is equivalent to
  94. that in `test2`, therefore its checks also succeed.
  95. [endsect] [/ section decorator_tolerance]
  96. [/ DEPRECATED API]
  97. [/ ###############################################################################################]
  98. [#ref_BOOST_level][section:assertion_boost_level `BOOST_<level>`]
  99. ``
  100. BOOST_WARN(predicate);
  101. BOOST_CHECK(predicate);
  102. BOOST_REQUIRE(predicate);
  103. ``
  104. These tools are used to validate the predicate value. The only parameter for these tools is a boolean predicate
  105. value that gets validated. It could be any expression that could be evaluated and converted to boolean value. The
  106. expression gets evaluated only once, so it's safe to pass complex expression for validation.
  107. [bt_example example34..BOOST_<level> usage..run-fail]
  108. See also:
  109. * __BOOST_LEVEL_MESSAGE__
  110. [endsect]
  111. [/ ###############################################################################################]
  112. [section:assertion_boost_level_bitwise_eq `BOOST_<level>_BITWISE_EQUAL`]
  113. ``
  114. BOOST_WARN_BITWISE_EQUAL(left, right);
  115. BOOST_CHECK_BITWISE_EQUAL(left, right);
  116. BOOST_REQUIRE_BITWISE_EQUAL(left, right);
  117. ``
  118. These tools are used to perform bitwise comparison of two values. The check shows all positions where left and
  119. right value's bits mismatch.
  120. The first parameter is the left compared value. The second parameter is the right compared value. Parameters are
  121. not required to be of the same type, but warning is issued if their type's size does not coincide.
  122. [bt_example example33..BOOST_<level>_BITWISE_EQUAL usage..run-fail]
  123. See also:
  124. * __BOOST_LEVEL_EQUAL__
  125. [endsect]
  126. [/ ###############################################################################################]
  127. [section:assertion_boost_level_eq `BOOST_<level>_EQUAL`]
  128. ``
  129. BOOST_WARN_EQUAL(left, right);
  130. BOOST_CHECK_EQUAL(left, right);
  131. BOOST_REQUIRE_EQUAL(left, right);
  132. ``
  133. Check performed by these tools is the same as the one performed by `__BOOST_LEVEL__(left == right)`.
  134. The difference is that the mismatched values are reported as well.
  135. [note It is bad idea to use these tools to compare floating point values. Use __BOOST_LEVEL_CLOSE__ or
  136. __BOOST_LEVEL_CLOSE_FRACTION__ tools instead.
  137. ]
  138. [bt_example example35..BOOST_<level>_EQUAL usage..run-fail]
  139. See also:
  140. * __BOOST_LEVEL__
  141. * __BOOST_LEVEL_CLOSE__
  142. * __BOOST_LEVEL_NE__
  143. * __BOOST_LEVEL_EQUAL_COLLECTIONS__
  144. [endsect]
  145. [/ ###############################################################################################]
  146. [section:assertion_boost_level_eq_collections `BOOST_<level>_EQUAL_COLLECTIONS`]
  147. ``
  148. BOOST_WARN_EQUAL_COLLECTIONS(left_begin, left_end, right_begin, right_end);
  149. BOOST_CHECK_EQUAL_COLLECTIONS(left_begin, left_end, right_begin, right_end);
  150. BOOST_REQUIRE_EQUAL_COLLECTIONS(left_begin, left_end, right_begin, right_end);
  151. ``
  152. These tools are used to perform an element by element comparison of two collections. They print all mismatched
  153. positions, collection elements at these positions and check that the collections have the same size. The first two
  154. parameters designate begin and end of the first collection. The two last parameters designate begin and end of the
  155. second collection.
  156. [bt_example example36..BOOST_<level>_EQUAL_COLLECTIONS usage..run-fail]
  157. See also:
  158. * __BOOST_LEVEL_EQUAL__
  159. [endsect]
  160. [/ ###############################################################################################]
  161. [section:assertion_boost_level_close `BOOST_<level>_CLOSE`]
  162. ``
  163. BOOST_WARN_CLOSE(left, right, tolerance);
  164. BOOST_CHECK_CLOSE(left, right, tolerance);
  165. BOOST_REQUIRE_CLOSE(left, right, tolerance);
  166. ``
  167. These tools are used to check on closeness using strong relationship defined by the predicate
  168. ``check_is_close( left, right, tolerance )``
  169. To check for the weak relationship use
  170. __BOOST_LEVEL_PREDICATE__ family of tools with explicit `check_is_close` invocation.
  171. The first parameter is the ['left] compared value. The second parameter is the
  172. ['right] compared value. Last third parameter defines the tolerance for the comparison in
  173. [link boost_test.testing_tools.extended_comparison.floating_point [*percentage units]].
  174. [note It is required for left and right parameters to be of the same floating point type. You will need to explicitly
  175. resolve any type mismatch to select which type to use for comparison.
  176. ]
  177. [note The floating point comparison tools are automatically added if the __UTF__
  178. is included as indicated in the previous sections. The tools are implemented is in the header
  179. [headerref boost/test/tools/floating_point_comparison.hpp `boost/test/tools/floating_point_comparison.hpp`].]
  180. [bt_example example42..BOOST_<level>_CLOSE usage with small values..run-fail]
  181. [bt_example example43..BOOST_<level>_CLOSE usage with big values..run]
  182. See also:
  183. * __BOOST_LEVEL_CLOSE_FRACTION__
  184. * __BOOST_LEVEL_SMALL__
  185. * __BOOST_LEVEL_EQUAL__
  186. * __floating_points_testing_tools__
  187. [endsect]
  188. [/ ###############################################################################################]
  189. [section:assertion_boost_level_close_fraction `BOOST_<level>_CLOSE_FRACTION`]
  190. ``
  191. BOOST_WARN_CLOSE_FRACTION(left, right, tolerance);
  192. BOOST_CHECK_CLOSE_FRACTION(left, right, tolerance);
  193. BOOST_REQUIRE_CLOSE_FRACTION(left, right, tolerance);
  194. ``
  195. These tools are used to check on closeness using strong relationship defined by the predicate
  196. ``check_is_close(left, right, tolerance)``
  197. To check for the weak relationship use __BOOST_LEVEL_PREDICATE__ family of tools with explicit `check_is_close` invocation.
  198. The first parameter is the ['left] compared value. The second parameter is the
  199. ['right] compared value. Last third parameter defines the tolerance for the comparison as
  200. [link boost_test.testing_tools.extended_comparison.floating_point [*fraction of absolute values being compared]].
  201. [note It is required for left and right parameters to be of the same floating point type. You will need to explicitly
  202. resolve any type mismatch to select which type to use for comparison.]
  203. [note The floating point comparison tools are automatically added if the __UTF__
  204. is included as indicated in the previous sections. The tools are implemented is in the header
  205. [headerref boost/test/tools/floating_point_comparison.hpp `boost/test/tools/floating_point_comparison.hpp`].]
  206. [bt_example example44..BOOST_<level>_CLOSE_FRACTION usage..run-fail]
  207. See also:
  208. * __BOOST_LEVEL_CLOSE__
  209. * __BOOST_LEVEL_SMALL__
  210. * __BOOST_LEVEL_EQUAL__
  211. * __floating_points_testing_tools__
  212. [endsect]
  213. [/ ###############################################################################################]
  214. [section:assertion_boost_level_ge `BOOST_<level>_GE`]
  215. ``
  216. BOOST_WARN_GE(left, right);
  217. BOOST_CHECK_GE(left, right);
  218. BOOST_REQUIRE_GE(left, right);
  219. ``
  220. Check performed by these tools is the same as the one performed by `__BOOST_LEVEL__( left >= right )`.
  221. The difference is that the argument values are reported as well.
  222. [bt_example example57..BOOST_<level>_GE usage..run-fail]
  223. See also:
  224. * __BOOST_LEVEL_LE__
  225. * __BOOST_LEVEL_LT__
  226. * __BOOST_LEVEL_GT__
  227. [endsect]
  228. [/ ###############################################################################################]
  229. [section:assertion_boost_level_gt `BOOST_<level>_GT`]
  230. ``
  231. BOOST_WARN_GT(left, right);
  232. BOOST_CHECK_GT(left, right);
  233. BOOST_REQUIRE_GT(left, right);
  234. ``
  235. Check performed by these tools is the same as the one performed by __BOOST_LEVEL__`( left > right )`.
  236. The difference is that the argument values are reported as well.
  237. [bt_example example58..BOOST_<level>_GT usage..run-fail]
  238. See also:
  239. * __BOOST_LEVEL_LE__
  240. * __BOOST_LEVEL_LT__
  241. * __BOOST_LEVEL_GE__
  242. [endsect]
  243. [/ ###############################################################################################]
  244. [section:assertion_boost_level_le `BOOST_<level>_LE`]
  245. ``
  246. BOOST_WARN_LE(left, right);
  247. BOOST_CHECK_LE(left, right);
  248. BOOST_REQUIRE_LE(left, right);
  249. ``
  250. Check performed by these tools is the same as the one performed by `__BOOST_LEVEL__( left <= right )`.
  251. The difference is that the argument values are reported as well.
  252. [bt_example example55..BOOST_<level>_LE usage..run-fail]
  253. See also:
  254. * __BOOST_LEVEL_LE__
  255. * __BOOST_LEVEL_GE__
  256. * __BOOST_LEVEL_GT__
  257. [endsect]
  258. [/ ###############################################################################################]
  259. [section:assertion_boost_level_lt `BOOST_<level>_LT`]
  260. ``
  261. BOOST_WARN_LT(left, right);
  262. BOOST_CHECK_LT(left, right);
  263. BOOST_REQUIRE_LT(left, right);
  264. ``
  265. Check performed by these tools is the same as the one performed by `__BOOST_LEVEL__( left < right )`.
  266. The difference is that the argument values are reported as well.
  267. [bt_example example56..BOOST_<level>_LT usage..run-fail]
  268. See also:
  269. * __BOOST_LEVEL_LE__
  270. * __BOOST_LEVEL_GE__
  271. * __BOOST_LEVEL_GT__
  272. [endsect]
  273. [/ ###############################################################################################]
  274. [section:assertion_boost_level_message `BOOST_<level>_MESSAGE`]
  275. ``
  276. BOOST_WARN_MESSAGE(predicate, message);
  277. BOOST_CHECK_MESSAGE(predicate, message);
  278. BOOST_REQUIRE_MESSAGE(predicate, message);
  279. ``
  280. These tools perform exactly the same check as __BOOST_LEVEL__ tools. The only difference is that
  281. instead of generating an error/confirm message these use the supplied one.
  282. The first parameter is the boolean expression. The second parameter is the message reported in case of check
  283. failure. The message argument can be constructed of components of any type supporting the
  284. `std::ostream& operator<<(std::ostream&)`.
  285. [bt_example example38..BOOST_<level>_MESSAGE usage..run]
  286. See also:
  287. * __BOOST_LEVEL__
  288. [endsect]
  289. [/ ###############################################################################################]
  290. [section:assertion_boost_level_ne `BOOST_<level>_NE`]
  291. ``
  292. BOOST_WARN_NE(left, right);
  293. BOOST_CHECK_NE(left, right);
  294. BOOST_REQUIRE_NE(left, right);
  295. ``
  296. Check performed by these tools is the same as the one performed by `__BOOST_LEVEL__( left != right )`.
  297. The difference is that the matched values are reported as well.
  298. [bt_example example54..BOOST_<level>_NE usage..run-fail]
  299. See also:
  300. * __BOOST_LEVEL_EQUAL__
  301. [endsect]
  302. [/ ###############################################################################################]
  303. [section:assertion_boost_level_predicate `BOOST_<level>_PREDICATE`]
  304. ``
  305. BOOST_WARN_PREDICATE(predicate, arguments_list);
  306. BOOST_CHECK_PREDICATE(predicate, arguments_list);
  307. BOOST_REQUIRE_PREDICATE(predicate, arguments_list);
  308. ``
  309. These are generic tools used to validate an arbitrary supplied predicate functor (there is a compile time limit on
  310. predicate arity defined by the configurable macro `BOOST_TEST_MAX_PREDICATE_ARITY`). To
  311. validate zero arity predicate use __BOOST_LEVEL__ tools. In other cases prefer theses tools. The
  312. advantage of these tools is that they show arguments values in case of predicate failure.
  313. The first parameter is the predicate itself. The second parameter is the list of predicate arguments each wrapped
  314. in round brackets (`BOOST_PP` sequence format).
  315. [bt_example example40..BOOST_<level>_PREDICATE usage..run]
  316. [note Note difference in error log from __BOOST_LEVEL__]
  317. See also:
  318. * __BOOST_LEVEL__
  319. [endsect]
  320. [/ ###############################################################################################]
  321. [section:assertion_boost_level_no_throw `BOOST_<level>_NO_THROW`]
  322. ``
  323. BOOST_WARN_NO_THROW(expression);
  324. BOOST_CHECK_NO_THROW(expression);
  325. BOOST_REQUIRE_NO_THROW(expression);
  326. ``
  327. These assertions validate that the execution of `expression` does not throw any exception.
  328. To that extent, all possible exception are caught by assertion itself and no exception is propagated to
  329. the test body.
  330. [tip
  331. It is possible to test for complex expressions with the use of constructs such as `do { /* ... */} while(0)` block.
  332. ]
  333. [bt_example exception_nothrow..BOOST_<level>_NO_THROW usage..run-fail]
  334. See also:
  335. * __BOOST_LEVEL_THROW__
  336. * [link boost_test.testing_tools.exception_correctness Exception correctness] section
  337. [endsect]
  338. [/ ###############################################################################################]
  339. [section:assertion_boost_level_throw `BOOST_<level>_THROW`]
  340. ``
  341. BOOST_WARN_THROW(expression, exception_type);
  342. BOOST_CHECK_THROW(expression, exception_type);
  343. BOOST_REQUIRE_THROW(expression, exception_type);
  344. ``
  345. These assertions validate that the execution of `expression` raises an /expected/ exception, which means an exception of
  346. the supplied `exception_type` type or of any child type.
  347. * If `expression` raises an unexpected exception, this exception is not caught by `BOOST_<level>_THROW` assertion and
  348. might propagate to the test body. If not caught at all, the framework will catch it and terminate the test case
  349. with the status /failed/.
  350. * If `expression` does not raise any exception, the the assertion fails.
  351. [warning the assertion catches only the expected exceptions.]
  352. [tip
  353. It is possible to test for complex expressions with the use of constructs such as `do { /* ... */} while(0)` block.
  354. ]
  355. [bt_example exception_check..BOOST_<level>_THROW usage..run-fail]
  356. See also:
  357. * __BOOST_LEVEL_NO_THROW__
  358. * [link boost_test.testing_tools.exception_correctness Exception correctness] section
  359. [endsect]
  360. [/ ###############################################################################################]
  361. [section:assertion_boost_level_exception `BOOST_<level>_EXCEPTION`]
  362. ``
  363. BOOST_WARN_EXCEPTION(expression, exception_type, predicate);
  364. BOOST_CHECK_EXCEPTION(expression, exception_type, predicate);
  365. BOOST_REQUIRE_EXCEPTION(expression, exception_type, predicate);
  366. ``
  367. As for __BOOST_LEVEL_THROW__, these assertions validate that `expression` raises an exception of the
  368. type specified by `exception_type` or any of its child type, with additional checks on the exception instance.
  369. * If an expected exception is raised by `expression`, the instance of the exception is passed to `predicate`
  370. for further validation.
  371. * It behaves like __BOOST_LEVEL_THROW__ if `expression` does not raise any exception, or an unrelated exception is raised.
  372. `predicate` should be a unary function accepting an instance of `exception_type` or any of its child, and that should return
  373. a boolean indicating a success (`true`) or a failure (`false`).
  374. [warning the assertion catches only the expected exceptions.]
  375. [tip
  376. It is possible to test for complex expressions with the use of constructs such as `do { /* ... */} while(0)` block.
  377. ]
  378. The example below checks that the exception carries the proper error code.
  379. [bt_example exception_check_predicate..BOOST_<level>_EXCEPTION usage..run-fail]
  380. See also:
  381. * __BOOST_LEVEL_THROW__
  382. * [link boost_test.testing_tools.exception_correctness Exception correctness] section
  383. [endsect]
  384. [/ ###############################################################################################]
  385. [section:assertion_boost_level_small `BOOST_<level>_SMALL`]
  386. ``
  387. BOOST_WARN_SMALL(value, tolerance);
  388. BOOST_CHECK_SMALL(value, tolerance);
  389. BOOST_REQUIRE_SMALL(value, tolerance);
  390. ``
  391. These tools are used to check that supplied value is small enough. The "smallness" is defined by absolute value
  392. of the tolerance supplied as a second argument. Use these tools with caution. To compare to values on closeness
  393. it's preferable to use __BOOST_LEVEL_CLOSE__ tools instead.
  394. The first parameter is the value to check. The second parameter is the tolerance.
  395. [note The floating point comparison tools are automatically added if the __UTF__
  396. is included as indicated in the previous sections. The tools are implemented is in the header
  397. [headerref boost/test/tools/floating_point_comparison.hpp `boost/test/tools/floating_point_comparison.hpp`].]
  398. [bt_example example41..BOOST_<level>_SMALL usage..run-fail]
  399. See also:
  400. * __BOOST_LEVEL_CLOSE__
  401. * __BOOST_LEVEL_CLOSE_FRACTION__
  402. * __floating_points_testing_tools__
  403. [endsect]
  404. [/ ###############################################################################################]
  405. [section:test_org_boost_test_case_expected_failure `BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES`]
  406. Indicates the number of failures for a test case.
  407. See [link boost_test.testing_tools.expected_failures here] for more details.
  408. [endsect] [/ expected failures]
  409. [/ ###############################################################################################]
  410. [section:assertion_boost_error `BOOST_ERROR`]
  411. ``
  412. BOOST_ERROR(message);
  413. ``
  414. __BOOST_ERROR__ tool behave the same way as `__BOOST_TEST__(false, message)`. This tool is used for
  415. an unconditional error counter increasing and message logging.
  416. The tool's only parameter is an error message to log.
  417. [bt_example example46..BOOST_ERROR usage..run-fail]
  418. See also:
  419. * __BOOST_TEST__
  420. [endsect]
  421. [/ ###############################################################################################]
  422. [section:assertion_boost_fail `BOOST_FAIL`]
  423. ``
  424. BOOST_FAIL(message);
  425. ``
  426. `__BOOST_FAIL__(message)` behave the same way as `__BOOST_TEST_REQUIRE__(false, message)`. This tool is used for an
  427. unconditional error counter increasing, message logging and the current test case aborting.
  428. The tool's only parameter is an error message to log.
  429. [bt_example example47..BOOST_FAIL usage..run-fail]
  430. See also:
  431. * __BOOST_TEST__
  432. *
  433. [endsect]
  434. [/ ###############################################################################################]
  435. [section:assertion_boost_is_defined `BOOST_IS_DEFINED`]
  436. ``
  437. BOOST_IS_DEFINED(symbol);
  438. ``
  439. Unlike the rest of the tools in the toolbox this tool does not perform the logging itself. Its only purpose
  440. is to check at runtime whether or not the supplied preprocessor symbol is defined. Use it in combination with
  441. __BOOST_LEVEL__ to perform and log validation. Macros of any arity could be checked. To check the
  442. macro definition with non-zero arity specify dummy arguments for it. See below for example.
  443. The only tool's parameter is a preprocessor symbol that gets validated.
  444. [bt_example example48..BOOST_IS_DEFINED usage..run-fail]
  445. See also:
  446. * __BOOST_LEVEL__
  447. [endsect]
  448. [/ ###############################################################################################]
  449. [section:assertion_control_under_debugger `BOOST_TEST_TOOLS_UNDER_DEBUGGER`]
  450. When defined, assertions evaluate their expression eagerly, as described [link boost_test.testing_tools.debugging here].
  451. [endsect] [/ assertion_control_under_debugger]
  452. [/ ###############################################################################################]
  453. [section:assertion_control_under_debuggable `BOOST_TEST_TOOLS_DEBUGGABLE`]
  454. When defined, test assertions are compiled in two modes (debugger-friendly and full-featured) and the version is selected at run-time, as described [link boost_test.testing_tools.debugging here].
  455. [endsect] [/ assertion_control_under_debuggable]
  456. [endsect] [/ testing_tool_ref]