Boost logo

Boost Users :

From: Peter (pjfoley_at_[hidden])
Date: 2007-01-07 02:25:34


Hi,

I am new to Boost.Test so not sure if this is expected behaviour or not.

Based on this minimal test:

|----------------------------8←------------------------------------|
#include <boost/test/unit_test.hpp>
using boost::unit_test::test_suite;

// most frequently you implement test cases as a free functions
void my_test()
{

    int i=2;
    BOOST_WARN( sizeof(int) == sizeof(short) );
    BOOST_CHECK( i == 1 );
    BOOST_REQUIRE( i > 5 );
    BOOST_CHECK( i == 6 ); // will never reach this check
}

test_suite*
init_unit_test_suite( int, char* [] ) {
    test_suite* test= BOOST_TEST_SUITE( " Test Suite!" );

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

    return test;
}
|----------------------------8←------------------------------------|

Taken from this url: http://tinyurl.com/t54th (Click on BOOST_WARN).

I expect to see this output (as mentioned at the above link):

c:/development/code/practice/ test/mytest.cpp (14) : warning in test_main: condition sizeof(int) == sizeof(short) is not satisfied
c:/development/code/practice/ test/mytest.cpp (15) : error in test_main: test i==1 failed
c:/development/code/practice/ test/mytest.cpp (16) : fatal error in test_main: test i>5 failed

But I see this output

Running 1 test case...
c:/development/code/practice/ test/mytest.cpp(15): error in " my_test ": check i == 1 failed
c:/development/code/practice/ test/mytest.cpp (16): fatal error in " my_test ": critical check i > 5 failed

*** 2 failures detected (2 failures expected) in test suite "Master Test Suite"

It seems that the BOOST_WARN is not outputting a message. Is this expected behaviour?

Also another minor point in the code I have named the BOOST_TEST_SUITE “Test Suite!” but in the output it is calling it “Master Test Suite”. Is this something I am not setting right?

Thanks,

Peter.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net