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