BOOST_WARN_BITWISE_EQUAL( left, right )
BOOST_CHECK_BITWISE_EQUAL( left, right )
BOOST_REQUIRE_BITWISE_EQUAL( left, right )

These tools are used to perform bitwise comparison of two values. This check shows all positions where left and right value's bits mismatch.

The first parameter is the left compared value. The second parameter is the right compared value. Parameters are not required to be of the same type, but warning is issued if their types size does not coincide.

Example: test.cpp

#define BOOST_TEST_MAIN
#include <boost/test/unit_test.hpp>
BOOST_AUTO_TEST_CASE( test ) { BOOST_CHECK BITWISE_EQUAL( (char)0x26, (char)0x04 ); }

Output:

Running 1 test case...
test.cpp(6): error in "test": check (char)0x26 =.= (char)0x04 failed.
Mismatch in a position 1
Mismatch in a position 5

*** 1 failure detected in test suite "Master Test Suite"

See Also

BOOST_CHECK_EQUAL