The Test Tools

### BOOST_CHECK_PREDICATE( predicate, predicate_arity, arguments_list )

This tool is used to validate the supplied predicate functor. This test tool is generic. It allows to validate arbitrary one or two arity predicate. To validate zero or more then two arity predicate use BOOST_CHECK tool. The advantage of this tool is that shows arguments values in case of predicate failure.

If predicate produces true value, the tool produces a confirmation message (note: to manage what messages appear in the test output stream set the proper log level), in other case it produces an error message in a form "error in ...: test <predicate>( arguments list ) fail for (arguments values)".

The tools first parameter is the predicate itself. The tools second parameter the predicate arity. The last third argument is wrapped in round brackets, comma separated list of predicate arguments.

#### Example: test.cpp

    bool is_even( int i ) {
        return i%2 == 0;
    }

    int test.cpp( int, char* [] ) {
        int i = 17;
        BOOST_CHECK_PREDICATE( &is_even, 1, (i) );

        return 0;
    }

#### Output:

test.cpp(3) : error in test_main: test &is_even(i) failed for 17

#### Example: test.cpp

    int test.cpp( int, char* [] ) {
        int i = 17;

        BOOST_CHECK_PREDICATE( std::not_equal_to<int>(), 2, (i,17) );

        return 0;
    }

#### Output:

test.cpp(3) : error in test_main: test std::not_equal_to<int>()(i, 17) failed for (17, 17)

#### See Also

BOOST_CHECK