mirror of
https://github.com/nlohmann/json.git
synced 2025-07-29 23:01:16 +03:00
🔨 small improvements
This commit is contained in:
@ -37,14 +37,6 @@ TEST_CASE("BSON")
|
||||
{
|
||||
SECTION("individual values not supported")
|
||||
{
|
||||
SECTION("discarded")
|
||||
{
|
||||
// discarded values are not serialized
|
||||
json j = json::value_t::discarded;
|
||||
const auto result = json::to_bson(j);
|
||||
CHECK(result.empty());
|
||||
}
|
||||
|
||||
SECTION("null")
|
||||
{
|
||||
json j = nullptr;
|
||||
@ -392,32 +384,6 @@ TEST_CASE("BSON")
|
||||
CHECK(json::from_bson(result, true, false) == j);
|
||||
}
|
||||
|
||||
SECTION("discarded values are not serialized")
|
||||
{
|
||||
json j = json::value_t::discarded;
|
||||
const auto result = json::to_bson(j);
|
||||
CHECK(result.empty());
|
||||
}
|
||||
|
||||
SECTION("discarded members are not serialized")
|
||||
{
|
||||
json j =
|
||||
{
|
||||
{ "entry", json::value_t::discarded }
|
||||
};
|
||||
|
||||
std::vector<uint8_t> expected =
|
||||
{
|
||||
0x05, 0x00, 0x00, 0x00, // size (little endian)
|
||||
// no entries
|
||||
0x00 // end marker
|
||||
};
|
||||
|
||||
const auto result = json::to_bson(j);
|
||||
CHECK(result == expected);
|
||||
}
|
||||
|
||||
|
||||
SECTION("non-empty object with object member")
|
||||
{
|
||||
json j =
|
||||
@ -1136,7 +1102,7 @@ TEST_CASE("BSON numerical data")
|
||||
};
|
||||
|
||||
CHECK_THROWS_AS(json::to_bson(j), json::out_of_range&);
|
||||
CHECK_THROWS_WITH(json::to_bson(j), "[json.exception.out_of_range.407] number overflow serializing " + std::to_string(i));
|
||||
CHECK_THROWS_WITH(json::to_bson(j), "[json.exception.out_of_range.407] integer number " + std::to_string(i) + " cannot be represented by BSON as it does not fit int64");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user