revert fix

This commit is contained in:
Niels Lohmann 2022-09-11 12:58:48 +02:00
parent 6b03e77c1c
commit f048eeb870
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69

View File

@ -153,7 +153,7 @@ TEST_CASE("constructors")
SECTION("std::map<std::string, std::string> #600") SECTION("std::map<std::string, std::string> #600")
{ {
std::map<std::string, std::string> m const std::map<std::string, std::string> m
{ {
{"a", "b"}, {"a", "b"},
{"c", "d"}, {"c", "d"},
@ -1108,9 +1108,9 @@ TEST_CASE("constructors")
SECTION("constructor with implicit types (array)") SECTION("constructor with implicit types (array)")
{ {
// This should break through any short string optimization in std::string // This should break through any short string optimization in std::string
std::string const source(1024, '!'); std::string source(1024, '!');
const auto* source_addr = source.data(); const auto* source_addr = source.data();
json const j = {std::move(source)}; json j = {std::move(source)};
const auto* target_addr = j[0].get_ref<std::string const&>().data(); const auto* target_addr = j[0].get_ref<std::string const&>().data();
const bool success = (target_addr == source_addr); const bool success = (target_addr == source_addr);
CHECK(success); CHECK(success);
@ -1269,7 +1269,7 @@ TEST_CASE("constructors")
json const v = {1, "foo", 34.23, {1, 2, 3}, {{"A", 1}, {"B", 2u}}}; json const v = {1, "foo", 34.23, {1, 2, 3}, {{"A", 1}, {"B", 2u}}};
json const arr(1, v); json const arr(1, v);
CHECK(arr.size() == 1); CHECK(arr.size() == 1);
for (auto& x : arr) for (const auto& x : arr)
{ {
CHECK(x == v); CHECK(x == v);
} }
@ -1280,7 +1280,7 @@ TEST_CASE("constructors")
json const v = {1, "foo", 34.23, {1, 2, 3}, {{"A", 1}, {"B", 2u}}}; json const v = {1, "foo", 34.23, {1, 2, 3}, {{"A", 1}, {"B", 2u}}};
json const arr(3, v); json const arr(3, v);
CHECK(arr.size() == 3); CHECK(arr.size() == 3);
for (auto& x : arr) for (const auto& x : arr)
{ {
CHECK(x == v); CHECK(x == v);
} }