use explicit type for std::array

This commit is contained in:
Mathis Logemann 2024-05-18 10:47:51 +02:00
parent 9292899240
commit 21276ab2a0

View file

@ -36,6 +36,8 @@
#include <algorithm> #include <algorithm>
#include <cctype> #include <cctype>
#include <locale> #include <locale>
#include <string_view>
#include <array>
/* /*
@ -151,18 +153,19 @@ TEST_CASE("geojson")
REQUIRE(json == json_out); REQUIRE(json == json_out);
} }
constexpr auto invalid_empty_geometries = constexpr std::array<std::string_view, 6> invalid_empty_geometries{
std::array{"{ \"type\": \"Point\", \"coordinates\": [] }", "{ \"type\": \"Point\", \"coordinates\": [] }",
"{ \"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&& json : invalid_empty_geometries) for (auto&& json : invalid_empty_geometries)
{ {
mapnik::geometry::geometry<double> geom; mapnik::geometry::geometry<double> geom;
CHECK(!mapnik::json::from_geojson(json, geom)); CHECK(!mapnik::json::from_geojson(std::string{json}, geom));
} }
} }