clang-format: re-format for clang-18

clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version.  The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.

See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.

Change-Id: Iceec1dc95b6c908ec6c21fb40093de9dd18bf11a
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/test/http/http2_connection_test.cpp b/test/http/http2_connection_test.cpp
index 0385ed6..de77d7e 100644
--- a/test/http/http2_connection_test.cpp
+++ b/test/http/http2_connection_test.cpp
@@ -68,8 +68,8 @@
         nghttp2_nv nv;
         int inflateFlags = 0;
         const uint8_t* data = std::bit_cast<const uint8_t*>(dataField.data());
-        ssize_t parsed = inflater.hd2(&nv, &inflateFlags, data,
-                                      dataField.size(), 1);
+        ssize_t parsed =
+            inflater.hd2(&nv, &inflateFlags, data, dataField.size(), 1);
 
         ASSERT_GT(parsed, 0);
         dataField.remove_prefix(static_cast<size_t>(parsed));
diff --git a/test/http/http_response_test.cpp b/test/http/http_response_test.cpp
index 3bc0c9c..6aa40ee 100644
--- a/test/http/http_response_test.cpp
+++ b/test/http/http_response_test.cpp
@@ -37,13 +37,13 @@
     boost::beast::http::response_serializer<bmcweb::HttpBody> sr{m};
     sr.split(true);
     // Reads buffers into ret
-    auto reader = [&sr, &ret](const boost::system::error_code& ec2,
-                              const auto& buffer) {
-        EXPECT_FALSE(ec2);
-        std::string ret2 = boost::beast::buffers_to_string(buffer);
-        sr.consume(ret2.size());
-        ret += ret2;
-    };
+    auto reader =
+        [&sr, &ret](const boost::system::error_code& ec2, const auto& buffer) {
+            EXPECT_FALSE(ec2);
+            std::string ret2 = boost::beast::buffers_to_string(buffer);
+            sr.consume(ret2.size());
+            ret += ret2;
+        };
     boost::system::error_code ec;
 
     // Read headers
diff --git a/test/http/mutual_tls.cpp b/test/http/mutual_tls.cpp
index 9d964bf..e354466 100644
--- a/test/http/mutual_tls.cpp
+++ b/test/http/mutual_tls.cpp
@@ -120,8 +120,8 @@
 
     boost::asio::ip::address ip;
     boost::asio::ssl::verify_context ctx(x509Store.get());
-    std::shared_ptr<persistent_data::UserSession> session = verifyMtlsUser(ip,
-                                                                           ctx);
+    std::shared_ptr<persistent_data::UserSession> session =
+        verifyMtlsUser(ip, ctx);
     ASSERT_THAT(session, NotNull());
     EXPECT_THAT(session->username, "user");
 }
@@ -134,8 +134,8 @@
         OSSLX509 x509;
         x509.setSubjectName();
 
-        X509_EXTENSION* ex = X509V3_EXT_conf_nid(nullptr, nullptr,
-                                                 NID_key_usage, usageString);
+        X509_EXTENSION* ex =
+            X509V3_EXT_conf_nid(nullptr, nullptr, NID_key_usage, usageString);
 
         ASSERT_THAT(ex, NotNull());
         ASSERT_EQ(X509_add_ext(x509.get(), ex, -1), 1);
@@ -164,8 +164,8 @@
 
     boost::asio::ip::address ip;
     boost::asio::ssl::verify_context ctx(x509Store.get());
-    std::shared_ptr<persistent_data::UserSession> session = verifyMtlsUser(ip,
-                                                                           ctx);
+    std::shared_ptr<persistent_data::UserSession> session =
+        verifyMtlsUser(ip, ctx);
     ASSERT_THAT(session, IsNull());
 }
 } // namespace
