MCPcopy Create free account
hub / github.com/apache/arrow / TEST

Function TEST

cpp/src/parquet/geospatial/util_json_internal_test.cc:33–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31namespace parquet {
32
33TEST(UtilJsonInternal, InvalidProjJsonIsEscaped) {
34 ::arrow::ExtensionTypeGuard guard(test::geoarrow_wkb());
35
36 auto metadata = ::arrow::key_value_metadata(
37 {"proj"}, {R"({"a":[1,2,]})"}); // Invalid JSON (trailing comma)
38
39 auto logical_type = LogicalType::Geometry("projjson:proj");
40
41 ASSERT_OK_AND_ASSIGN(
42 auto type, GeoArrowTypeFromLogicalType(*logical_type, metadata, ::arrow::binary()));
43
44 auto extension = std::dynamic_pointer_cast<::arrow::ExtensionType>(type);
45 ASSERT_NE(extension, nullptr);
46
47 ASSERT_OK_AND_ASSIGN(auto actual,
48 ::arrow::internal::MinifyJson(extension->Serialize()));
49
50 EXPECT_EQ(actual, "{\"crs\":\"{\\\"a\\\":[1,2,]}\",\"crs_type\":\"projjson\"}");
51}
52
53TEST(UtilJsonInternal, EscapedCrsKeyIsRecognized) {
54 std::string metadata = R"({"cr\u0073":"EPSG:3857","crs_type":"authority_code"})";

Callers

nothing calls this directly

Calls 5

geoarrow_wkbFunction · 0.85
key_value_metadataFunction · 0.85
GeometryClass · 0.85
ToStringMethod · 0.45

Tested by

no test coverage detected