28#include <nlohmann/json.hpp>
30#include "iceberg/json_serde_internal.h"
31#include "iceberg/result.h"
33#include "iceberg/test/test_config.h"
38static std::string GetResourcePath(
const std::string& file_name) {
39 return std::string(ICEBERG_TEST_RESOURCES) +
"/" + file_name;
43static Result<std::unique_ptr<TableMetadata>> ReadTableMetadataFromResource(
44 const std::string& file_name) {
45 std::filesystem::path path{GetResourcePath(file_name)};
46 if (!std::filesystem::exists(path)) {
47 return InvalidArgument(
"File does not exist: {}", path.string());
50 std::ifstream file(path);
51 std::stringstream buffer;
52 buffer << file.rdbuf();
54 return TableMetadataFromJson(nlohmann::json::parse(buffer.str()));