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

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 用於注於 "命名的" 檢查點位置。宏簽名如下:

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.
在檢查點被格式化的信息被異常日誌函數 (如果出現) 保存並報告。 類似於 BOOST_TEST_MESSAGE,信息可以由任意兼容於輸出流的組件格式化。

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"


PrevUpHomeNext