From 4538130790da2ef2affda53b40375feaae3414f1 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Wed, 23 Oct 2013 09:33:16 +0200 Subject: [PATCH] Add test for monetary value formatting Tests for issue #3126. This problem pops up after upgrading json-spirit. --- src/test/rpc_tests.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/test/rpc_tests.cpp b/src/test/rpc_tests.cpp index 35eabed0e2..b771c0c4b9 100644 --- a/src/test/rpc_tests.cpp +++ b/src/test/rpc_tests.cpp @@ -168,4 +168,14 @@ BOOST_AUTO_TEST_CASE(rpc_rawsign) BOOST_CHECK(find_value(r.get_obj(), "complete").get_bool() == true); } +BOOST_AUTO_TEST_CASE(rpc_format_monetary_values) +{ + BOOST_CHECK(write_string(Value(0.0), false) == "0.00000000"); + BOOST_CHECK(write_string(Value(1.0), false) == "1.00000000"); + BOOST_CHECK(write_string(Value(0.5), false) == "0.50000000"); + BOOST_CHECK(write_string(Value(0.00000001), false) == "0.00000001"); + BOOST_CHECK(write_string(Value(0.17622195), false) == "0.17622195"); + BOOST_CHECK(write_string(Value(0.89898989), false) == "0.89898989"); +} + BOOST_AUTO_TEST_SUITE_END()