diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-02-29 00:29:04 +0700 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-02-29 00:25:58 +0700 |
commit | 8888461f6814ae8b6221b02049fb9e1f69a5ff70 (patch) | |
tree | 5e6b4bb86f94b1c9ef02caba2d36156bc49b059b /src/test/util_tests.cpp | |
parent | fab30b61eb51538a4db62e34f7133c44575b3fe9 (diff) |
util: Fail to parse empty string in ParseMoney
Diffstat (limited to 'src/test/util_tests.cpp')
-rw-r--r-- | src/test/util_tests.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp index f86e713676..536ff3ba25 100644 --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -1199,6 +1199,12 @@ BOOST_AUTO_TEST_CASE(util_ParseMoney) BOOST_CHECK(ParseMoney("0.00000001", ret)); BOOST_CHECK_EQUAL(ret, COIN/100000000); + // Parsing amount that can not be represented in ret should fail + BOOST_CHECK(!ParseMoney("0.000000001", ret)); + + // Parsing empty string should fail + BOOST_CHECK(!ParseMoney("", ret)); + // Attempted 63 bit overflow should fail BOOST_CHECK(!ParseMoney("92233720368.54775808", ret)); |