Boost logo

Boost :

From: Jorge Lodos (lodos_at_[hidden])
Date: 2007-05-10 09:54:33


Hi
The code below reports 2 failed assertions of 3. If you comment out one of
the BOOST_CHECK macros, it reports 1 failed assertion of 1.
Is the extra assertion expected behaviour?

Thanks
Jorge

#include <boost/test/unit_test.hpp>
using boost::unit_test::test_suite;

void free_test_function()
{
    // reports 'error in "free_test_function": test 2 == 1 failed'
    BOOST_CHECK(5 == 1); // non-critical test => continue after failure
    BOOST_CHECK(6 == 1); // non-critical test => continue after failure
}

test_suite*
init_unit_test_suite( int, char* [] ) {
    test_suite* test= BOOST_TEST_SUITE( "Unit test example 1" );

    // this example will pass cause we know ahead of time number of expected
failures
    test->add( BOOST_TEST_CASE( &free_test_function ), 2 /* expected one
error */ );

    return test;
}


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk