From da1f889e384a2b5650ec506686474a078e2b2316 Mon Sep 17 00:00:00 2001 From: stephenberry Date: Mon, 16 Dec 2024 23:02:55 +0000 Subject: [PATCH] Committing clang-format changes --- include/glaze/json/read.hpp | 6 +++--- tests/json_test/json_test.cpp | 23 ++++++++++++----------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/glaze/json/read.hpp b/include/glaze/json/read.hpp index 8d58222501..c2597910e7 100644 --- a/include/glaze/json/read.hpp +++ b/include/glaze/json/read.hpp @@ -1807,7 +1807,7 @@ namespace glz bool first = true; while (true) { - if constexpr ((glaze_object_t || reflectable) && Opts.partial_read) { + if constexpr ((glaze_object_t || reflectable)&&Opts.partial_read) { static constexpr bit_array all_fields = [] { bit_array arr{}; for (size_t i = 0; i < num_members; ++i) { @@ -1824,8 +1824,8 @@ namespace glz if (*it == '}') { GLZ_SUB_LEVEL; - if constexpr ((glaze_object_t || reflectable)&&(Opts.partial_read && - Opts.error_on_missing_keys)) { + if constexpr ((glaze_object_t || + reflectable)&&(Opts.partial_read && Opts.error_on_missing_keys)) { ctx.error = error_code::missing_key; return; } diff --git a/tests/json_test/json_test.cpp b/tests/json_test/json_test.cpp index 0097084da7..3a32a832ea 100644 --- a/tests/json_test/json_test.cpp +++ b/tests/json_test/json_test.cpp @@ -7893,7 +7893,7 @@ struct NestedPartialRead suite partial_read_tests = [] { using namespace ut; - + static constexpr glz::opts partial_read{.partial_read = true}; "partial read"_test = [] { @@ -7946,7 +7946,8 @@ suite partial_read_tests = [] { Header h{}; std::string buf = R"({"id":"51e2affb","unknown key":"value"})"; - expect(glz::read(h, buf) != glz::error_code::missing_key); + expect(glz::read(h, buf) != + glz::error_code::missing_key); expect(h.id == "51e2affb"); expect(h.type.empty()); }; @@ -7982,7 +7983,8 @@ suite partial_read_tests = [] { HeaderFlipped h{}; std::string buf = R"({"id":"51e2affb","unknown key":"value","type":"message_type","another_field":409845})"; - expect(glz::read(h, buf) == glz::error_code::none); + expect(glz::read(h, buf) == + glz::error_code::none); expect(h.id == "51e2affb"); expect(h.type == "message_type"); }; @@ -7990,7 +7992,7 @@ suite partial_read_tests = [] { suite nested_partial_read_tests = [] { using namespace ut; - + static constexpr glz::opts partial_read{.partial_read = true}; "nested object partial read"_test = [] { @@ -8020,11 +8022,11 @@ suite nested_partial_read_tests = [] { suite nested_array_partial_read_tests = [] { using namespace ut; - + static constexpr glz::opts partial_read{.partial_read = true}; "nested array partial read"_test = [] { - std::vector> v{{0,0}}; + std::vector> v{{0, 0}}; std::string buf = "[[1,2],[3,4],[5,6]]"; expect(not glz::read(v, buf)); @@ -8061,8 +8063,7 @@ struct AccountUpdate inline void AccountUpdate::fromJson(AccountUpdate& accountUpdate, const std::string& jSon) { - auto ec = glz::read( - accountUpdate, jSon); + auto ec = glz::read(accountUpdate, jSon); expect(not ec) << glz::format_error(ec, jSon); } @@ -8093,7 +8094,7 @@ suite account_update_partial_read_tests = [] { AccountUpdate obj{}; AccountUpdate::fromJson(obj, json); - + expect(std::string_view{obj.a.B.at(0).a} == "USDT"); expect(std::string_view{obj.a.B.at(1).a} == "BUSD"); }; @@ -9051,9 +9052,9 @@ suite read_allocated_tests = [] { expect(obj.string == "ha!"); expect(obj.integer == 400); }; - + "nested partial_struct"_test = [] { - std::map obj{{"one", {"ONE",1}}, {"two", {"TWO",2}}}; + std::map obj{{"one", {"ONE", 1}}, {"two", {"TWO", 2}}}; std::string s = R"({"zero":{}, "one":{"skip":null,"integer":400,"string":"ha!","skip again":[1,2,3]}})"; auto ec = glz::read(obj, s); expect(!ec) << glz::format_error(ec, s);