Browse Source

Merge pull request #3559

e6c6bc9 Adds additional zero checks for setCompact  These encoded values should all decode to zero (Noel Tiernan)
0.10
Wladimir J. van der Laan 11 years ago
parent
commit
12f5787d45
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 36
      src/test/bignum_tests.cpp

36
src/test/bignum_tests.cpp

@ -135,6 +135,42 @@ BOOST_AUTO_TEST_CASE(bignum_SetCompact) @@ -135,6 +135,42 @@ BOOST_AUTO_TEST_CASE(bignum_SetCompact)
BOOST_CHECK_EQUAL(num.GetHex(), "0");
BOOST_CHECK_EQUAL(num.GetCompact(), 0U);
num.SetCompact(0x01003456);
BOOST_CHECK_EQUAL(num.GetHex(), "0");
BOOST_CHECK_EQUAL(num.GetCompact(), 0U);
num.SetCompact(0x02000056);
BOOST_CHECK_EQUAL(num.GetHex(), "0");
BOOST_CHECK_EQUAL(num.GetCompact(), 0U);
num.SetCompact(0x03000000);
BOOST_CHECK_EQUAL(num.GetHex(), "0");
BOOST_CHECK_EQUAL(num.GetCompact(), 0U);
num.SetCompact(0x04000000);
BOOST_CHECK_EQUAL(num.GetHex(), "0");
BOOST_CHECK_EQUAL(num.GetCompact(), 0U);
num.SetCompact(0x00923456);
BOOST_CHECK_EQUAL(num.GetHex(), "0");
BOOST_CHECK_EQUAL(num.GetCompact(), 0U);
num.SetCompact(0x01803456);
BOOST_CHECK_EQUAL(num.GetHex(), "0");
BOOST_CHECK_EQUAL(num.GetCompact(), 0U);
num.SetCompact(0x02800056);
BOOST_CHECK_EQUAL(num.GetHex(), "0");
BOOST_CHECK_EQUAL(num.GetCompact(), 0U);
num.SetCompact(0x03800000);
BOOST_CHECK_EQUAL(num.GetHex(), "0");
BOOST_CHECK_EQUAL(num.GetCompact(), 0U);
num.SetCompact(0x04800000);
BOOST_CHECK_EQUAL(num.GetHex(), "0");
BOOST_CHECK_EQUAL(num.GetCompact(), 0U);
num.SetCompact(0x01123456);
BOOST_CHECK_EQUAL(num.GetHex(), "12");
BOOST_CHECK_EQUAL(num.GetCompact(), 0x01120000U);

Loading…
Cancel
Save