From b9dcf0fc0fdc43660cb3133586ca2e467604c7ea Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 18 Oct 2026 13:31:17 +0200 Subject: [PATCH] Count matching keys as unsigned in the json_view edit tests Like in the access test, adding the int result of the conditional to a std::size_t fails -Werror=sign-conversion with GCC. Signed-off-by: Niels Lohmann --- tests/src/unit-json_view_edit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/src/unit-json_view_edit.cpp b/tests/src/unit-json_view_edit.cpp index 403721665..d47e18dae 100644 --- a/tests/src/unit-json_view_edit.cpp +++ b/tests/src/unit-json_view_edit.cpp @@ -229,7 +229,7 @@ std::size_t occurrences(const ordered_json_editable_view& v, const std::string& std::size_t result = 0; for (const auto& item : v.items()) { - result += std::string(item.key().data(), item.key().size()) == key ? 1 : 0; + result += std::string(item.key().data(), item.key().size()) == key ? 1u : 0u; } return result; } @@ -977,7 +977,7 @@ void check_first_wins(const View& o, int expected) std::size_t members_a = 0; for (const auto& item : o.items()) { - members_a += std::string(item.key().data(), item.key().size()) == "a" ? 1 : 0; + members_a += std::string(item.key().data(), item.key().size()) == "a" ? 1u : 0u; } CHECK(o.count("a") == members_a); // every member, unlike the lookups }