diff --git a/test/http/router_test.cpp b/test/http/router_test.cpp
index 2372541..e0e5b7a 100644
--- a/test/http/router_test.cpp
+++ b/test/http/router_test.cpp
@@ -30,8 +30,8 @@
 TEST(Router, AllowHeader)
 {
     // Callback handler that does nothing
-    auto nullCallback = [](const Request&,
-                           const std::shared_ptr<bmcweb::AsyncResp>&) {};
+    auto nullCallback =
+        [](const Request&, const std::shared_ptr<bmcweb::AsyncResp>&) {};
 
     Router router;
     std::error_code ec;
@@ -65,17 +65,17 @@
 TEST(Router, OverlapingRoutes)
 {
     // Callback handler that does nothing
-    auto fooCallback = [](const Request&,
-                          const std::shared_ptr<bmcweb::AsyncResp>&) {
-        EXPECT_FALSE(true);
-    };
+    auto fooCallback =
+        [](const Request&, const std::shared_ptr<bmcweb::AsyncResp>&) {
+            EXPECT_FALSE(true);
+        };
     bool barCalled = false;
     auto foobarCallback =
         [&barCalled](const Request&, const std::shared_ptr<bmcweb::AsyncResp>&,
                      const std::string& bar) {
-        barCalled = true;
-        EXPECT_EQ(bar, "bar");
-    };
+            barCalled = true;
+            EXPECT_EQ(bar, "bar");
+        };
 
     Router router;
     std::error_code ec;
@@ -105,8 +105,8 @@
     auto nullCallback =
         [&notFoundCalled](const Request&,
                           const std::shared_ptr<bmcweb::AsyncResp>&) {
-        notFoundCalled = true;
-    };
+            notFoundCalled = true;
+        };
 
     Router router;
     std::error_code ec;
@@ -131,13 +131,13 @@
 TEST(Router, 405)
 {
     // Callback handler that does nothing
-    auto nullCallback = [](const Request&,
-                           const std::shared_ptr<bmcweb::AsyncResp>&) {};
+    auto nullCallback =
+        [](const Request&, const std::shared_ptr<bmcweb::AsyncResp>&) {};
     bool called = false;
     auto notAllowedCallback =
         [&called](const Request&, const std::shared_ptr<bmcweb::AsyncResp>&) {
-        called = true;
-    };
+            called = true;
+        };
 
     Router router;
     std::error_code ec;
diff --git a/test/http/server_sent_event_test.cpp b/test/http/server_sent_event_test.cpp
index d8d8836..4d86f56 100644
--- a/test/http/server_sent_event_test.cpp
+++ b/test/http/server_sent_event_test.cpp
@@ -31,10 +31,10 @@
     Request req;
 
     bool openCalled = false;
-    auto openHandler = [&openCalled](Connection&,
-                                     const Request& /*handedReq*/) {
-        openCalled = true;
-    };
+    auto openHandler =
+        [&openCalled](Connection&, const Request& /*handedReq*/) {
+            openCalled = true;
+        };
     bool closeCalled = false;
     auto closeHandler = [&closeCalled](Connection&) { closeCalled = true; };
 
@@ -86,10 +86,11 @@
     // Send second event
     {
         conn->sendEvent("TestEventId2", "TestEvent\nContent2");
-        constexpr std::string_view expected = "id: TestEventId2\n"
-                                              "data: TestEvent\n"
-                                              "data: Content2\n"
-                                              "\n";
+        constexpr std::string_view expected =
+            "id: TestEventId2\n"
+            "data: TestEvent\n"
+            "data: Content2\n"
+            "\n";
 
         while (out.str().size() < expected.size())
         {
diff --git a/test/include/human_sort_test.cpp b/test/include/human_sort_test.cpp
index 78d2d22..741fb3d 100644
--- a/test/include/human_sort_test.cpp
+++ b/test/include/human_sort_test.cpp
@@ -51,8 +51,8 @@
 
 TEST(AlphaNum, LessTest)
 {
-    std::set<std::string, AlphanumLess<std::string>> sorted{"Alpha 10",
-                                                            "Alpha 2"};
+    std::set<std::string, AlphanumLess<std::string>> sorted{
+        "Alpha 10", "Alpha 2"};
     EXPECT_THAT(sorted, ElementsAreArray({"Alpha 2", "Alpha 10"}));
 }
 } // namespace
diff --git a/test/include/json_html_serializer.cpp b/test/include/json_html_serializer.cpp
index 69ac51a..82e21b9 100644
--- a/test/include/json_html_serializer.cpp
+++ b/test/include/json_html_serializer.cpp
@@ -25,9 +25,10 @@
     "<div class=\"container\">\n"
     "<img src=\"/images/DMTF_Redfish_logo_2017.svg\" alt=\"redfish\" height=\"406px\" width=\"576px\">\n";
 
-const std::string boilerplateEnd = "</div>\n"
-                                   "</body>\n"
-                                   "</html>\n";
+const std::string boilerplateEnd =
+    "</div>\n"
+    "</body>\n"
+    "</html>\n";
 
 TEST(JsonHtmlSerializer, dumpHtmlLink)
 {
@@ -57,9 +58,9 @@
     std::string out;
     nlohmann::json j = "foobar";
     dumpHtml(out, j);
-    EXPECT_EQ(out, boilerplateStart +
-                       "<div class=\"content\">\n\"foobar\"</div>\n" +
-                       boilerplateEnd);
+    EXPECT_EQ(out,
+              boilerplateStart + "<div class=\"content\">\n\"foobar\"</div>\n" +
+                  boilerplateEnd);
 }
 } // namespace
 } // namespace json_html_util
