🚧 support for UBJSON high-precision numbers #2286

This commit is contained in:
Niels Lohmann 2020-07-20 09:42:37 +02:00
parent b1da58b76b
commit 7cf2fe149c
No known key found for this signature in database
GPG key ID: 7F3CEA63AE251B69
3 changed files with 1696 additions and 1627 deletions

View file

@ -767,6 +767,14 @@ TEST_CASE("UBJSON")
CHECK(json::from_ubjson(result, true, false) == j);
}
}
SECTION("high-precision number")
{
std::vector<uint8_t> vec = {'H', 'i', 0x16, '3', '.', '1', '4', '1', '5', '9', '2', '6', '5', '3', '5', '8', '9', '7', '9', '3', '2', '3', '8', '4', '6'};
const auto j = json::from_ubjson(vec);
CHECK(j.is_number_float());
CHECK(j.dump() == "3.141592653589793");
}
}
SECTION("string")
@ -2369,7 +2377,7 @@ TEST_CASE("all UBJSON first bytes")
// these bytes will fail immediately with exception parse_error.112
std::set<uint8_t> supported =
{
'T', 'F', 'Z', 'U', 'i', 'I', 'l', 'L', 'd', 'D', 'C', 'S', '[', '{', 'N'
'T', 'F', 'Z', 'U', 'i', 'I', 'l', 'L', 'd', 'D', 'C', 'S', '[', '{', 'N', 'H'
};
for (auto i = 0; i < 256; ++i)