diff --git a/tests/src/unit-json_view_edit.cpp b/tests/src/unit-json_view_edit.cpp index bd16b54dd..fc419d4d1 100644 --- a/tests/src/unit-json_view_edit.cpp +++ b/tests/src/unit-json_view_edit.cpp @@ -52,7 +52,7 @@ int r(int n) return static_cast(edit_rng() % static_cast(n)); } -int counter = 0; +int edit_counter = 0; std::uint64_t edit_bits(double x) { @@ -103,7 +103,7 @@ ordered_json random_value(int depth) ordered_json o = ordered_json::object(); for (int i = r(5); i > 0; --i) { - o[random_string() + "#" + std::to_string(counter++)] = random_value(depth + 1); + o[random_string() + "#" + std::to_string(edit_counter++)] = random_value(depth + 1); } return o; } @@ -435,7 +435,7 @@ TEST_CASE("json_view edits: differential") } else if ((op == 4 || op == 5) && target.is_object()) // set a member (new or existing) { - std::string key = random_string() + "#" + std::to_string(counter++); + std::string key = random_string() + "#" + std::to_string(edit_counter++); if (op == 5 && !target.empty()) { key = std::next(target.begin(), r(static_cast(target.size()))).key(); diff --git a/tests/src/unit-json_view_image.cpp b/tests/src/unit-json_view_image.cpp index b9c43f69b..f74bdcce0 100644 --- a/tests/src/unit-json_view_image.cpp +++ b/tests/src/unit-json_view_image.cpp @@ -38,7 +38,7 @@ using nlohmann::detail::view::node; namespace { #if !defined(JSON_NOEXCEPTION) -std::string exception_of(const std::function& f) +std::string image_exception_of(const std::function& f) { try { @@ -119,7 +119,7 @@ void set_node(std::vector& image, std::size_t i, const node& n) /// the result of loading an image with a check: "" or the exception message std::string load_result(const std::vector& image, image_check check) { - return exception_of([&] + return image_exception_of([&] { const json_document d = json_document::load(image, check); static_cast(d); @@ -701,9 +701,9 @@ TEST_CASE("json_view images: errors") SECTION("saving a discarded document") { const json_document empty{}; - CHECK(exception_of([&] { static_cast(empty.save()); }) == "[json.exception.type_error.320] cannot save a discarded json_document"); + CHECK(image_exception_of([&] { static_cast(empty.save()); }) == "[json.exception.type_error.320] cannot save a discarded json_document"); const json_document failed = json_document::parse("[1,", false); - CHECK(exception_of([&] { static_cast(failed.save()); }) == "[json.exception.type_error.320] cannot save a discarded json_document"); + CHECK(image_exception_of([&] { static_cast(failed.save()); }) == "[json.exception.type_error.320] cannot save a discarded json_document"); } const std::vector image = json_document::parse(R"({"a": [1, "\u00e9"]})").save(); @@ -711,12 +711,12 @@ TEST_CASE("json_view images: errors") SECTION("header and sizes") { - CHECK(exception_of([] + CHECK(image_exception_of([] { const json_document d = json_document::load(nullptr, 0); static_cast(d); }) == prefix + "too short"); - CHECK(exception_of([&] + CHECK(image_exception_of([&] { const json_document d = json_document::load(image.data(), 63); static_cast(d);