diff --git a/tests/src/unit-bson.cpp b/tests/src/unit-bson.cpp index b4756c9b5..09321e3d5 100644 --- a/tests/src/unit-bson.cpp +++ b/tests/src/unit-bson.cpp @@ -1311,7 +1311,7 @@ TEST_CASE("BSON declared document size bounds the content") // records the events that a SAX parser receives struct recorder : nlohmann::json_sax { - std::string events; + std::string events {}; bool null() override { diff --git a/tests/src/unit-json_patch.cpp b/tests/src/unit-json_patch.cpp index b6c78532d..cc1b26a40 100644 --- a/tests/src/unit-json_patch.cpp +++ b/tests/src/unit-json_patch.cpp @@ -2178,8 +2178,13 @@ TEST_CASE("JSON patch - behavior documented in the API reference") SECTION("patch() has the strong guarantee") { - const json doc = R"({"a": [1, 2], "o": {"k": "v"}})"_json; - const json before = doc; + // independent values, so that the comparison below checks the untouched document + const auto make_doc = [] + { + return R"({"a": [1, 2], "o": {"k": "v"}})"_json; + }; + const json doc = make_doc(); + const json before = make_doc(); const std::vector failing = { @@ -2202,7 +2207,7 @@ TEST_CASE("JSON patch - behavior documented in the API reference") CHECK_THROWS_AS(doc.patch(patch), json::exception&); CHECK(doc == before); - json copy = doc; + json copy = make_doc(); CHECK_THROWS_AS(copy.patch(patch), json::exception&); CHECK(copy == before); } diff --git a/tests/src/unit-json_view_builder.cpp b/tests/src/unit-json_view_builder.cpp index 1074f7018..4023c7848 100644 --- a/tests/src/unit-json_view_builder.cpp +++ b/tests/src/unit-json_view_builder.cpp @@ -592,7 +592,7 @@ TEST_CASE("json_view node integer bits") }) { CAPTURE(v) - n.kind = static_cast(0x5A); + n.kind = nlohmann::detail::view::node_kind::link; n.flags = 0xA5; n.extra = 0x1234; n.off = 0x89ABCDEFu; @@ -601,7 +601,7 @@ TEST_CASE("json_view node integer bits") CHECK(n.len == static_cast(v)); CHECK(n.next == static_cast(v >> 32)); // the other fields are untouched - CHECK(static_cast(n.kind) == 0x5A); + CHECK(n.kind == nlohmann::detail::view::node_kind::link); CHECK(n.flags == 0xA5); CHECK(n.extra == 0x1234); CHECK(n.off == 0x89ABCDEFu);