🔨 more work on the number parser

This commit is contained in:
Niels Lohmann 2017-02-13 18:51:23 +01:00
parent b84705d557
commit 265c5b5207
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
3 changed files with 84 additions and 43 deletions

View file

@ -270,6 +270,11 @@ TEST_CASE("parser class")
}
}
SECTION("overflow")
{
CHECK(json::parser("1.18973e+4932").parse() == json());
}
SECTION("invalid numbers")
{
CHECK_THROWS_AS(json::parser("01").parse(), std::invalid_argument);
@ -294,7 +299,7 @@ TEST_CASE("parser class")
CHECK_THROWS_AS(json::parser("+0").parse(), std::invalid_argument);
CHECK_THROWS_WITH(json::parser("01").parse(),
"parse error - unexpected number literal; expected end of input");
"parse error - unexpected number literal");
CHECK_THROWS_WITH(json::parser("--1").parse(), "parse error - unexpected '-'");
CHECK_THROWS_WITH(json::parser("1.").parse(),
"parse error - unexpected '.'; expected end of input");