Fixed suffixing .0 and modified the unit tests accordingly

This commit is contained in:
Alex Astashyn 2016-12-04 01:38:23 -05:00
parent 21cae35930
commit 2197856395
3 changed files with 9 additions and 7 deletions

View file

@ -6520,8 +6520,9 @@ class basic_json
const bool value_is_int_like =
std::find_if(m_buf.begin(), data_end,
[](const char c)
{ return (c >= '0' and c <= '9')
or c == '-'; })
{ return c == '.'
or c == 'e'
or c == 'E'; })
== data_end;
assert(data_end + 2 < m_buf.end());

View file

@ -6520,8 +6520,9 @@ class basic_json
const bool value_is_int_like =
std::find_if(m_buf.begin(), data_end,
[](const char c)
{ return (c >= '0' and c <= '9')
or c == '-'; })
{ return c == '.'
or c == 'e'
or c == 'E'; })
== data_end;
assert(data_end + 2 < m_buf.end());

View file

@ -394,9 +394,9 @@ TEST_CASE("regression tests")
//issue #230
//CHECK(j2b.dump() == "23.42");
CHECK(j3a.dump() == "10000");
CHECK(j3b.dump() == "10000");
CHECK(j3c.dump() == "10000");
CHECK(j3a.dump() == "10000.0");
CHECK(j3b.dump() == "10000.0");
CHECK(j3c.dump() == "10000.0");
//CHECK(j3b.dump() == "1E04"); // roundtrip error
//CHECK(j3c.dump() == "1e04"); // roundtrip error
}