提交 4162f42f 编写于 作者: P Paul Calabrese 提交者: Kevin Heifner

STAT-273: Fix json parsing issues

(cherry picked from commit 9aa838e9)
上级 aeada7b2
......@@ -96,9 +96,8 @@ namespace fc
"Expected '\"' but read '${char}'",
("char", string(&c, (&c) + 1) ) );
in.get();
while( true )
while( !in.eof() )
{
switch( c = in.peek() )
{
case '\\':
......@@ -128,7 +127,7 @@ namespace fc
{
char c = in.peek();
while( true )
while( !in.eof() )
{
switch( c = in.peek() )
{
......
......@@ -22,6 +22,26 @@ using namespace std;
BOOST_AUTO_TEST_SUITE(misc_tests)
/// Test processing of unbalanced strings
BOOST_AUTO_TEST_CASE(json_from_string_test)
{
bool exc_found = false;
try {
auto val = fc::json::from_string("{\"}");
} catch(...) {
exc_found = true;
}
BOOST_CHECK_EQUAL(exc_found, true);
exc_found = false;
try {
auto val = fc::json::from_string("{\"block_num_or_id\":5");
} catch(...) {
exc_found = true;
}
BOOST_CHECK_EQUAL(exc_found, true);
}
/// Test calculation of median values of blockchain operation properties
BOOST_AUTO_TEST_CASE(median_properties_test)
{ try {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册