Exclude bytewise comparison in certain tests.
These tests never worked - they weren't run before
d5aaeb4
.
Note that these tests would fail because of this library
ordering dictionary keys (which is legal). So changing the
input files (or modifying stored cbor/msgpack/ubjson files)
would make the tests work and they could get removed from
"exclude_packaged".
Also move parsing of files in these unit tests to within
the inner sections, so that they're only parsed
number_of_files * number_of_sections instead of
number_of_files * number_of_files * number_of_sections
(so, instead of close to 100k parses about 700).
This commit is contained in:
parent
d5aaeb4cce
commit
05b27e83b7
3 changed files with 95 additions and 20 deletions
|
@ -1660,6 +1660,21 @@ TEST_CASE("CBOR roundtrips", "[hide]")
|
||||||
{
|
{
|
||||||
SECTION("input from flynn")
|
SECTION("input from flynn")
|
||||||
{
|
{
|
||||||
|
// most of these are exluded due to differences in key order (not a real problem)
|
||||||
|
auto exclude_packed = std::set<std::string>{
|
||||||
|
"test/data/json.org/1.json",
|
||||||
|
"test/data/json.org/2.json",
|
||||||
|
"test/data/json.org/3.json",
|
||||||
|
"test/data/json.org/4.json",
|
||||||
|
"test/data/json.org/5.json",
|
||||||
|
"test/data/json_testsuite/sample.json", // kills AppVeyor
|
||||||
|
"test/data/json_tests/pass1.json",
|
||||||
|
"test/data/regression/working_file.json",
|
||||||
|
"test/data/nst_json_testsuite/test_parsing/y_object.json",
|
||||||
|
"test/data/nst_json_testsuite/test_parsing/y_object_duplicated_key.json",
|
||||||
|
"test/data/nst_json_testsuite/test_parsing/y_object_long_strings.json",
|
||||||
|
};
|
||||||
|
|
||||||
for (std::string filename :
|
for (std::string filename :
|
||||||
{
|
{
|
||||||
"test/data/json_nlohmann_tests/all_unicode.json",
|
"test/data/json_nlohmann_tests/all_unicode.json",
|
||||||
|
@ -1811,12 +1826,12 @@ TEST_CASE("CBOR roundtrips", "[hide]")
|
||||||
{
|
{
|
||||||
CAPTURE(filename);
|
CAPTURE(filename);
|
||||||
|
|
||||||
|
SECTION(filename + ": std::vector<uint8_t>")
|
||||||
|
{
|
||||||
// parse JSON file
|
// parse JSON file
|
||||||
std::ifstream f_json(filename);
|
std::ifstream f_json(filename);
|
||||||
json j1 = json::parse(f_json);
|
json j1 = json::parse(f_json);
|
||||||
|
|
||||||
SECTION(filename + ": std::vector<uint8_t>")
|
|
||||||
{
|
|
||||||
// parse CBOR file
|
// parse CBOR file
|
||||||
std::ifstream f_cbor(filename + ".cbor", std::ios::binary);
|
std::ifstream f_cbor(filename + ".cbor", std::ios::binary);
|
||||||
std::vector<uint8_t> packed(
|
std::vector<uint8_t> packed(
|
||||||
|
@ -1831,6 +1846,10 @@ TEST_CASE("CBOR roundtrips", "[hide]")
|
||||||
|
|
||||||
SECTION(filename + ": std::ifstream")
|
SECTION(filename + ": std::ifstream")
|
||||||
{
|
{
|
||||||
|
// parse JSON file
|
||||||
|
std::ifstream f_json(filename);
|
||||||
|
json j1 = json::parse(f_json);
|
||||||
|
|
||||||
// parse CBOR file
|
// parse CBOR file
|
||||||
std::ifstream f_cbor(filename + ".cbor", std::ios::binary);
|
std::ifstream f_cbor(filename + ".cbor", std::ios::binary);
|
||||||
json j2;
|
json j2;
|
||||||
|
@ -1842,6 +1861,10 @@ TEST_CASE("CBOR roundtrips", "[hide]")
|
||||||
|
|
||||||
SECTION(filename + ": uint8_t* and size")
|
SECTION(filename + ": uint8_t* and size")
|
||||||
{
|
{
|
||||||
|
// parse JSON file
|
||||||
|
std::ifstream f_json(filename);
|
||||||
|
json j1 = json::parse(f_json);
|
||||||
|
|
||||||
// parse CBOR file
|
// parse CBOR file
|
||||||
std::ifstream f_cbor(filename + ".cbor", std::ios::binary);
|
std::ifstream f_cbor(filename + ".cbor", std::ios::binary);
|
||||||
std::vector<uint8_t> packed(
|
std::vector<uint8_t> packed(
|
||||||
|
@ -1856,12 +1879,18 @@ TEST_CASE("CBOR roundtrips", "[hide]")
|
||||||
|
|
||||||
SECTION(filename + ": output to output adapters")
|
SECTION(filename + ": output to output adapters")
|
||||||
{
|
{
|
||||||
|
// parse JSON file
|
||||||
|
std::ifstream f_json(filename);
|
||||||
|
json j1 = json::parse(f_json);
|
||||||
|
|
||||||
// parse CBOR file
|
// parse CBOR file
|
||||||
std::ifstream f_cbor(filename + ".cbor", std::ios::binary);
|
std::ifstream f_cbor(filename + ".cbor", std::ios::binary);
|
||||||
std::vector<uint8_t> packed(
|
std::vector<uint8_t> packed(
|
||||||
(std::istreambuf_iterator<char>(f_cbor)),
|
(std::istreambuf_iterator<char>(f_cbor)),
|
||||||
std::istreambuf_iterator<char>());
|
std::istreambuf_iterator<char>());
|
||||||
|
|
||||||
|
if (!exclude_packed.count(filename))
|
||||||
|
{
|
||||||
SECTION(filename + ": output adapters: std::vector<uint8_t>")
|
SECTION(filename + ": output adapters: std::vector<uint8_t>")
|
||||||
{
|
{
|
||||||
std::vector<uint8_t> vec;
|
std::vector<uint8_t> vec;
|
||||||
|
@ -1872,6 +1901,7 @@ TEST_CASE("CBOR roundtrips", "[hide]")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("all CBOR first bytes", "[!throws]")
|
TEST_CASE("all CBOR first bytes", "[!throws]")
|
||||||
{
|
{
|
||||||
|
|
|
@ -1349,6 +1349,24 @@ TEST_CASE("MessagePack roundtrips", "[hide]")
|
||||||
{
|
{
|
||||||
SECTION("input from msgpack-python")
|
SECTION("input from msgpack-python")
|
||||||
{
|
{
|
||||||
|
// most of these are exluded due to differences in key order (not a real problem)
|
||||||
|
auto exclude_packed = std::set<std::string>{
|
||||||
|
"test/data/json.org/1.json",
|
||||||
|
"test/data/json.org/2.json",
|
||||||
|
"test/data/json.org/3.json",
|
||||||
|
"test/data/json.org/4.json",
|
||||||
|
"test/data/json.org/5.json",
|
||||||
|
"test/data/json_testsuite/sample.json", // kills AppVeyor
|
||||||
|
"test/data/json_tests/pass1.json",
|
||||||
|
"test/data/regression/working_file.json",
|
||||||
|
"test/data/nst_json_testsuite/test_parsing/y_object.json",
|
||||||
|
"test/data/nst_json_testsuite/test_parsing/y_object_basic.json",
|
||||||
|
"test/data/nst_json_testsuite/test_parsing/y_object_duplicated_key.json",
|
||||||
|
"test/data/nst_json_testsuite/test_parsing/y_object_long_strings.json",
|
||||||
|
"test/data/nst_json_testsuite/test_parsing/y_object_simple.json",
|
||||||
|
"test/data/nst_json_testsuite/test_parsing/y_object_string_unicode.json",
|
||||||
|
};
|
||||||
|
|
||||||
for (std::string filename :
|
for (std::string filename :
|
||||||
{
|
{
|
||||||
"test/data/json_nlohmann_tests/all_unicode.json",
|
"test/data/json_nlohmann_tests/all_unicode.json",
|
||||||
|
@ -1500,12 +1518,12 @@ TEST_CASE("MessagePack roundtrips", "[hide]")
|
||||||
{
|
{
|
||||||
CAPTURE(filename);
|
CAPTURE(filename);
|
||||||
|
|
||||||
|
SECTION(filename + ": std::vector<uint8_t>")
|
||||||
|
{
|
||||||
// parse JSON file
|
// parse JSON file
|
||||||
std::ifstream f_json(filename);
|
std::ifstream f_json(filename);
|
||||||
json j1 = json::parse(f_json);
|
json j1 = json::parse(f_json);
|
||||||
|
|
||||||
SECTION(filename + ": std::vector<uint8_t>")
|
|
||||||
{
|
|
||||||
// parse MessagePack file
|
// parse MessagePack file
|
||||||
std::ifstream f_msgpack(filename + ".msgpack", std::ios::binary);
|
std::ifstream f_msgpack(filename + ".msgpack", std::ios::binary);
|
||||||
std::vector<uint8_t> packed(
|
std::vector<uint8_t> packed(
|
||||||
|
@ -1520,6 +1538,10 @@ TEST_CASE("MessagePack roundtrips", "[hide]")
|
||||||
|
|
||||||
SECTION(filename + ": std::ifstream")
|
SECTION(filename + ": std::ifstream")
|
||||||
{
|
{
|
||||||
|
// parse JSON file
|
||||||
|
std::ifstream f_json(filename);
|
||||||
|
json j1 = json::parse(f_json);
|
||||||
|
|
||||||
// parse MessagePack file
|
// parse MessagePack file
|
||||||
std::ifstream f_msgpack(filename + ".msgpack", std::ios::binary);
|
std::ifstream f_msgpack(filename + ".msgpack", std::ios::binary);
|
||||||
json j2;
|
json j2;
|
||||||
|
@ -1531,6 +1553,10 @@ TEST_CASE("MessagePack roundtrips", "[hide]")
|
||||||
|
|
||||||
SECTION(filename + ": uint8_t* and size")
|
SECTION(filename + ": uint8_t* and size")
|
||||||
{
|
{
|
||||||
|
// parse JSON file
|
||||||
|
std::ifstream f_json(filename);
|
||||||
|
json j1 = json::parse(f_json);
|
||||||
|
|
||||||
// parse MessagePack file
|
// parse MessagePack file
|
||||||
std::ifstream f_msgpack(filename + ".msgpack", std::ios::binary);
|
std::ifstream f_msgpack(filename + ".msgpack", std::ios::binary);
|
||||||
std::vector<uint8_t> packed(
|
std::vector<uint8_t> packed(
|
||||||
|
@ -1545,12 +1571,18 @@ TEST_CASE("MessagePack roundtrips", "[hide]")
|
||||||
|
|
||||||
SECTION(filename + ": output to output adapters")
|
SECTION(filename + ": output to output adapters")
|
||||||
{
|
{
|
||||||
|
// parse JSON file
|
||||||
|
std::ifstream f_json(filename);
|
||||||
|
json j1 = json::parse(f_json);
|
||||||
|
|
||||||
// parse MessagePack file
|
// parse MessagePack file
|
||||||
std::ifstream f_msgpack(filename + ".msgpack", std::ios::binary);
|
std::ifstream f_msgpack(filename + ".msgpack", std::ios::binary);
|
||||||
std::vector<uint8_t> packed(
|
std::vector<uint8_t> packed(
|
||||||
(std::istreambuf_iterator<char>(f_msgpack)),
|
(std::istreambuf_iterator<char>(f_msgpack)),
|
||||||
std::istreambuf_iterator<char>());
|
std::istreambuf_iterator<char>());
|
||||||
|
|
||||||
|
if (!exclude_packed.count(filename))
|
||||||
|
{
|
||||||
SECTION(filename + ": output adapters: std::vector<uint8_t>")
|
SECTION(filename + ": output adapters: std::vector<uint8_t>")
|
||||||
{
|
{
|
||||||
std::vector<uint8_t> vec;
|
std::vector<uint8_t> vec;
|
||||||
|
@ -1561,3 +1593,4 @@ TEST_CASE("MessagePack roundtrips", "[hide]")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -2199,12 +2199,12 @@ TEST_CASE("UBJSON roundtrips", "[hide]")
|
||||||
{
|
{
|
||||||
CAPTURE(filename);
|
CAPTURE(filename);
|
||||||
|
|
||||||
|
SECTION(filename + ": std::vector<uint8_t>")
|
||||||
|
{
|
||||||
// parse JSON file
|
// parse JSON file
|
||||||
std::ifstream f_json(filename);
|
std::ifstream f_json(filename);
|
||||||
json j1 = json::parse(f_json);
|
json j1 = json::parse(f_json);
|
||||||
|
|
||||||
SECTION(filename + ": std::vector<uint8_t>")
|
|
||||||
{
|
|
||||||
// parse MessagePack file
|
// parse MessagePack file
|
||||||
std::ifstream f_ubjson(filename + ".ubjson", std::ios::binary);
|
std::ifstream f_ubjson(filename + ".ubjson", std::ios::binary);
|
||||||
std::vector<uint8_t> packed(
|
std::vector<uint8_t> packed(
|
||||||
|
@ -2219,6 +2219,10 @@ TEST_CASE("UBJSON roundtrips", "[hide]")
|
||||||
|
|
||||||
SECTION(filename + ": std::ifstream")
|
SECTION(filename + ": std::ifstream")
|
||||||
{
|
{
|
||||||
|
// parse JSON file
|
||||||
|
std::ifstream f_json(filename);
|
||||||
|
json j1 = json::parse(f_json);
|
||||||
|
|
||||||
// parse MessagePack file
|
// parse MessagePack file
|
||||||
std::ifstream f_ubjson(filename + ".ubjson", std::ios::binary);
|
std::ifstream f_ubjson(filename + ".ubjson", std::ios::binary);
|
||||||
json j2;
|
json j2;
|
||||||
|
@ -2230,6 +2234,10 @@ TEST_CASE("UBJSON roundtrips", "[hide]")
|
||||||
|
|
||||||
SECTION(filename + ": uint8_t* and size")
|
SECTION(filename + ": uint8_t* and size")
|
||||||
{
|
{
|
||||||
|
// parse JSON file
|
||||||
|
std::ifstream f_json(filename);
|
||||||
|
json j1 = json::parse(f_json);
|
||||||
|
|
||||||
// parse MessagePack file
|
// parse MessagePack file
|
||||||
std::ifstream f_ubjson(filename + ".ubjson", std::ios::binary);
|
std::ifstream f_ubjson(filename + ".ubjson", std::ios::binary);
|
||||||
std::vector<uint8_t> packed(
|
std::vector<uint8_t> packed(
|
||||||
|
@ -2244,6 +2252,10 @@ TEST_CASE("UBJSON roundtrips", "[hide]")
|
||||||
|
|
||||||
SECTION(filename + ": output to output adapters")
|
SECTION(filename + ": output to output adapters")
|
||||||
{
|
{
|
||||||
|
// parse JSON file
|
||||||
|
std::ifstream f_json(filename);
|
||||||
|
json j1 = json::parse(f_json);
|
||||||
|
|
||||||
// parse MessagePack file
|
// parse MessagePack file
|
||||||
std::ifstream f_ubjson(filename + ".ubjson", std::ios::binary);
|
std::ifstream f_ubjson(filename + ".ubjson", std::ios::binary);
|
||||||
std::vector<uint8_t> packed(
|
std::vector<uint8_t> packed(
|
||||||
|
|
Loading…
Reference in a new issue