Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

BOOST_level_BITWISE_EQUAL

BITWISE_level_EQUAL(lhs, rhs) compares the two arguments for bitwise equality and fails if they are not equal. This can be useful when testing integral values that represent a logical or combination of bit flags.

Example

enum bit_flags
{
    source_file = 1u,
    header_file = 2u,
    build_file = 4u
};

BOOST_AUTO_TEST_CASE(example_bitwise_equal)
{
    BOOST_REQUIRE_BITWISE_EQUAL(
        source_file | build_file,
        build_file | source_file);
}


PrevUpHomeNext