Boost logo

Boost :

From: Gennadiy Rozental (rogeeff_at_[hidden])
Date: 2008-01-26 05:52:44


"Thorsten Ottosen" <thorsten.ottosen_at_[hidden]> wrote in message
news:47986956.1060904_at_dezide.com...
> Hi Gennadiy,
>
> I often want to output message or do additional test of another test
> fails.
>
> It would be cool if I could do it like this:
>
> if( !BOOST_CHECK_CLOSE( aStarEcr, close, 0.0001 ) )
> {
> BOOST_MESSAGE( "\nA* sequence: " << aStarSeq );
> BOOST_MESSAGE( "\nClose sequence: " << closeSeq );
> }
>
> But, AFAICT, the macros are implemented this way:
>
>
> #define BOOST_CHECK_WITH_ARGS_IMPL( P, check_descr, TL, CT, ARGS ) \
> do { \
> BOOST_TEST_PASSPOINT(); \
> BOOST_TEST_TOOL_IMPL( check_frwd, P, check_descr, TL, CT ) \
> BOOST_PP_SEQ_FOR_EACH( BOOST_TEST_PASS_ARG_INFO, '_', ARGS ) ); \
> } while( ::boost::test_tools::dummy_cond ) \
> /**/
>
> Do you think it would be possible have a bool returning function
> instead of the while loop?

I can do what you need for gcc using ({ ... }) . Unfortunately it doesn't
seem ot work for most other compilers including msvc. If you know portable
solution please let me know.

Gennadiy.


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