WZhuo commented on code in PR #1144:
URL: https://github.com/apache/iceberg-cpp/pull/1144#discussion_r4639458930


##########
src/iceberg/test/verification/verification_util.cc:
##########
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "iceberg/test/verification/verification_util.h"
+
+#include <algorithm>
+#include <cctype>
+#include <exception>
+#include <filesystem>
+#include <format>
+#include <fstream>
+#include <utility>
+
+#include "iceberg/test/test_config.h"
+
+namespace iceberg::verification {
+
+namespace {
+
+// Fixture fields read only by the loader and the outcome report.
+constexpr std::string_view kCases = "cases";
+constexpr std::string_view kNormativeLevel = "normative_level";
+
+std::filesystem::path TableSpecDir() {
+  return std::filesystem::path(ICEBERG_VERIFICATION_DIR) / "table-spec";
+}
+
+std::string JoinDiffs(const std::vector<std::string>& diffs) {
+  std::string out;
+  for (const auto& diff : diffs) {
+    out += "\n  ";
+    out += diff;
+  }
+  return out;
+}
+
+}  // namespace
+
+bool FixturesAvailable() { return 
std::filesystem::is_directory(TableSpecDir()); }
+
+std::vector<VerificationCase> LoadCases(std::string_view surface,
+                                        std::span<const std::string_view> 
subdirs) {
+  std::vector<VerificationCase> cases;
+  if (!FixturesAvailable()) {

Review Comment:
   I'd prefer to keep the guard clauses here. Each check bails out for one 
reason, and the happy path stays at one indentation level instead of nesting 
several deep. I did move opening, parsing and checking the file into a 
`ParseFixture` helper, so `LoadCases` now has a single early exit per 
subdirectory.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to