diff --git a/test/include/multipart_test.cpp b/test/include/multipart_test.cpp
index 59e8345..9e79dbd 100644
--- a/test/include/multipart_test.cpp
+++ b/test/include/multipart_test.cpp
@@ -265,12 +265,13 @@
 
 TEST_F(MultipartTest, TestGoodMultipartParserMultipleHeaders)
 {
-    std::string_view body = "-----------------------------d74496d66958873e\r\n"
-                            "Content-Disposition: form-data; name=\"Test1\"\r\n"
-                            "Other-Header: value=\"v1\"\r\n"
-                            "\r\n"
-                            "Data1\r\n"
-                            "-----------------------------d74496d66958873e--";
+    std::string_view body =
+        "-----------------------------d74496d66958873e\r\n"
+        "Content-Disposition: form-data; name=\"Test1\"\r\n"
+        "Other-Header: value=\"v1\"\r\n"
+        "\r\n"
+        "Data1\r\n"
+        "-----------------------------d74496d66958873e--";
 
     crow::Request reqIn(body, ec);
 
@@ -293,11 +294,12 @@
 
 TEST_F(MultipartTest, TestErrorHeaderWithoutColon)
 {
-    std::string_view body = "----end\r\n"
-                            "abc\r\n"
-                            "\r\n"
-                            "Data1\r\n"
-                            "----end--\r\n";
+    std::string_view body =
+        "----end\r\n"
+        "abc\r\n"
+        "\r\n"
+        "Data1\r\n"
+        "----end--\r\n";
     crow::Request reqIn(body, ec);
 
     reqIn.addHeader("Content-Type", "multipart/form-data; "
@@ -353,10 +355,11 @@
 
 TEST_F(MultipartTest, TestDataWithoutMimeFields)
 {
-    std::string_view body = "-----------------------------d74496d66958873e\r\n"
-                            "\r\n"
-                            "Data1\r\n"
-                            "-----------------------------d74496d66958873e--";
+    std::string_view body =
+        "-----------------------------d74496d66958873e\r\n"
+        "\r\n"
+        "Data1\r\n"
+        "-----------------------------d74496d66958873e--";
 
     crow::Request reqIn(body, ec);
 
@@ -445,9 +448,10 @@
 
     EXPECT_EQ(parser.mime_fields[0].fields.at("Content-Disposition"),
               "form-data; name=\"Test1\"");
-    EXPECT_EQ(parser.mime_fields[0].content, "Data1\r\n"
-                                             "----XX-abc-\r\n"
-                                             "StillData1");
+    EXPECT_EQ(parser.mime_fields[0].content,
+              "Data1\r\n"
+              "----XX-abc-\r\n"
+              "StillData1");
 }
 
 } // namespace
diff --git a/test/redfish-core/include/privileges_test.cpp b/test/redfish-core/include/privileges_test.cpp
index 59a8ccd..fe098ed 100644
--- a/test/redfish-core/include/privileges_test.cpp
+++ b/test/redfish-core/include/privileges_test.cpp
@@ -60,8 +60,8 @@
 
 TEST(PrivilegeTest, PrivilegeCheckForANDCaseSuccess)
 {
-    auto userPrivileges = Privileges{"Login", "ConfigureManager",
-                                     "ConfigureSelf"};
+    auto userPrivileges =
+        Privileges{"Login", "ConfigureManager", "ConfigureSelf"};
     OperationMap entityPrivileges{
         {boost::beast::http::verb::get,
          {{"Login", "ConfigureManager", "ConfigureSelf"}}}};
diff --git a/test/redfish-core/include/redfish_aggregator_test.cpp b/test/redfish-core/include/redfish_aggregator_test.cpp
index fe80964..b834587 100644
--- a/test/redfish-core/include/redfish_aggregator_test.cpp
+++ b/test/redfish-core/include/redfish_aggregator_test.cpp
@@ -55,28 +55,30 @@
 TEST(addPrefixToItem, ValidURIs)
 {
     nlohmann::json jsonRequest;
-    constexpr std::array validRoots{"Cables",
-                                    "Chassis",
-                                    "Fabrics",
-                                    "PowerEquipment/FloorPDUs",
-                                    "Systems",
-                                    "TaskService/Tasks",
-                                    "TaskService/TaskMonitors",
-                                    "TelemetryService/LogService/Entries",
-                                    "UpdateService/SoftwareInventory"};
+    constexpr std::array validRoots{
+        "Cables",
+        "Chassis",
+        "Fabrics",
+        "PowerEquipment/FloorPDUs",
+        "Systems",
+        "TaskService/Tasks",
+        "TaskService/TaskMonitors",
+        "TelemetryService/LogService/Entries",
+        "UpdateService/SoftwareInventory"};
 
     // We're only testing prefix fixing so it's alright that some of the
     // resulting URIs will not actually be possible as defined by the schema
-    constexpr std::array validIDs{"1",
-                                  "1/",
-                                  "Test",
-                                  "Test/",
-                                  "Extra_Test",
-                                  "Extra_Test/",
-                                  "Extra_Test/Sensors",
-                                  "Extra_Test/Sensors/",
-                                  "Extra_Test/Sensors/power_sensor",
-                                  "Extra_Test/Sensors/power_sensor/"};
+    constexpr std::array validIDs{
+        "1",
+        "1/",
+        "Test",
+        "Test/",
+        "Extra_Test",
+        "Extra_Test/",
+        "Extra_Test/Sensors",
+        "Extra_Test/Sensors/",
+        "Extra_Test/Sensors/power_sensor",
+        "Extra_Test/Sensors/power_sensor/"};
 
     // Construct URIs which should have prefix fixing applied
     for (const auto& root : validRoots)
@@ -101,16 +103,17 @@
         "PowerEquipment",           "TaskService",
         "TelemetryService/Entries", "UpdateService"};
 
-    constexpr std::array validIDs{"1",
-                                  "1/",
-                                  "Test",
-                                  "Test/",
-                                  "Extra_Test",
-                                  "Extra_Test/",
-                                  "Extra_Test/Sensors",
-                                  "Extra_Test/Sensors/",
-                                  "Extra_Test/Sensors/power_sensor",
-                                  "Extra_Test/Sensors/power_sensor/"};
+    constexpr std::array validIDs{
+        "1",
+        "1/",
+        "Test",
+        "Test/",
+        "Extra_Test",
+        "Extra_Test/",
+        "Extra_Test/Sensors",
+        "Extra_Test/Sensors/",
+        "Extra_Test/Sensors/power_sensor",
+        "Extra_Test/Sensors/power_sensor/"};
 
     // Construct URIs which should NOT have prefix fixing applied
     for (const auto& root : invalidRoots)
@@ -129,16 +132,17 @@
 TEST(addPrefixToItem, TopLevelCollections)
 {
     nlohmann::json jsonRequest;
-    constexpr std::array validRoots{"Cables",
-                                    "Chassis/",
-                                    "Fabrics",
-                                    "JsonSchemas",
-                                    "PowerEquipment/FloorPDUs",
-                                    "Systems",
-                                    "TaskService/Tasks",
-                                    "TelemetryService/LogService/Entries",
-                                    "TelemetryService/LogService/Entries/",
-                                    "UpdateService/SoftwareInventory/"};
+    constexpr std::array validRoots{
+        "Cables",
+        "Chassis/",
+        "Fabrics",
+        "JsonSchemas",
+        "PowerEquipment/FloorPDUs",
+        "Systems",
+        "TaskService/Tasks",
+        "TelemetryService/LogService/Entries",
+        "TelemetryService/LogService/Entries/",
+        "UpdateService/SoftwareInventory/"};
 
     // Construct URIs for top level collections.  Prefixes should NOT be
     // applied to any of the URIs
@@ -691,8 +695,8 @@
     asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1";
     asyncResp->res.jsonValue["Chassis"]["@odata.id"] = "/redfish/v1/Chassis";
 
-    RedfishAggregator::processContainsSubordinateResponse("prefix", asyncResp,
-                                                          resp);
+    RedfishAggregator::processContainsSubordinateResponse(
+        "prefix", asyncResp, resp);
     EXPECT_EQ(asyncResp->res.jsonValue["Chassis"]["@odata.id"],
               "/redfish/v1/Chassis");
     EXPECT_EQ(asyncResp->res.jsonValue["Fabrics"]["@odata.id"],
@@ -729,8 +733,8 @@
     resp.write(
         jsonValue.dump(2, ' ', true, nlohmann::json::error_handler_t::replace));
 
-    RedfishAggregator::processContainsSubordinateResponse("prefix", asyncResp,
-                                                          resp);
+    RedfishAggregator::processContainsSubordinateResponse(
+        "prefix", asyncResp, resp);
 
     // Most of the response should get copied over since asyncResp is a 404
     EXPECT_EQ(asyncResp->res.resultInt(), 200);
@@ -756,8 +760,8 @@
     asyncResp->res.jsonValue["Fake"]["@odata.id"] = "/redfish/v1/Fake";
     messages::internalError(asyncResp->res);
 
-    RedfishAggregator::processContainsSubordinateResponse("prefix", asyncResp,
-                                                          resp);
+    RedfishAggregator::processContainsSubordinateResponse(
+        "prefix", asyncResp, resp);
 
     // These should also be copied over since asyncResp is a 500
     EXPECT_EQ(asyncResp->res.resultInt(), 200);
@@ -797,8 +801,8 @@
     resp.write(
         jsonValue.dump(2, ' ', true, nlohmann::json::error_handler_t::replace));
 
-    RedfishAggregator::processContainsSubordinateResponse("prefix", asyncResp,
-                                                          resp);
+    RedfishAggregator::processContainsSubordinateResponse(
+        "prefix", asyncResp, resp);
 
     // We won't add any links from response so asyncResp shouldn't change
     EXPECT_EQ(asyncResp->res.resultInt(), 500);
@@ -816,8 +820,8 @@
     resp.write(
         jsonValue.dump(2, ' ', true, nlohmann::json::error_handler_t::replace));
 
-    RedfishAggregator::processContainsSubordinateResponse("prefix", asyncResp,
-                                                          resp);
+    RedfishAggregator::processContainsSubordinateResponse(
+        "prefix", asyncResp, resp);
 
     EXPECT_EQ(asyncResp->res.resultInt(), 200);
     EXPECT_EQ(asyncResp->res.jsonValue["Chassis"]["@odata.id"],
diff --git a/test/redfish-core/lib/service_root_test.cpp b/test/redfish-core/lib/service_root_test.cpp
index 57583dd..0038096 100644
--- a/test/redfish-core/lib/service_root_test.cpp
+++ b/test/redfish-core/lib/service_root_test.cpp
@@ -74,10 +74,10 @@
               "/redfish/v1/TelemetryService");
     EXPECT_EQ(json["TelemetryService"].size(), 1);
 
-    EXPECT_THAT(
-        json["UUID"],
-        testing::MatchesRegex("[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-"
-                              "9a-fA-F]{4}-[0-9a-fA-F]{12}"));
+    EXPECT_THAT(json["UUID"],
+                testing::MatchesRegex(
+                    "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-"
+                    "9a-fA-F]{4}-[0-9a-fA-F]{12}"));
 
     EXPECT_EQ(json["UpdateService"]["@odata.id"], "/redfish/v1/UpdateService");