The Test Tools

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

These tools are used to perform an exception detection check. Tools execute the supplied statement and checks that it throws the supplied exception or it's child. If the statement throw any other unrelated exception or doesn't throw at all, check fails.

If check is successful, the tool produces a confirmation message, in other case it produces an error message in a form "error in <test case name>: exception <exception> expected.

The first parameter the statement to execute while checking for exception. Use block statement if you want to execute more than one statement. The second parameter is an expected exception.

#### Example: test.cpp

    class my_exception{};
    int test_main( int, char* [] ) {
        int i =  0;
        BOOST_CHECK_THROW( i++, my_exception );

        return 0;
    }

#### Output:

test.cpp(4) : error in test_main: exception my_exception expected

#### See Also

BOOST_CHECK_NO_THROW