mirror of
https://github.com/nlohmann/json
synced 2024-12-11 04:00:07 +00:00
Fixed suffixing .0 and modified the unit tests accordingly
This commit is contained in:
parent
21cae35930
commit
2197856395
@ -6520,8 +6520,9 @@ class basic_json
|
|||||||
const bool value_is_int_like =
|
const bool value_is_int_like =
|
||||||
std::find_if(m_buf.begin(), data_end,
|
std::find_if(m_buf.begin(), data_end,
|
||||||
[](const char c)
|
[](const char c)
|
||||||
{ return (c >= '0' and c <= '9')
|
{ return c == '.'
|
||||||
or c == '-'; })
|
or c == 'e'
|
||||||
|
or c == 'E'; })
|
||||||
== data_end;
|
== data_end;
|
||||||
|
|
||||||
assert(data_end + 2 < m_buf.end());
|
assert(data_end + 2 < m_buf.end());
|
||||||
|
@ -6520,8 +6520,9 @@ class basic_json
|
|||||||
const bool value_is_int_like =
|
const bool value_is_int_like =
|
||||||
std::find_if(m_buf.begin(), data_end,
|
std::find_if(m_buf.begin(), data_end,
|
||||||
[](const char c)
|
[](const char c)
|
||||||
{ return (c >= '0' and c <= '9')
|
{ return c == '.'
|
||||||
or c == '-'; })
|
or c == 'e'
|
||||||
|
or c == 'E'; })
|
||||||
== data_end;
|
== data_end;
|
||||||
|
|
||||||
assert(data_end + 2 < m_buf.end());
|
assert(data_end + 2 < m_buf.end());
|
||||||
|
@ -394,9 +394,9 @@ TEST_CASE("regression tests")
|
|||||||
//issue #230
|
//issue #230
|
||||||
//CHECK(j2b.dump() == "23.42");
|
//CHECK(j2b.dump() == "23.42");
|
||||||
|
|
||||||
CHECK(j3a.dump() == "10000");
|
CHECK(j3a.dump() == "10000.0");
|
||||||
CHECK(j3b.dump() == "10000");
|
CHECK(j3b.dump() == "10000.0");
|
||||||
CHECK(j3c.dump() == "10000");
|
CHECK(j3c.dump() == "10000.0");
|
||||||
//CHECK(j3b.dump() == "1E04"); // roundtrip error
|
//CHECK(j3b.dump() == "1E04"); // roundtrip error
|
||||||
//CHECK(j3c.dump() == "1e04"); // roundtrip error
|
//CHECK(j3c.dump() == "1e04"); // roundtrip error
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user