add "invalid" empty geometry tests
This commit is contained in:
parent
7caa0cffd4
commit
60d891f094
1 changed files with 21 additions and 5 deletions
|
@ -121,11 +121,11 @@ TEST_CASE("geojson") {
|
||||||
auto valid_empty_geometries =
|
auto valid_empty_geometries =
|
||||||
{
|
{
|
||||||
"null", // Point can't be empty
|
"null", // Point can't be empty
|
||||||
"{ \"type\": \"LineString\", \"coordinates\": [] }}",
|
"{ \"type\": \"LineString\", \"coordinates\": [] }",
|
||||||
"{ \"type\": \"Polygon\", \"coordinates\": [ [ ] ] } }",
|
"{ \"type\": \"Polygon\", \"coordinates\": [ [ ] ] } ",
|
||||||
"{ \"type\": \"MultiPoint\", \"coordinates\": [ ] }}",
|
"{ \"type\": \"MultiPoint\", \"coordinates\": [ ] }",
|
||||||
"{ \"type\": \"MultiLineString\", \"coordinates\": [ [] ] }}",
|
"{ \"type\": \"MultiLineString\", \"coordinates\": [ [] ] }",
|
||||||
"{ \"type\": \"MultiPolygon\", \"coordinates\": [[ []] ] }}"
|
"{ \"type\": \"MultiPolygon\", \"coordinates\": [[ []] ] }"
|
||||||
};
|
};
|
||||||
|
|
||||||
for (auto const& json : valid_empty_geometries)
|
for (auto const& json : valid_empty_geometries)
|
||||||
|
@ -133,6 +133,22 @@ TEST_CASE("geojson") {
|
||||||
mapnik::geometry::geometry<double> geom;
|
mapnik::geometry::geometry<double> geom;
|
||||||
CHECK(mapnik::json::from_geojson(json, geom));
|
CHECK(mapnik::json::from_geojson(json, geom));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto invalid_empty_geometries =
|
||||||
|
{
|
||||||
|
"{ \"type\": \"Point\", \"coordinates\": [] }",
|
||||||
|
"{ \"type\": \"LineString\", \"coordinates\": [[]] }"
|
||||||
|
"{ \"type\": \"Polygon\", \"coordinates\": [[[]]] }",
|
||||||
|
"{ \"type\": \"MultiPoint\", \"coordinates\": [[]] }",
|
||||||
|
"{ \"type\": \"MultiLineString\", \"coordinates\": [[[]]] }",
|
||||||
|
"{ \"type\": \"MultiPolygon\", \"coordinates\": [[[[]]]] }"
|
||||||
|
};
|
||||||
|
|
||||||
|
for (auto const& json : invalid_empty_geometries)
|
||||||
|
{
|
||||||
|
mapnik::geometry::geometry<double> geom;
|
||||||
|
CHECK(!mapnik::json::from_geojson(json, geom));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("GeoJSON num_features_to_query")
|
SECTION("GeoJSON num_features_to_query")
|
||||||
|
|
Loading…
Reference in a new issue