mirror of
https://github.com/nlohmann/json.git
synced 2026-11-03 03:15:34 +00:00
Fix test failures in the coverage tests
- unit-custom-object-key-type: remove the unused make_strict_key(strict_key) overload, the unused range constructor and default constructor, and guard data() with JSON_DIAGNOSTICS (unused-function/-member-function errors with GCC and clang -Weverything). - unit-json_view_compare: move the two new sections to the new unit-json_view_compare_values.cpp, as the object file got too large for the MinGW assembler again, and use a std::map with std::greater instead of std::unordered_map, which does not accept the incomplete basic_json (clang 3.9, icpc). - unit-json_view_dump: rename the variables that hid outer ones (MSVC C4456). - unit-stream-bulk-scan: restore the real size of the oversized get area before the adapter is destroyed (JSON_PRECISE_STREAM_POSITION reads the character at the read position), and skip the test where the streambuf cannot hold a get area larger than an int (MSVC). - unit-regression1: with JSON_NO_THREAD_LOCAL, copies are built member by member and keep correct timestamps, so check the corresponding outcome. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N5NasAgbDGG28MqXjQvLqp Signed-off-by: Claude <noreply@anthropic.com>
This commit is contained in:
6 files changed
+117
-91
No files matched your search
@@ -247,15 +247,15 @@ TEST_CASE("json_view dump")
|
||||
})
|
||||
{
|
||||
CAPTURE(token)
|
||||
const std::string text = std::string("[") + token + padding + "]";
|
||||
const json_document d = json_document::parse(text);
|
||||
const json j = json::parse(text);
|
||||
CHECK(d.root()[0].get<double>() == j[0].get<double>());
|
||||
CHECK(d.root().dump() == j.dump());
|
||||
const std::string padded = std::string("[") + token + padding + "]";
|
||||
const json_document padded_document = json_document::parse(padded);
|
||||
const json padded_json = json::parse(padded);
|
||||
CHECK(padded_document.root()[0].get<double>() == padded_json[0].get<double>());
|
||||
CHECK(padded_document.root().dump() == padded_json.dump());
|
||||
// a float document converts the tokens as well
|
||||
using json_float = nlohmann::basic_json<std::map, std::vector, std::string, bool, std::int64_t, std::uint64_t, float>;
|
||||
const nlohmann::basic_json_document<json_float> float_doc = nlohmann::basic_json_document<json_float>::parse(text);
|
||||
CHECK(float_doc.root()[0].get<float>() == json_float::parse(text)[0].get<float>());
|
||||
const nlohmann::basic_json_document<json_float> float_doc = nlohmann::basic_json_document<json_float>::parse(padded);
|
||||
CHECK(float_doc.root()[0].get<float>() == json_float::parse(padded)[0].get<float>());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user