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

git at osgeo.org git at osgeo.org
Mon Mar 9 15:04:47 PDT 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  ec1419c821f3a2f2b92ab7de232f7e2ace3bdb06 (commit)
       via  33971c09a5b58b25853e76ff96932ece5cc3a0ff (commit)
      from  ba24e3e294f39414bdb0290d07f673443bfe4b37 (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 ec1419c821f3a2f2b92ab7de232f7e2ace3bdb06
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Mon Mar 9 14:48:47 2020 -0700

    reorder tests for #1018

diff --git a/tests/unit/index/tests/unit/index/chain/MonotoneChainBuilder.cpp b/tests/unit/index/chain/MonotoneChainBuilderTest.cpp
similarity index 99%
rename from tests/unit/index/tests/unit/index/chain/MonotoneChainBuilder.cpp
rename to tests/unit/index/chain/MonotoneChainBuilderTest.cpp
index dcee194..08e5015 100644
--- a/tests/unit/index/tests/unit/index/chain/MonotoneChainBuilder.cpp
+++ b/tests/unit/index/chain/MonotoneChainBuilderTest.cpp
@@ -27,7 +27,7 @@ struct test_monotonechain_data {
 typedef test_group<test_monotonechain_data> group;
 typedef group::object object;
 
-group test_monotonechain_group("geos::index::chain::MonotoneChain");
+group test_monotonechain_group("geos::index::chain::MonotoneChainBuilder");
 
 //
 // Test Cases
diff --git a/tests/xmltester/Makefile.am b/tests/xmltester/Makefile.am
index 469a424..b20dafe 100644
--- a/tests/xmltester/Makefile.am
+++ b/tests/xmltester/Makefile.am
@@ -109,6 +109,7 @@ SAFE_XMLTESTS= \
 	$(srcdir)/tests/issue/issue-geos-838.xml \
 	$(srcdir)/tests/issue/issue-geos-990.xml \
 	$(srcdir)/tests/issue/issue-geos-994.xml \
+	$(srcdir)/tests/issue/issue-geos-1018.xml \
 	$(srcdir)/tests/validate/TestRelateAA-big.xml \
 	$(srcdir)/tests/validate/TestRelateAA.xml \
 	$(srcdir)/tests/validate/TestRelateAC.xml \
diff --git a/tests/xmltester/tests/issue/issue-geos-1018.xml b/tests/xmltester/tests/issue/issue-geos-1018.xml
new file mode 100644
index 0000000..9dc5c03
--- /dev/null
+++ b/tests/xmltester/tests/issue/issue-geos-1018.xml
@@ -0,0 +1,19 @@
+<run>
+<precisionModel type="FLOATING" />
+<case>
+<desc>
+Difference of two geometries
+</desc>
+<a>
+POLYGON((0.1 0.1, 4.0 0.1, 4.0 1.9, 0.1 1.9, 0.1 0.1))
+</a>
+<b>
+POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))
+</b>
+<test>
+<op name="difference" arg1="a" arg2="b">
+POLYGON ((2.0 1.9, 4.0 1.9, 4.0 0.1, 2.0 0.1, 2.0 1.9))
+</op>
+</test>
+</case>
+</run>

commit 33971c09a5b58b25853e76ff96932ece5cc3a0ff
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Mon Mar 9 13:45:23 2020 -0700

    add unit test for GH290

diff --git a/tests/unit/index/tests/unit/index/chain/MonotoneChainBuilder.cpp b/tests/unit/index/tests/unit/index/chain/MonotoneChainBuilder.cpp
new file mode 100644
index 0000000..dcee194
--- /dev/null
+++ b/tests/unit/index/tests/unit/index/chain/MonotoneChainBuilder.cpp
@@ -0,0 +1,73 @@
+//
+// Test Suite for geos::index::chain::MonotoneChainBuilder class.
+
+#include <tut/tut.hpp>
+// geos
+#include <geos/io/WKTReader.h>
+#include <geos/io/WKTWriter.h>
+#include <geos/geom/PrecisionModel.h>
+#include <geos/geom/GeometryFactory.h>
+#include <geos/geom/Geometry.h>
+#include <geos/geom/Point.h>
+#include <geos/geom/LineString.h>
+#include <geos/util.h>
+
+namespace tut {
+// dummy data, not used
+struct test_monotonechain_data {
+    geos::io::WKTReader wktreader;
+    geos::io::WKTWriter wktwriter;
+
+    test_monotonechain_data()
+        :
+        wktreader()
+    {}
+};
+
+typedef test_group<test_monotonechain_data> group;
+typedef group::object object;
+
+group test_monotonechain_group("geos::index::chain::MonotoneChain");
+
+//
+// Test Cases
+
+
+// This issue exercised a bug in MonotoneChainBuilder
+// https://github.com/libgeos/geos/issues/290
+template<>
+template<>
+void object::test<1>
+()
+{
+    std::string wkt1("POLYGON((0 0, 0 2, 2 2, 2 0, 0 0))");
+    std::unique_ptr<geos::geom::Geometry> g1(wktreader.read(wkt1));
+
+    std::string wkt2("POLYGON((0.1 0.1, 4.0 0.1, 4.0 1.9, 0.1 1.9, 0.1 0.1))");
+    std::unique_ptr<geos::geom::Geometry> g2(wktreader.read(wkt2));
+
+    // POLYGON ((2.0 1.9, 4.0 1.9, 4.0 0.1, 2.0 0.1, 2.0 1.9))
+    double x[5] = {2.0, 4.0, 4.0, 2.0, 2.0};
+    double y[5] = {1.9, 1.9, 0.1, 0.1, 1.9};
+
+    auto g3 = g2->difference(g1.get());
+    auto cs = g3->getCoordinates();
+
+    // std::string wkt3 = wktwriter.write(g3.get());
+    // std::cout << wkt3 << std::endl;
+
+    for (int i = 0; i < 5; ++i)
+    {
+        auto csx = cs->getOrdinate(i, 0);
+        auto csy = cs->getOrdinate(i, 1);
+        // std::cout << csx << ", " << csy << std::endl;
+        // std::cout << x[i] << ", " << y[i] << std::endl;
+        ensure_equals("x", csx, x[i], 0.01);
+        ensure_equals("y", csy, y[i], 0.01);
+    }
+
+}
+
+
+} // namespace tut
+

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

Summary of changes:
 .../unit/index/chain/MonotoneChainBuilderTest.cpp  | 73 ++++++++++++++++++++++
 tests/xmltester/Makefile.am                        |  1 +
 tests/xmltester/tests/issue/issue-geos-1018.xml    | 19 ++++++
 3 files changed, 93 insertions(+)
 create mode 100644 tests/unit/index/chain/MonotoneChainBuilderTest.cpp
 create mode 100644 tests/xmltester/tests/issue/issue-geos-1018.xml


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list