diff options
author | Jonas Schnelli <jonas.schnelli@include7.ch> | 2015-06-04 10:35:36 +0200 |
---|---|---|
committer | Jonas Schnelli <jonas.schnelli@include7.ch> | 2015-06-04 10:35:36 +0200 |
commit | 519eedeba76a2192bbded69b3c7e7e96bfc549a2 (patch) | |
tree | 3dc9470d90cf3aee9045cc71f4733d96d2e804ff /src/test | |
parent | c7fbbc7e1d7b076f68f0b2d87f7e86faba5d3a26 (diff) |
fix univalue json parse tests
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/rpc_tests.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/test/rpc_tests.cpp b/src/test/rpc_tests.cpp index 8dbe377626..576e62a0bb 100644 --- a/src/test/rpc_tests.cpp +++ b/src/test/rpc_tests.cpp @@ -143,20 +143,23 @@ BOOST_AUTO_TEST_CASE(rpc_parse_monetary_values) BOOST_AUTO_TEST_CASE(json_parse_errors) { - Value value; + UniValue value; // Valid - BOOST_CHECK_EQUAL(read_string(std::string("1.0"), value), true); + BOOST_CHECK_EQUAL(value.read(std::string("1.0")), false); + BOOST_CHECK_EQUAL(value.read(std::string("[1.0]")), true); // Valid, with trailing whitespace - BOOST_CHECK_EQUAL(read_string(std::string("1.0 "), value), true); + BOOST_CHECK_EQUAL(value.read(std::string("1.0 ")), false); + BOOST_CHECK_EQUAL(value.read(std::string("[1.0 ] ")), true); // Invalid, initial garbage - BOOST_CHECK_EQUAL(read_string(std::string("[1.0"), value), false); - BOOST_CHECK_EQUAL(read_string(std::string("a1.0"), value), false); + BOOST_CHECK_EQUAL(value.read(std::string("[1.0")), false); + BOOST_CHECK_EQUAL(value.read(std::string("[a1.0]")), false); + BOOST_CHECK_EQUAL(value.read(std::string("[\"a1.0\"]")), true); // Invalid, trailing garbage - BOOST_CHECK_EQUAL(read_string(std::string("1.0sds"), value), false); - BOOST_CHECK_EQUAL(read_string(std::string("1.0]"), value), false); + BOOST_CHECK_EQUAL(value.read(std::string("1.0sds")), false); + BOOST_CHECK_EQUAL(value.read(std::string("1.0]")), false); // BTC addresses should fail parsing - BOOST_CHECK_EQUAL(read_string(std::string("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W"), value), false); - BOOST_CHECK_EQUAL(read_string(std::string("3J98t1WpEZ73CNmQviecrnyiWrnqRhWNL"), value), false); + BOOST_CHECK_EQUAL(value.read(std::string("175tWpb8K1S7NmH4Zx6rewF9WQrcZv245W")), false); + BOOST_CHECK_EQUAL(value.read(std::string("3J98t1WpEZ73CNmQviecrnyiWrnqRhWNL")), false); } BOOST_AUTO_TEST_CASE(rpc_boostasiotocnetaddr) |