mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:17:44 +00:00
AK: Allow exponents in JSON double values
This is required for ECMA-404 compliance, but probably not for serenity itself.
This commit is contained in:
parent
68c6161f25
commit
75ebcf6b4a
2 changed files with 55 additions and 8 deletions
|
@ -134,3 +134,12 @@ TEST_CASE(json_parse_long_decimals)
|
|||
auto value = JsonValue::from_string("1644452550.6489999294281"sv);
|
||||
EXPECT_EQ(value.value().as_double(), 1644452550.6489999294281);
|
||||
}
|
||||
|
||||
TEST_CASE(json_parse_number_with_exponent)
|
||||
{
|
||||
auto value_without_fraction = JsonValue::from_string("10e5"sv);
|
||||
EXPECT_EQ(value_without_fraction.value().as_double(), 1000000.0);
|
||||
|
||||
auto value_with_fraction = JsonValue::from_string("10.5e5"sv);
|
||||
EXPECT_EQ(value_with_fraction.value().as_double(), 1050000.0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue