mirror of
https://github.com/nlohmann/json.git
synced 2026-10-20 13:08:13 +00:00
♻️ implement floating-point special values
This commit is contained in:
3 files changed
+46
-6
No files matched your search
@@ -468,6 +468,30 @@ TEST_CASE("BON8")
|
||||
const auto result = json::to_bon8(j);
|
||||
CHECK(result == expected);
|
||||
}
|
||||
|
||||
SECTION("NAN")
|
||||
{
|
||||
json j = NAN;
|
||||
std::vector<uint8_t> expected = {0x8E, 0x7F, 0x80, 0x00, 0x01};
|
||||
const auto result = json::to_bon8(j);
|
||||
CHECK(result == expected);
|
||||
}
|
||||
|
||||
SECTION("infinity")
|
||||
{
|
||||
json j = INFINITY;
|
||||
std::vector<uint8_t> expected = {0x8E, 0x7F, 0x80, 0x00, 0x00};
|
||||
const auto result = json::to_bon8(j);
|
||||
CHECK(result == expected);
|
||||
}
|
||||
|
||||
SECTION("-infinity")
|
||||
{
|
||||
json j = -INFINITY;
|
||||
std::vector<uint8_t> expected = {0x8E, 0xFF, 0x80, 0x00, 0x00};
|
||||
const auto result = json::to_bon8(j);
|
||||
CHECK(result == expected);
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("floats")
|
||||
|
||||
Reference in new issue
Block a user