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

git at osgeo.org git at osgeo.org
Wed Aug 26 11:54:32 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  dd5b572f414f26ef2c35cba9440ad25208952ed9 (commit)
      from  06b310ddf1948ebfe0048cd33b5687f6fa279475 (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 dd5b572f414f26ef2c35cba9440ad25208952ed9
Author: Sandro Santilli <strk at kbt.io>
Date:   Wed Aug 26 20:54:13 2020 +0200

    Add unit test for GEOSDifference and GEOSDifferencePrec CAPI funx

diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am
index 983d8c6..c2f26f8 100644
--- a/tests/unit/Makefile.am
+++ b/tests/unit/Makefile.am
@@ -71,6 +71,8 @@ geos_unit_SOURCES = \
 	capi/GEOSCoordSeqTest.cpp \
 	capi/GEOSCoverageUnionTest.cpp \
 	capi/GEOSDelaunayTriangulationTest.cpp \
+	capi/GEOSDifferenceTest.cpp \
+	capi/GEOSDifferencePrecTest.cpp \
 	capi/GEOSDistanceTest.cpp \
 	capi/GEOSEqualsTest.cpp \
 	capi/GEOSFrechetDistanceTest.cpp \
diff --git a/tests/unit/capi/GEOSDifferencePrecTest.cpp b/tests/unit/capi/GEOSDifferencePrecTest.cpp
new file mode 100644
index 0000000..45e4b82
--- /dev/null
+++ b/tests/unit/capi/GEOSDifferencePrecTest.cpp
@@ -0,0 +1,44 @@
+#include <tut/tut.hpp>
+// geos
+#include <geos_c.h>
+
+#include "capi_test_utils.h"
+
+namespace tut {
+//
+// Test Group
+//
+
+struct test_geosdifferenceprec_data : public capitest::utility {};
+
+typedef test_group<test_geosdifferenceprec_data> group;
+typedef group::object object;
+
+group test_geosdifferenceprec("capi::GEOSDifferencePrec");
+
+template<>
+template<>
+void object::test<1>()
+{
+    GEOSGeometry* a = GEOSGeomFromWKT("LINESTRING (2 8, 10 8)");
+    GEOSGeometry* b = GEOSGeomFromWKT("LINESTRING (3.9 8.1, 6.1 7.9)");
+
+    ensure(a);
+    ensure(b);
+
+    GEOSSetSRID(a, 4326);
+
+    GEOSGeometry* result = GEOSDifferencePrec(a, b, 2);
+
+    ensure(result);
+
+    ensure_geometry_equals(result, "MULTILINESTRING ((6 8, 10 8), (2 8, 4 8))");
+    ensure_equals(GEOSGetSRID(a), GEOSGetSRID(result));
+
+    GEOSGeom_destroy(a);
+    GEOSGeom_destroy(b);
+    GEOSGeom_destroy(result);
+}
+
+} // namespace tut
+
diff --git a/tests/unit/capi/GEOSDifferenceTest.cpp b/tests/unit/capi/GEOSDifferenceTest.cpp
new file mode 100644
index 0000000..b2ff86a
--- /dev/null
+++ b/tests/unit/capi/GEOSDifferenceTest.cpp
@@ -0,0 +1,44 @@
+#include <tut/tut.hpp>
+// geos
+#include <geos_c.h>
+
+#include "capi_test_utils.h"
+
+namespace tut {
+//
+// Test Group
+//
+
+struct test_geosdifference_data : public capitest::utility {};
+
+typedef test_group<test_geosdifference_data> group;
+typedef group::object object;
+
+group test_geosdifference("capi::GEOSDifference");
+
+template<>
+template<>
+void object::test<1>()
+{
+    GEOSGeometry* a = GEOSGeomFromWKT("LINESTRING (2 8, 10 8)");
+    GEOSGeometry* b = GEOSGeomFromWKT("LINESTRING (4 8, 6 8)");
+
+    ensure(a);
+    ensure(b);
+
+    GEOSSetSRID(a, 4326);
+
+    GEOSGeometry* result = GEOSDifference(a, b);
+
+    ensure(result);
+
+    ensure_geometry_equals(result, "MULTILINESTRING ((6 8, 10 8), (2 8, 4 8))");
+    ensure_equals(GEOSGetSRID(a), GEOSGetSRID(result));
+
+    GEOSGeom_destroy(a);
+    GEOSGeom_destroy(b);
+    GEOSGeom_destroy(result);
+}
+
+} // namespace tut
+

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

Summary of changes:
 tests/unit/Makefile.am                     |  2 ++
 tests/unit/capi/GEOSDifferencePrecTest.cpp | 44 ++++++++++++++++++++++++++++++
 tests/unit/capi/GEOSDifferenceTest.cpp     | 44 ++++++++++++++++++++++++++++++
 3 files changed, 90 insertions(+)
 create mode 100644 tests/unit/capi/GEOSDifferencePrecTest.cpp
 create mode 100644 tests/unit/capi/GEOSDifferenceTest.cpp


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list