1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:37:35 +00:00

AK: Fix userland parsing of rounded floating point numbers

Parse JSON floating point literals properly,
No longer throwing a SyntaxError when the decimal portion
of the number exceeds the capacity of u32.

Added tests to AK/TestJSON and LibJS/builtins/JSON/JSON.parse
This commit is contained in:
serenitydev 2022-02-11 03:29:08 -05:00 committed by Tim Flynn
parent af75503c17
commit 23c72c6728
3 changed files with 19 additions and 8 deletions

View file

@ -128,3 +128,9 @@ TEST_CASE(json_parse_empty_string)
auto value = JsonValue::from_string("");
EXPECT_EQ(value.value().is_null(), true);
}
TEST_CASE(json_parse_long_decimals)
{
auto value = JsonValue::from_string("1644452550.6489999294281");
EXPECT_EQ(value.value().as_double(), 1644452550.6489999294281);
}