Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Predefined log format selection

The select at compile time the log format from the list of the formats supplied by the Unit Test Framework

boost::unit_test::unit_test_log.set_format( boost::unit_test::output_format );

In regular circumstances you shouldn't use this interface. Prefer to use runtime parameters for predefined log format selection.

Example: Compile-time log format selection

Code

#define BOOST_TEST_MODULE example
#include <boost/test/included/unit_test.hpp>
using namespace boost::unit_test;

struct MyConfig {
  MyConfig()
  {
    unit_test_log.set_format( OF_XML );
  }
  ~MyConfig() {}
};

BOOST_GLOBAL_FIXTURE( MyConfig );

BOOST_AUTO_TEST_CASE( test_case0 )
{
  BOOST_TEST( false );
}

Output

> example --report_level=no
<TestLog><Error file="test.cpp" line="18">check false failed</Error></TestLog>

PrevUpHomeNext