aboutsummaryrefslogtreecommitdiff
path: root/src/test/util_tests.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-02-29 00:29:04 +0700
committerMarcoFalke <falke.marco@gmail.com>2020-02-29 00:25:58 +0700
commit8888461f6814ae8b6221b02049fb9e1f69a5ff70 (patch)
tree5e6b4bb86f94b1c9ef02caba2d36156bc49b059b /src/test/util_tests.cpp
parentfab30b61eb51538a4db62e34f7133c44575b3fe9 (diff)
util: Fail to parse empty string in ParseMoney
Diffstat (limited to 'src/test/util_tests.cpp')
-rw-r--r--src/test/util_tests.cpp6
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));