Skip to content

Commit

Permalink
use explicit type for std::array
Browse files Browse the repository at this point in the history
  • Loading branch information
mathisloge committed May 18, 2024
1 parent 9292899 commit 21276ab
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions test/unit/datasource/geojson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#include <algorithm>
#include <cctype>
#include <locale>
#include <string_view>
#include <array>

/*
Expand Down Expand Up @@ -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));
}
}

Expand Down

0 comments on commit 21276ab

Please sign in to comment.