Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

BOOST_level_PREDICATE

BOOST_level_PREDICATE(predicate, args) asserts that the supplied predicate applied to args evaluates to true. The supplied predicate must have a return type of bool and argument types that are compatible with the argument list args. Because BOOST_level_PREDICATE is a macro, the args must be supplied as a sequence of parenthesized values, with no comma separating the values.

Example

static bool custom_string_compare(char const* const expected, char const* const actual)
{
    return std::strcmp(expected, actual) == 0;
}

BOOST_AUTO_TEST_CASE(example_predicate)
{
    char const* const s = "scooby";

    BOOST_REQUIRE_PREDICATE(custom_string_compare, ("scooby")(s));
}


PrevUpHomeNext