1
0
mirror of https://github.com/nlohmann/json.git synced 2026-07-29 15:13:04 +04:00

🎨 use Clang-Format

This commit is contained in:
Niels Lohmann
2023-11-29 21:46:01 +01:00
parent 286f0c7647
commit af3f87e84e
77 changed files with 4290 additions and 4393 deletions
+16 -16
View File
@@ -333,7 +333,7 @@ TEST_CASE("parser class")
SECTION("nonempty array")
{
CHECK(parser_helper("[true, false, null]") == json({true, false, nullptr}));
CHECK(parser_helper("[true, false, null]") == json({ true, false, nullptr }));
}
}
@@ -347,7 +347,7 @@ TEST_CASE("parser class")
SECTION("nonempty object")
{
CHECK(parser_helper("{\"\": true, \"one\": 1, \"two\": null}") == json({{"", true}, {"one", 1}, {"two", nullptr}}));
CHECK(parser_helper("{\"\": true, \"one\": 1, \"two\": null}") == json({ { "", true }, { "one", 1 }, { "two", nullptr } }));
}
}
@@ -1675,13 +1675,13 @@ TEST_CASE("parser class")
return true;
});
CHECK(j_object == json({{"foo", 2}, {"bar", {{"baz", 1}}}}));
CHECK(j_object == json({ { "foo", 2 }, { "bar", { { "baz", 1 } } } }));
json j_array = json::parse(s_array, [](int /*unused*/, json::parse_event_t /*unused*/, const json& /*unused*/) noexcept {
return true;
});
CHECK(j_array == json({1, 2, {3, 4, 5}, 4, 5}));
CHECK(j_array == json({ 1, 2, { 3, 4, 5 }, 4, 5 }));
}
SECTION("filter everything")
@@ -1708,13 +1708,13 @@ TEST_CASE("parser class")
return event != json::parse_event_t::value || j != json(2);
});
CHECK(j_object == json({{"bar", {{"baz", 1}}}}));
CHECK(j_object == json({ { "bar", { { "baz", 1 } } } }));
json j_array = json::parse(s_array, [](int /*unused*/, json::parse_event_t event, const json& j) noexcept {
return event != json::parse_event_t::value || j != json(2);
});
CHECK(j_array == json({1, {3, 4, 5}, 4, 5}));
CHECK(j_array == json({ 1, { 3, 4, 5 }, 4, 5 }));
}
SECTION("filter object in array")
@@ -1725,7 +1725,7 @@ TEST_CASE("parser class")
// the specified object will be discarded, and removed.
CHECK(j_filtered1.size() == 2);
CHECK(j_filtered1 == json({1, {{"qux", "baz"}}}));
CHECK(j_filtered1 == json({ 1, { { "qux", "baz" } } }));
json j_filtered2 = json::parse(structured_array, [](int /*unused*/, json::parse_event_t e, const json& /*parsed*/) noexcept {
return e != json::parse_event_t::object_end;
@@ -1733,7 +1733,7 @@ TEST_CASE("parser class")
// removed all objects in array.
CHECK(j_filtered2.size() == 1);
CHECK(j_filtered2 == json({1}));
CHECK(j_filtered2 == json({ 1 }));
}
SECTION("filter specific events")
@@ -1753,7 +1753,7 @@ TEST_CASE("parser class")
});
// the first completed object will be discarded
CHECK(j_object == json({{"foo", 2}}));
CHECK(j_object == json({ { "foo", 2 } }));
}
{
@@ -1769,7 +1769,7 @@ TEST_CASE("parser class")
});
// the first completed array will be discarded
CHECK(j_array == json({1, 2, 4, 5}));
CHECK(j_array == json({ 1, 2, 4, 5 }));
}
}
}
@@ -1796,7 +1796,7 @@ TEST_CASE("parser class")
{
SECTION("from std::vector")
{
std::vector<uint8_t> v = {'t', 'r', 'u', 'e'};
std::vector<uint8_t> v = { 't', 'r', 'u', 'e' };
json j;
json::parser(nlohmann::detail::input_adapter(std::begin(v), std::end(v))).parse(true, j);
CHECK(j == json(true));
@@ -1804,7 +1804,7 @@ TEST_CASE("parser class")
SECTION("from std::array")
{
std::array<uint8_t, 5> v{{'t', 'r', 'u', 'e'}};
std::array<uint8_t, 5> v{ { 't', 'r', 'u', 'e' } };
json j;
json::parser(nlohmann::detail::input_adapter(std::begin(v), std::end(v))).parse(true, j);
CHECK(j == json(true));
@@ -1812,7 +1812,7 @@ TEST_CASE("parser class")
SECTION("from array")
{
uint8_t v[] = {'t', 'r', 'u', 'e'}; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
uint8_t v[] = { 't', 'r', 'u', 'e' }; // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays)
json j;
json::parser(nlohmann::detail::input_adapter(std::begin(v), std::end(v))).parse(true, j);
CHECK(j == json(true));
@@ -1825,7 +1825,7 @@ TEST_CASE("parser class")
SECTION("from std::string")
{
std::string v = {'t', 'r', 'u', 'e'};
std::string v = { 't', 'r', 'u', 'e' };
json j;
json::parser(nlohmann::detail::input_adapter(std::begin(v), std::end(v))).parse(true, j);
CHECK(j == json(true));
@@ -1833,7 +1833,7 @@ TEST_CASE("parser class")
SECTION("from std::initializer_list")
{
std::initializer_list<uint8_t> const v = {'t', 'r', 'u', 'e'};
std::initializer_list<uint8_t> const v = { 't', 'r', 'u', 'e' };
json j;
json::parser(nlohmann::detail::input_adapter(std::begin(v), std::end(v))).parse(true, j);
CHECK(j == json(true));
@@ -1841,7 +1841,7 @@ TEST_CASE("parser class")
SECTION("from std::valarray")
{
std::valarray<uint8_t> v = {'t', 'r', 'u', 'e'};
std::valarray<uint8_t> v = { 't', 'r', 'u', 'e' };
json j;
json::parser(nlohmann::detail::input_adapter(std::begin(v), std::end(v))).parse(true, j);
CHECK(j == json(true));