[Boost.Test] return value of macros

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? best regards -Thorsten

"Thorsten Ottosen" <thorsten.ottosen@dezide.com> wrote in message news:47986956.1060904@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.
participants (2)
-
Gennadiy Rozental
-
Thorsten Ottosen