[geos-commits] [SCM] GEOS branch 3.8 updated. 07ad79c5ad48095aa2822668a2bc15085875eb52

git at osgeo.org git at osgeo.org
Mon Mar 9 15:05:28 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, 3.8 has been updated
       via  07ad79c5ad48095aa2822668a2bc15085875eb52 (commit)
       via  c8191df69ac611dbbc9b37d66e0dadbb3afa61c2 (commit)
       via  aa00639ca5dbad4f80724f38272a7b43e45643c1 (commit)
      from  c01c8c1c30091d655ba888790c2daeec1f33bae3 (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 07ad79c5ad48095aa2822668a2bc15085875eb52
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Mon Mar 9 14:44:50 2020 -0700

    rename test to ctest picks it up

diff --git a/tests/unit/index/chain/MonotoneChainBuilder.cpp b/tests/unit/index/chain/MonotoneChainBuilderTest.cpp
similarity index 79%
rename from tests/unit/index/chain/MonotoneChainBuilder.cpp
rename to tests/unit/index/chain/MonotoneChainBuilderTest.cpp
index dcee194..efd5009 100644
--- a/tests/unit/index/chain/MonotoneChainBuilder.cpp
+++ b/tests/unit/index/chain/MonotoneChainBuilderTest.cpp
@@ -14,20 +14,21 @@
 
 namespace tut {
 // dummy data, not used
-struct test_monotonechain_data {
+struct test_monotonechainbuilder_data {
     geos::io::WKTReader wktreader;
     geos::io::WKTWriter wktwriter;
 
-    test_monotonechain_data()
+    test_monotonechainbuilder_data()
         :
-        wktreader()
+        wktreader(),
+        wktwriter()
     {}
 };
 
-typedef test_group<test_monotonechain_data> group;
+typedef test_group<test_monotonechainbuilder_data> group;
 typedef group::object object;
 
-group test_monotonechain_group("geos::index::chain::MonotoneChain");
+group test_monotonechainbuilder_group("geos::index::chain::MonotoneChainBuilder");
 
 //
 // Test Cases
@@ -58,12 +59,10 @@ void object::test<1>
 
     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);
+        ensure_equals("x", cs->getOrdinate(i, 0), x[i], 0.0001);
+        ensure_equals("y", cs->getOrdinate(i, 1), y[i], 0.0001);
     }
 
 }

commit c8191df69ac611dbbc9b37d66e0dadbb3afa61c2
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Mon Mar 9 14:16:27 2020 -0700

    add xml test for #1018 as well

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 aa00639ca5dbad4f80724f38272a7b43e45643c1
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Mon Mar 9 13:43:02 2020 -0700

    add unit test for GH290

diff --git a/tests/unit/index/chain/MonotoneChainBuilder.cpp b/tests/unit/index/chain/MonotoneChainBuilder.cpp
new file mode 100644
index 0000000..dcee194
--- /dev/null
+++ b/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  | 72 ++++++++++++++++++++++
 tests/xmltester/Makefile.am                        |  1 +
 tests/xmltester/tests/issue/issue-geos-1018.xml    | 19 ++++++
 3 files changed, 92 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