Edgewall Software

Changes between Version 7 and Version 8 of Boost Test


Ignore:
Timestamp:
Jun 2, 2008, 2:02:41 PM (16 years ago)
Author:
pollex@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Boost Test

    v7 v8  
    109109There might be other, prettier ways to do this - please contribute if you have a better solution.
    110110
     111Here's an alternative that IMHO is a little more elegant:
     112
     113{{{
     114//
     115// run_tests.cc
     116//
     117
     118#define BOOST_AUTO_TEST_MAIN
     119
     120#include <iostream>
     121#include <fstream>
     122#include <cassert>
     123#include <boost/test/auto_unit_test.hpp>
     124#include <boost/test/results_reporter.hpp>
     125
     126struct ReportRedirector
     127{
     128    std::ofstream out;
     129
     130    ReportRedirector() : out("test_results.xml")
     131    {
     132        assert( out.is_open() );
     133        boost::unit_test::results_reporter::set_stream(out);
     134    }
     135};
     136
     137static ReportRedirector foo;
     138}}}
     139This has been tested for boost 1.35.0.
     140
    111141Once the report has been properly redirected, you can update your recipe to include logging output:
    112142