mirror of
https://github.com/nlohmann/json.git
synced 2025-07-25 13:41:56 +03:00
Make section names unique in loops, as catch doesn't support duplicate
sections, see also https://github.com/catchorg/Catch2/issues/816#issuecomment-278268122 As a result, when built with gcc, loop iterations were skipped. When built with clang, the test aborted with an assertion in catch.hpp line 6222. This also addresses the issues discussed here: https://github.com/nlohmann/json/issues/1032#issuecomment-378707696 and here: https://github.com/catchorg/Catch2/issues/1241 Please note that this introduces new problems, as some of the unit tests fail now - the library stores keys in lexographical order, while the cbor/msgpack/ubjson examples store them in original order.
This commit is contained in:
@ -1504,7 +1504,7 @@ TEST_CASE("MessagePack roundtrips", "[hide]")
|
||||
std::ifstream f_json(filename);
|
||||
json j1 = json::parse(f_json);
|
||||
|
||||
SECTION("std::vector<uint8_t>")
|
||||
SECTION(filename + ": std::vector<uint8_t>")
|
||||
{
|
||||
// parse MessagePack file
|
||||
std::ifstream f_msgpack(filename + ".msgpack", std::ios::binary);
|
||||
@ -1518,7 +1518,7 @@ TEST_CASE("MessagePack roundtrips", "[hide]")
|
||||
CHECK(j1 == j2);
|
||||
}
|
||||
|
||||
SECTION("std::ifstream")
|
||||
SECTION(filename + ": std::ifstream")
|
||||
{
|
||||
// parse MessagePack file
|
||||
std::ifstream f_msgpack(filename + ".msgpack", std::ios::binary);
|
||||
@ -1529,7 +1529,7 @@ TEST_CASE("MessagePack roundtrips", "[hide]")
|
||||
CHECK(j1 == j2);
|
||||
}
|
||||
|
||||
SECTION("uint8_t* and size")
|
||||
SECTION(filename + ": uint8_t* and size")
|
||||
{
|
||||
// parse MessagePack file
|
||||
std::ifstream f_msgpack(filename + ".msgpack", std::ios::binary);
|
||||
@ -1543,7 +1543,7 @@ TEST_CASE("MessagePack roundtrips", "[hide]")
|
||||
CHECK(j1 == j2);
|
||||
}
|
||||
|
||||
SECTION("output to output adapters")
|
||||
SECTION(filename + ": output to output adapters")
|
||||
{
|
||||
// parse MessagePack file
|
||||
std::ifstream f_msgpack(filename + ".msgpack", std::ios::binary);
|
||||
@ -1551,7 +1551,7 @@ TEST_CASE("MessagePack roundtrips", "[hide]")
|
||||
(std::istreambuf_iterator<char>(f_msgpack)),
|
||||
std::istreambuf_iterator<char>());
|
||||
|
||||
SECTION("std::vector<uint8_t>")
|
||||
SECTION(filename + ": output adapters: std::vector<uint8_t>")
|
||||
{
|
||||
std::vector<uint8_t> vec;
|
||||
json::to_msgpack(j1, vec);
|
||||
|
Reference in New Issue
Block a user