// overflows during parsing yield an exception, but is accepted anyway
CHECK(parse_string("1.18973e+4932").accept());
}
SECTION("invalid numbers")
{
CHECK(parse_string("01").accept()==false);
CHECK(parse_string("--1").accept()==false);
CHECK(parse_string("1.").accept()==false);
CHECK(parse_string("1E").accept()==false);
CHECK(parse_string("1E-").accept()==false);
CHECK(parse_string("1.E1").accept()==false);
CHECK(parse_string("-1E").accept()==false);
CHECK(parse_string("-0E#").accept()==false);
CHECK(parse_string("-0E-#").accept()==false);
CHECK(parse_string("-0#").accept()==false);
CHECK(parse_string("-0.0:").accept()==false);
CHECK(parse_string("-0.0Z").accept()==false);
CHECK(parse_string("-0E123:").accept()==false);
CHECK(parse_string("-0e0-:").accept()==false);
CHECK(parse_string("-0e-:").accept()==false);
CHECK(parse_string("-0f").accept()==false);
// numbers must not begin with "+"
CHECK(parse_string("+1").accept()==false);
CHECK(parse_string("+0").accept()==false);
}
}
}
SECTION("parse errors")
SECTION("parse errors")
{
{
// unexpected end of number
// unexpected end of number
...
@@ -661,6 +923,189 @@ TEST_CASE("parser class")
...
@@ -661,6 +923,189 @@ TEST_CASE("parser class")
"[json.exception.parse_error.101] parse error at 13: syntax error - invalid string: surrogate U+D80C must be followed by U+DC00..U+DFFF instead of U+FFFF; last read '\"\\uD80C\\uFFFF'");
"[json.exception.parse_error.101] parse error at 13: syntax error - invalid string: surrogate U+D80C must be followed by U+DC00..U+DFFF instead of U+FFFF; last read '\"\\uD80C\\uFFFF'");