aboutsummaryrefslogtreecommitdiff
path: root/src/test/bignum_tests.cpp
diff options
context:
space:
mode:
authorOlivier Langlois <olivier@olivierlanglois.net>2013-10-10 12:35:51 -0400
committerOlivier Langlois <olivier@olivierlanglois.net>2013-10-27 23:04:52 -0400
commitf171ec0c7d084b6bb163d1466edd814cf4dcbc93 (patch)
treecb0708afc624eeb68a0b0b5db0aca19e9cc58984 /src/test/bignum_tests.cpp
parent15b48ab03612952b355cdd411cc541668d147bfb (diff)
downloadbitcoin-f171ec0c7d084b6bb163d1466edd814cf4dcbc93.tar.xz
Make util phexdigit array reusable
class template base_uint had its own private lookup table. This is saving 256 bytes per instantiation. The result is not spectacular as bitcoin-qt has only shrinked of about 1Kb but it is still valid improvement. Also, I have replaced a for loop with a memset() call. Made CBigNum::SetHex() use the new HexDigit() function. Signed-off-by: Olivier Langlois <olivier@olivierlanglois.net>
Diffstat (limited to 'src/test/bignum_tests.cpp')
-rw-r--r--src/test/bignum_tests.cpp8
1 files changed, 8 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()