[test] Add tests for self usage in arith_uint256
This commit is contained in:
parent
08b17def58
commit
b120f7bdbe
1 changed files with 13 additions and 0 deletions
|
@ -266,4 +266,17 @@ BOOST_AUTO_TEST_CASE( conversion )
|
|||
BOOST_CHECK(R2L.GetHex() == UintToArith256(R2L).GetHex());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE( operator_with_self )
|
||||
{
|
||||
arith_uint256 v = UintToArith256(uint256S("02"));
|
||||
v *= v;
|
||||
BOOST_CHECK(v == UintToArith256(uint256S("04")));
|
||||
v /= v;
|
||||
BOOST_CHECK(v == UintToArith256(uint256S("01")));
|
||||
v += v;
|
||||
BOOST_CHECK(v == UintToArith256(uint256S("02")));
|
||||
v -= v;
|
||||
BOOST_CHECK(v == UintToArith256(uint256S("0")));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
|
Loading…
Reference in a new issue