Boost logo

Boost Users :

From: Andreas Huber (ahd6974-spamgroupstrap_at_[hidden])
Date: 2005-08-15 07:19:52

Hi Konstantin

Voronkov Konstantin <beowinkle <at>> writes:
> I have a question whether there is a way to say that exception
> is expected/unexpected in Boost.Test-based Test Case? And
> depends on this the Test Case is threated as passed or failed.

You can check for expected exceptions with the following macros:

BOOST_WARN_THROW( statement, exception )
BOOST_CHECK_THROW( statement, exception )
BOOST_REQUIRE_THROW( statement, exception )


You can check for unexpected exceptions by simply letting the exception escape
out of test_main (in which case the test is aborted and fails) or with the
following macros:

BOOST_WARN_NO_THROW( statement )


Andreas Huber 
When replying by private email, please remove the words spam and trap from the 
address shown in the header.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at