[geos-commits] [SCM] GEOS branch master updated. e84fd01ca1796eaef9f6f814f717e4d405c84293

git at osgeo.org git at osgeo.org
Thu Jan 9 12:51:43 PST 2020


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".

The branch, master has been updated
       via  e84fd01ca1796eaef9f6f814f717e4d405c84293 (commit)
      from  7f2d9695ad8fe58364adf37c35125421c5c6e4b9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e84fd01ca1796eaef9f6f814f717e4d405c84293
Author: Dan Baston <dbaston at gmail.com>
Date:   Thu Jan 9 15:51:17 2020 -0500

    Add test for MakeValid
    
    References https://github.com/libgeos/geos/issues/265

diff --git a/tests/unit/operation/valid/MakeValidTest.cpp b/tests/unit/operation/valid/MakeValidTest.cpp
new file mode 100644
index 0000000..7eeda21
--- /dev/null
+++ b/tests/unit/operation/valid/MakeValidTest.cpp
@@ -0,0 +1,69 @@
+#include <tut/tut.hpp>
+// geos
+#include <geos/constants.h> // for std::isnan
+#include <geos/geom/Coordinate.h>
+#include <geos/geom/CoordinateSequenceFactory.h>
+#include <geos/geom/Polygon.h>
+#include <geos/geom/GeometryFactory.h>
+#include <geos/operation/valid/MakeValid.h>
+// std
+#include <cmath>
+#include <string>
+#include <vector>
+
+using namespace geos::geom;
+using namespace geos::operation::valid;
+
+namespace tut {
+//
+// Test Group
+//
+
+struct test_makevalid_data {
+    test_makevalid_data() {}
+};
+
+typedef test_group<test_makevalid_data> group;
+typedef group::object object;
+
+group test_makevalid_group("geos::operation::valid::MakeValid");
+
+//
+// Test Cases
+//
+
+// https://github.com/libgeos/geos/issues/265
+template<>
+template<>
+void object::test<1>
+()
+{
+    std::vector<Coordinate> v;
+    v.emplace_back(2.22, 2.28);
+    v.emplace_back(7.67, 2.06);
+    v.emplace_back(10.98, 7.70);
+    v.emplace_back(9.39, 5.00);
+    v.emplace_back(7.96, 7.12);
+    v.emplace_back(6.77, 5.16);
+    v.emplace_back(7.43, 6.24);
+    v.emplace_back(3.70, 7.22);
+    v.emplace_back(5.72, 5.77);
+    v.emplace_back(4.18, 10.74);
+    v.emplace_back(2.20, 6.83);
+    v.emplace_back(2.22, 2.28);
+
+    auto gf = GeometryFactory::getDefaultInstance();
+
+    auto cs = gf->getCoordinateSequenceFactory()->create(std::move(v));
+    auto lr = gf->createLinearRing(std::move(cs));
+    auto errplyg = gf->createPolygon(std::move(lr));
+
+    ensure(!errplyg->isValid());
+
+    MakeValid mkvalid;
+    auto validGeom = mkvalid.build(errplyg.get());
+
+    ensure(validGeom->isValid());
+}
+
+} // namespace tut

-----------------------------------------------------------------------

Summary of changes:
 tests/unit/operation/valid/MakeValidTest.cpp | 69 ++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)
 create mode 100644 tests/unit/operation/valid/MakeValidTest.cpp


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list