Changeset View
Changeset View
Standalone View
Standalone View
src/test/arith_uint256_tests.cpp
Show First 20 Lines • Show All 241 Lines • ▼ Show 20 Lines | BOOST_AUTO_TEST_CASE(unaryOperators) { | ||||
BOOST_CHECK(-ZeroL == ZeroL); | BOOST_CHECK(-ZeroL == ZeroL); | ||||
BOOST_CHECK(-R1L == (~R1L) + 1); | BOOST_CHECK(-R1L == (~R1L) + 1); | ||||
for (unsigned int i = 0; i < 256; ++i) | for (unsigned int i = 0; i < 256; ++i) | ||||
BOOST_CHECK(-(OneL << i) == (MaxL << i)); | BOOST_CHECK(-(OneL << i) == (MaxL << i)); | ||||
} | } | ||||
// Check if doing _A_ _OP_ _B_ results in the same as applying _OP_ onto each | // Check if doing _A_ _OP_ _B_ results in the same as applying _OP_ onto each | ||||
// element of Aarray and Barray, and then converting the result into a | // element of Aarray and Barray, and then converting the result into an | ||||
// arith_uint256. | // arith_uint256. | ||||
#define CHECKBITWISEOPERATOR(_A_, _B_, _OP_) \ | #define CHECKBITWISEOPERATOR(_A_, _B_, _OP_) \ | ||||
for (unsigned int i = 0; i < 32; ++i) { \ | for (unsigned int i = 0; i < 32; ++i) { \ | ||||
TmpArray[i] = _A_##Array[i] _OP_ _B_##Array[i]; \ | TmpArray[i] = _A_##Array[i] _OP_ _B_##Array[i]; \ | ||||
} \ | } \ | ||||
BOOST_CHECK(arith_uint256V(std::vector<uint8_t>( \ | BOOST_CHECK(arith_uint256V(std::vector<uint8_t>( \ | ||||
TmpArray, TmpArray + 32)) == (_A_##L _OP_ _B_##L)); | TmpArray, TmpArray + 32)) == (_A_##L _OP_ _B_##L)); | ||||
▲ Show 20 Lines • Show All 416 Lines • Show Last 20 Lines |