Boost logo

Boost Users :

From: Kevin Wheatley (hxpro_at_[hidden])
Date: 2006-03-27 15:50:30


I was just wondering if there is an option to generate an
error/warning if a test function called by the test library does no
'asserts' (or any of the BOOST_* test tools).

I know there is the option to output the number of assertions and the
number of tests, but as we don't always have the one assert per test
style of testing here, we can't use that directly to catch tests that
do no testing, the detailed ouput level in this case does something
like this:

Running 5 test cases...
unknown location(0): fatal error in "read_one_line_file":
std::runtime_error: not implemented

Test suite "Master Test Suite" failed with:
  8 assertions out of 8 passed
  4 test cases out of 5 passed
  1 test case out of 5 failed

  Test case "construct_default_object" passed with:
    1 assertion out of 1 passed

  Test case "no_such_file" passed with:
    2 assertions out of 2 passed

  Test case "blank_filename" passed with:
    2 assertions out of 2 passed

  Test case "read_empty_file" passed with:
    2 assertions out of 2 passed

  Test case "read_one_line_file" aborted with:
    1 assertion out of 1 passed

The problem comes from (sample):

BOOST_AUTO_TEST_CASE( construct_default_object )
{
    CSVFileReader defaultObject;
    boost::ignore_unused_variable_warning(defaultObject);
}

I'd like to say I don't see any asserts here, and would like a
warning, or at least to note that I did not call an assert. In fact it
looks like BOOST_AUTO_TEST_CASE() is adding an additional test to all
of my test cases. Is this by design?

Thanks

Kevin

-- 
| Kevin Wheatley, Cinesite (Europe) Ltd | Nobody thinks this      |
| Senior Technology                     | My employer for certain |
| And Network Systems Architect         | Not even myself         |

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