From 6e025956aec6fca9534dd9e3e3655f0f10cecf38 Mon Sep 17 00:00:00 2001 From: artemp Date: Fri, 5 May 2017 16:32:17 +0200 Subject: [PATCH] add simple WKT round-trip test (required updated data) --- test/unit/serialization/wkb_test.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/unit/serialization/wkb_test.cpp b/test/unit/serialization/wkb_test.cpp index 97c292486..c19b8cdca 100644 --- a/test/unit/serialization/wkb_test.cpp +++ b/test/unit/serialization/wkb_test.cpp @@ -16,6 +16,7 @@ #include #include + #if BOOST_VERSION >= 105800 namespace { @@ -84,7 +85,7 @@ bool spatially_equal(mapnik::geometry::geometry const& g0, mapnik::geometry:: TEST_CASE("Well-known-geometries") { - SECTION("wkb") + SECTION("wkb+wkt") { std::string filename("test/unit/data/well-known-geometries.test"); std::ifstream is(filename.c_str(),std::ios_base::in | std::ios_base::binary); @@ -101,12 +102,16 @@ TEST_CASE("Well-known-geometries") mapnik::geometry::geometry geom_0 = mapnik::geometry_utils::from_wkb(wkb.data(), wkb.size(), mapnik::wkbAuto); mapnik::geometry::geometry geom_1 = mapnik::geometry_utils::from_twkb(twkb.data(), twkb.size()); // compare WKTs as doubles - std::string wkt0, wkt1; + std::string wkt, wkt0, wkt1; + wkt = columns[0]; + //wkt.erase(std::remove(wkt.begin(), wkt.end(), ' '), wkt.end()); + // ^ we can't use this approach because spaces are part of format e.g POINT(100 200) REQUIRE(mapnik::util::to_wkt(wkt0, geom_0)); REQUIRE(mapnik::util::to_wkt(wkt1, geom_1)); if (!mapnik::geometry::is_empty(geom_0) && !mapnik::geometry::is_empty(geom_1)) { REQUIRE(wkt0 == wkt1); + REQUIRE(wkt0 == wkt); // WKT round-trip // compare spatially (NOTE: GeometryCollection comparison also enforces strict order) #if BOOST_VERSION >= 105800 REQUIRE(spatially_equal(geom_0, geom_1));