- If an overflow occurs during parsing a number from a JSON text, an exception (std::out_of_range for the moment, to be replaced by a user-defined exception #244) is thrown so that the overflow is detected early and roundtripping is guaranteed. - NaN and INF floating-point values can be stored in a JSON value and are not replaced by null. That is, the basic_json class behaves like double in this regard (no exception occurs). However, NaN and INF are serialized to “null”. - Adjusted test cases appropriately.
This commit is contained in:
parent
9355f05888
commit
8feaf8dc94
8 changed files with 100 additions and 46 deletions
|
|
@ -272,7 +272,9 @@ TEST_CASE("parser class")
|
|||
|
||||
SECTION("overflow")
|
||||
{
|
||||
CHECK(json::parser("1.18973e+4932").parse() == json());
|
||||
// overflows during parsing yield an exception
|
||||
CHECK_THROWS_AS(json::parser("1.18973e+4932").parse() == json(), std::out_of_range);
|
||||
CHECK_THROWS_WITH(json::parser("1.18973e+4932").parse() == json(), "number overflow: 1.18973e+4932");
|
||||
}
|
||||
|
||||
SECTION("invalid numbers")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue