Home | Libraries | People | FAQ | More |
BOOST_FAIL(
message
)
always fails and emits the given message
at
the REQUIRE
assertion level. Other assertion macros
are generally preferred over BOOST_FAIL
because they
emit better diagnostics in the case of failure.
There are two situations where you might be tempted to use BOOST_FAIL
:
testing the situations where the system under test will throw exceptions
or comparing against the values computed by the system under test. For
testing exception generation, use BOOST_REQUIRE_THROW
,
BOOST_REQUIRE_NO_THROW
or BOOST_REQUIRE_EXCEPTION
.
For testing against values computed by the system under test, use the comparing
assertions.
BOOST_AUTO_TEST_CASE(example_fail) { BOOST_FAIL("This should never happen."); }