diff --git a/test/unit/datasource/geojson.cpp b/test/unit/datasource/geojson.cpp index 05cd55d03..6d513bd02 100644 --- a/test/unit/datasource/geojson.cpp +++ b/test/unit/datasource/geojson.cpp @@ -29,9 +29,10 @@ #include #include #include +#include #include #include - +#include #include /* @@ -128,10 +129,19 @@ TEST_CASE("geojson") { "{ \"type\": \"MultiPolygon\", \"coordinates\": [[ []] ] }" }; - for (auto const& json : valid_empty_geometries) + for (auto const& in : valid_empty_geometries) { + std::string json(in); mapnik::geometry::geometry geom; CHECK(mapnik::json::from_geojson(json, geom)); + // round trip + std::string json_out; + CHECK(mapnik::util::to_geojson(json_out, geom)); + json.erase(std::remove_if( + std::begin(json), std::end(json), + [l = std::locale{}](auto ch) { return std::isspace(ch, l); } + ), std::end(json)); + REQUIRE(json == json_out); } auto invalid_empty_geometries =