Boost logo

Boost :

From: Alisdair Meredith (alisdair.meredith_at_[hidden])
Date: 2002-11-21 14:34:21


Only tested with Borland BCB5, here is the test case I promised Gennadiy
a few weeks back [been somewhat too busy :¬ (]
(code after sig)

When run with --log_level=all I would expect to see 5 messages with
Testing Value 1
Testing Value 2
Testing Value 3
Testing Value 4
Testing Value 5

instead, I get
Testing Value 1
repeated 5 times (along with other failure messages)

-- 
AlisdairM
#include "boost/format.hpp"
#include "boost/test/unit_test.hpp"
//---------------------------------------------------------------------------
#include <list>
//---------------------------------------------------------------------------
using   boost::format;
using namespace boost::unit_test_framework;
//---------------------------------------------------------------------------
namespace
{
    std::list<int>   vBadValues;
struct Initialiser
{
    Initialiser()
    {
        vBadValues.push_back( 1 );
        vBadValues.push_back( 2 );
        vBadValues.push_back( 3 );
        vBadValues.push_back( 4 );
        vBadValues.push_back( 5 );
    }
}   init;
}
//---------------------------------------------------------------------------
void    ImplementBadValueTest( int nToTest )
{
    BOOST_MESSAGE( format( "Testing value %d" ) % nToTest );
    throw   std::runtime_error( "Unexpected!" );
}
//---------------------------------------------------------------------------
void    Test_BadValue( int nToTest )
{
    BOOST_CHECK_THROW( ImplementBadValueTest( nToTest ),
std::logic_error );
}
//---------------------------------------------------------------------------
test_suite* init_unit_test_suite(int, char* [])
{
    test_suite *pTests = BOOST_TEST_SUITE( "Initial boost test" );
    pTests->add( BOOST_PARAM_TEST_CASE( Test_BadValue, 
vBadValues.begin(),  vBadValues.end()  ) );
    return  pTests;
}

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