BOOST_TEST_CHECKPOINT

| > The Unit Test Framework > User's guide > Test Output > Test log > BOOST_TEST_CHECKPOINT |

###### BOOST_TEST_CHECKPOINT

The macro BOOST_TEST_CHECKPOINT is intended to be used to inject "named" checkpoint position. The macro signature is as follows:

    BOOST_TEST_CHECKPOINT(checkoint_message)

The message formatted at the checkpoint position is saved and reported by the exception logging functions (if any occurs). Similarly to the `BOOST_TEST_MESSAGE` the message can be formatted from any standard output stream compliant components.

Example 28. BOOST_TEST_CHECKPOINT usage

    #define BOOST_TEST_MODULE example
    #include <boost/test/included/unit_test.hpp>

    //____________________________________________________________________________//

    extern void foo( int i );

    //____________________________________________________________________________//

    BOOST_AUTO_TEST_CASE( test_external_interface )
    {
        for( int i = 3; i >=0; i-- ) {
            BOOST_TEST_CHECKPOINT( "Calling foo with i=" << i );
            foo( i );
        }
    }

    //____________________________________________________________________________//

    void foo( int i )
    {
        int j = 2/(i-1);
    }

    //____________________________________________________________________________//

`Source code` | | | `Show output`

    > example
    Running 1 test case...
    unknown location(0): fatal error in "test_external_interface": signal: integer divide by zero; address of failing instruction: 0x00048090
    test.cpp(13): last checkpoint: Calling foo with i=1

    *** 1 failure detected in test suite "example"