Boost
C++ Libraries
...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
This is an older version of Boost and was released in 2023. The current version is 1.89.0.
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. The 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 type's size does not coincide.
|
Code |
|---|
#define BOOST_TEST_MODULE example #include <boost/test/included/unit_test.hpp> BOOST_AUTO_TEST_CASE( test ) { BOOST_CHECK_BITWISE_EQUAL( (char)0x26, 0x04 ); } |
|
Output |
|---|
> example Running 1 test case... test.cpp(8): error in "test": check (char)0x26 =.= 0x04 failed. Mismatch in a position 1 Mismatch in a position 5 Operands bit sizes mismatch: 8 != 32 *** 1 failures is detected in test suite "example" |
See also: