diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-11-04 05:55:37 -0800 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2013-11-04 05:55:37 -0800 |
commit | bac72640ee4fbf32c639901229dcd714defa1baa (patch) | |
tree | 78ea27076d3d41c62d7ad873335c34a80f8343b9 /src/test | |
parent | 97f844dd95c54b0fe2f2a1bb006c74ff544ff125 (diff) | |
parent | f171ec0c7d084b6bb163d1466edd814cf4dcbc93 (diff) |
Merge pull request #3076 from lano1106/uint256_util
Make util phexdigit array reusable
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/bignum_tests.cpp | 8 | ||||
-rw-r--r-- | src/test/uint256_tests.cpp | 9 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/test/bignum_tests.cpp b/src/test/bignum_tests.cpp index 196b7274f4..f16c26fd18 100644 --- a/src/test/bignum_tests.cpp +++ b/src/test/bignum_tests.cpp @@ -175,4 +175,12 @@ BOOST_AUTO_TEST_CASE(bignum_SetCompact) BOOST_CHECK_EQUAL(num.GetCompact(), 0xff123456U); } +BOOST_AUTO_TEST_CASE(bignum_SetHex) +{ + std::string hexStr = "deecf97fd890808b9cc0f1b6a3e7a60b400f52710e6ad075b1340755bfa58cc9"; + CBigNum num; + num.SetHex(hexStr); + BOOST_CHECK_EQUAL(num.GetHex(), hexStr); +} + BOOST_AUTO_TEST_SUITE_END() diff --git a/src/test/uint256_tests.cpp b/src/test/uint256_tests.cpp index efdc8a6aeb..e34efcc47e 100644 --- a/src/test/uint256_tests.cpp +++ b/src/test/uint256_tests.cpp @@ -1,6 +1,7 @@ #include <boost/test/unit_test.hpp> #include "uint256.h" +#include <string> BOOST_AUTO_TEST_SUITE(uint256_tests) @@ -15,4 +16,12 @@ BOOST_AUTO_TEST_CASE(uint256_equality) BOOST_CHECK(num1+num2 == num3+num2); } +BOOST_AUTO_TEST_CASE(uint256_hex) +{ + std::string hexStr = "d35583ed493a5eee756931353144f558e6a9ab3ad6024a63ced7f10daf7faad9"; + uint256 num1; + num1.SetHex(hexStr); + BOOST_CHECK(num1.GetHex() == hexStr); +} + BOOST_AUTO_TEST_SUITE_END() |