checkpoints.qbk 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. [/
  2. / Copyright (c) 2001 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:checkpoints Checkpoints for accurate failure location]
  8. In most cases, the __UTF__ can't provide an exact location where system error occurs or uncaught C++ exception
  9. is thrown from. To be able to pinpoint it as close as possible the __UTF__ keeps track of *checkpoints* - the
  10. location a test module passed through.
  11. The __UTF__ keeps track of checkpoints at test case entrance, exit, fixture initialization, and at test tool invocation point.
  12. Any other checkpoints should be entered by you manually if you need more granularity in case a fatal
  13. error occurs during the test. The __UTF__ provides two macros for this purpose:
  14. * [link ref_named_checkpoint `BOOST_TEST_CHECKPOINT`] to specify a ['named] checkpoint and
  15. * [link ref_unnamed_checkpoint `BOOST_TEST_PASSPOINT`] to specify an ['unnamed] checkpoint.
  16. The checkpoints are also convenient for checks in loops as they might provide
  17. more information about the occurrence of a failure (although superseded by
  18. [links boost_test.test_output.test_tools_support_for_logging.contexts contexts]).
  19. [/ -------------------------------------------------------------------------------------------------- ]
  20. [#ref_named_checkpoint][h3 Named checkpoints]
  21. The macro __BOOST_TEST_CHECKPOINT__ is intended to be used to inject [*named] checkpoint position. The
  22. macro signature is as follows:
  23. ``
  24. __BOOST_TEST_CHECKPOINT__(checkpoint_message);
  25. ``
  26. The message formatted at the checkpoint position is saved and reported by the exception logging functions (if any
  27. occurs). Similarly to the __BOOST_TEST_MESSAGE__ the message can be formatted from any standard
  28. output stream compliant components.
  29. [bt_example example22..__BOOST_TEST_CHECKPOINT__ usage..run-fail]
  30. [/ -------------------------------------------------------------------------------------------------- ]
  31. [#ref_unnamed_checkpoint][h3 Unnamed checkpoints]
  32. The macro __BOOST_TEST_PASSPOINT__ is intended to be used to inject an [*unnamed] checkpoint position. The
  33. macro signature is as follows:
  34. ``
  35. __BOOST_TEST_PASSPOINT__();
  36. ``
  37. Unlike the macro __BOOST_TEST_CHECKPOINT__ this macro doesn't require any message to be
  38. supplied with it. It's just a simple "been there" marker that records file name and line number
  39. code passes through.
  40. [bt_example example23..__BOOST_TEST_PASSPOINT__ usage..run-fail]
  41. [endsect] [/checkpoints]