Check both shapes without a C-style array

clang-tidy rejects the array the two shapes were iterated over
(cppcoreguidelines-avoid-c-arrays). The array only existed because astyle
reformats a range-for over a braced initializer list into something
unreadable; naming the two cases avoids both.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann
2026-09-02 19:06:38 +02:00
parent 01cb01c873
commit cda12819bd
+19 -8
View File
@@ -112,15 +112,26 @@ TEST_CASE("Better diagnostics with positions")
} }
}; };
const bool shapes[] = {false, true}; const auto check_arrays = [&check_copy](std::size_t depth)
for (const bool objects : shapes)
{ {
check_copy(1, objects); check_copy(depth, false);
check_copy(127, objects); };
check_copy(128, objects); const auto check_objects = [&check_copy](std::size_t depth)
check_copy(129, objects); {
check_copy(300, objects); check_copy(depth, true);
} };
check_arrays(1);
check_arrays(127);
check_arrays(128);
check_arrays(129);
check_arrays(300);
check_objects(1);
check_objects(127);
check_objects(128);
check_objects(129);
check_objects(300);
} }
SECTION("JSON patch add to primitive parent (#4292)") SECTION("JSON patch add to primitive parent (#4292)")