[geos-commits] [SCM] GEOS branch main updated. fb6d9ea20003e8db38ed5f6cac53bab18f333c9f

git at osgeo.org git at osgeo.org
Wed Oct 20 17:40:11 PDT 2021


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, main has been updated
       via  fb6d9ea20003e8db38ed5f6cac53bab18f333c9f (commit)
       via  749275f2386888de52df0f891fcce3c42b4cbf86 (commit)
       via  9dfae829966440bc3de0495cd8a1426160f9d6d8 (commit)
       via  262e44358d5cbecbf6a0f6e6a8a8402158f66970 (commit)
       via  e1ed9fb157defef103b7197ca4007c07c1fb600d (commit)
       via  86b978385f9f058dced7ae08dce79398df9b389c (commit)
       via  3b378da3b5b68b7760ea99aa864223014e53b912 (commit)
       via  c7f9253b7721cacff70cb7214753c1f6778f5053 (commit)
       via  26539025fc22283db2df10c9b68d7f02be23569f (commit)
       via  26463fa382f5c2db7a09e4ed088c3f6963580720 (commit)
      from  2255c7414d037122ac3b2d72f7035fa2f90a5467 (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 fb6d9ea20003e8db38ed5f6cac53bab18f333c9f
Merge: 2255c7414 749275f23
Author: Daniel Baston <dbaston at gmail.com>
Date:   Wed Oct 20 20:32:44 2021 -0400

    Merge remote-tracking branch 'jericks/codecov' into main
    
    References https://github.com/libgeos/geos/issues/396


commit 749275f2386888de52df0f891fcce3c42b4cbf86
Author: Jared Erickson <jared.erickson at gmail.com>
Date:   Mon Apr 19 14:54:59 2021 -0700

    Add capi tests for getexeriorring, getgeometryn, and getinteriorringn

diff --git a/tests/unit/capi/GEOSGetExteriorRingTest.cpp b/tests/unit/capi/GEOSGetExteriorRingTest.cpp
new file mode 100644
index 000000000..b7abd61e7
--- /dev/null
+++ b/tests/unit/capi/GEOSGetExteriorRingTest.cpp
@@ -0,0 +1,34 @@
+#include <tut/tut.hpp>
+// geos
+#include <geos_c.h>
+
+#include "capi_test_utils.h"
+
+namespace tut
+{
+    //
+    // Test Group
+    //
+
+    struct test_geosgetexteriorring_data : public capitest::utility
+    {
+    };
+
+    typedef test_group<test_geosgetexteriorring_data> group;
+    typedef group::object object;
+
+    group test_geosgetexteriorring("capi::GEOSGetExteriorRing");
+
+    template <>
+    template <>
+    void object::test<1>()
+    {
+        geom1_ = fromWKT("POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10),(20 30, 35 35, 30 20, 20 30))");
+        ensure(nullptr != geom1_);
+
+        GEOSGeometry *result = const_cast<GEOSGeometry *>(GEOSGetExteriorRing(geom1_));
+        ensure(nullptr != result);
+        ensure_equals("LINEARRING (35 10, 45 45, 15 40, 10 20, 35 10)", toWKT(result));
+    }
+
+} // namespace tut
diff --git a/tests/unit/capi/GEOSGetGeometryNTest.cpp b/tests/unit/capi/GEOSGetGeometryNTest.cpp
new file mode 100644
index 000000000..987d7ed9f
--- /dev/null
+++ b/tests/unit/capi/GEOSGetGeometryNTest.cpp
@@ -0,0 +1,36 @@
+#include <tut/tut.hpp>
+// geos
+#include <geos_c.h>
+
+#include "capi_test_utils.h"
+
+namespace tut {
+//
+// Test Group
+//
+
+struct test_geosgetgeometryn_data : public capitest::utility {};
+
+typedef test_group<test_geosgetgeometryn_data> group;
+typedef group::object object;
+
+group test_geosgetgeometryn("capi::GEOSGetGeometryN");
+
+template<>
+template<>
+void object::test<1>()
+{
+    geom1_ = fromWKT("MULTIPOINT (1 1, 2 2, 3 3)");
+    ensure(nullptr != geom1_);
+
+    GEOSGeometry* result = const_cast<GEOSGeometry*>(GEOSGetGeometryN(geom1_, 0));
+    ensure(nullptr != result);
+    ensure_equals("POINT (1 1)", toWKT(result));
+    
+    result = const_cast<GEOSGeometry*>(GEOSGetGeometryN(geom1_, 2));
+    ensure(nullptr != result);
+    ensure_equals("POINT (3 3)", toWKT(result));
+}
+
+} // namespace tut
+
diff --git a/tests/unit/capi/GEOSGetInteriorRingNTest.cpp b/tests/unit/capi/GEOSGetInteriorRingNTest.cpp
new file mode 100644
index 000000000..bb885efd3
--- /dev/null
+++ b/tests/unit/capi/GEOSGetInteriorRingNTest.cpp
@@ -0,0 +1,34 @@
+#include <tut/tut.hpp>
+// geos
+#include <geos_c.h>
+
+#include "capi_test_utils.h"
+
+namespace tut
+{
+    //
+    // Test Group
+    //
+
+    struct test_geosgetinteriorringn_data : public capitest::utility
+    {
+    };
+
+    typedef test_group<test_geosgetinteriorringn_data> group;
+    typedef group::object object;
+
+    group test_geosgetinteriorring("capi::GEOSGetInteriorRingN");
+
+    template <>
+    template <>
+    void object::test<1>()
+    {
+        geom1_ = fromWKT("POLYGON ((35 10, 45 45, 15 40, 10 20, 35 10),(20 30, 35 35, 30 20, 20 30))");
+        ensure(nullptr != geom1_);
+
+        GEOSGeometry *result = const_cast<GEOSGeometry *>(GEOSGetInteriorRingN(geom1_, 0));
+        ensure(nullptr != result);
+        ensure_equals("LINEARRING (20 30, 35 35, 30 20, 20 30)", toWKT(result));
+    }
+
+} // namespace tut

commit 9dfae829966440bc3de0495cd8a1426160f9d6d8
Author: Jared Erickson <jared.erickson at gmail.com>
Date:   Sun Apr 11 14:43:11 2021 -0700

    Add c api tests for unaryunionprec and unioncascaded

diff --git a/tests/unit/capi/GEOSUnaryUnionPrecTest.cpp b/tests/unit/capi/GEOSUnaryUnionPrecTest.cpp
new file mode 100644
index 000000000..355b588d1
--- /dev/null
+++ b/tests/unit/capi/GEOSUnaryUnionPrecTest.cpp
@@ -0,0 +1,56 @@
+//
+// Test Suite for C-API GEOSUnaryUnion
+
+#include <tut/tut.hpp>
+// geos
+#include <geos_c.h>
+// std
+#include <cstdarg>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+
+#include "capi_test_utils.h"
+
+namespace tut {
+//
+// Test Group
+//
+
+// Common data used in test cases.
+struct test_capiunaryunionprec_data : public capitest::utility {
+
+    test_capiunaryunionprec_data() {
+        GEOSWKTWriter_setTrim(wktw_, 1);
+        GEOSWKTWriter_setOutputDimension(wktw_, 3);
+    }
+
+};
+
+typedef test_group<test_capiunaryunionprec_data> group;
+typedef group::object object;
+
+group test_capiunaryunionprec_group("capi::GEOSUnaryUnionPrec");
+
+//
+// Test Cases
+//
+
+
+// Self-union an empty point
+template<>
+template<>
+void object::test<1>
+()
+{
+    geom1_ = GEOSGeomFromWKT("MULTIPOINT (4 5, 6 7, 4 5, 6 5, 6 7)");
+    ensure(nullptr != geom1_);
+
+    geom2_ = GEOSUnaryUnionPrec(geom1_, 2);
+    ensure(nullptr != geom2_);
+
+    ensure_equals(toWKT(geom2_), std::string("MULTIPOINT (4 6, 6 6, 6 8)"));
+}
+
+
+} // namespace tut
\ No newline at end of file
diff --git a/tests/unit/capi/GEOSUnionCascadedTest.cpp b/tests/unit/capi/GEOSUnionCascadedTest.cpp
new file mode 100644
index 000000000..b48522347
--- /dev/null
+++ b/tests/unit/capi/GEOSUnionCascadedTest.cpp
@@ -0,0 +1,35 @@
+#include <tut/tut.hpp>
+// geos
+#include <geos_c.h>
+
+#include "capi_test_utils.h"
+
+namespace tut {
+//
+// Test Group
+//
+
+struct test_geosunioncascaded_data : public capitest::utility {};
+
+typedef test_group<test_geosunioncascaded_data> group;
+typedef group::object object;
+
+group test_geosunioncascaded("capi::GEOSUnionCascaded");
+
+template<>
+template<>
+void object::test<1>()
+{
+    geom1_ = GEOSGeomFromWKT("POINT (2 8)");
+    ensure(nullptr != geom1_);
+    geom2_ = GEOSGeomFromWKT("POINT (3 9)");
+    ensure(nullptr != geom2_);
+
+    geom3_ = GEOSUnion(geom1_, geom2_);
+    ensure(nullptr != geom3_);
+
+     ensure_equals("MULTIPOINT (2 8, 3 9)", toWKT(geom3_));
+}
+
+} // namespace tut
+

commit 262e44358d5cbecbf6a0f6e6a8a8402158f66970
Author: Jared Erickson <jared.erickson at gmail.com>
Date:   Wed Apr 7 20:40:24 2021 -0700

    Add capi tests for sym difference

diff --git a/tests/unit/capi/GEOSSymDifferencePrecTest.cpp b/tests/unit/capi/GEOSSymDifferencePrecTest.cpp
new file mode 100644
index 000000000..40097601d
--- /dev/null
+++ b/tests/unit/capi/GEOSSymDifferencePrecTest.cpp
@@ -0,0 +1,33 @@
+#include <tut/tut.hpp>
+// geos
+#include <geos_c.h>
+
+#include "capi_test_utils.h"
+
+namespace tut {
+//
+// Test Group
+//
+
+struct test_geossymdifferenceprec_data : public capitest::utility {};
+
+typedef test_group<test_geossymdifferenceprec_data> group;
+typedef group::object object;
+
+group test_geossymdifferenceprec("capi::GEOSSymDifferencePrec");
+
+template<>
+template<>
+void object::test<1>()
+{
+    geom1_ = fromWKT("LINESTRING(50 100, 50 200)");
+    ensure(geom1_);
+    geom2_ = fromWKT("LINESTRING(50 50, 50 150)");
+    ensure(geom2_);
+    geom3_ = GEOSSymDifferencePrec(geom1_, geom2_, 15);
+
+    ensure_equals("MULTILINESTRING ((45 150, 45 195), (45 45, 45 105))", toWKT(geom3_));
+}
+
+} // namespace tut
+
diff --git a/tests/unit/capi/GEOSSymDifferenceTest.cpp b/tests/unit/capi/GEOSSymDifferenceTest.cpp
new file mode 100644
index 000000000..34d2c0794
--- /dev/null
+++ b/tests/unit/capi/GEOSSymDifferenceTest.cpp
@@ -0,0 +1,33 @@
+#include <tut/tut.hpp>
+// geos
+#include <geos_c.h>
+
+#include "capi_test_utils.h"
+
+namespace tut {
+//
+// Test Group
+//
+
+struct test_geossymdifference_data : public capitest::utility {};
+
+typedef test_group<test_geossymdifference_data> group;
+typedef group::object object;
+
+group test_geossymdifference("capi::GEOSSymDifference");
+
+template<>
+template<>
+void object::test<1>()
+{
+    geom1_ = fromWKT("LINESTRING(50 100, 50 200)");
+    ensure(geom1_);
+    geom2_ = fromWKT("LINESTRING(50 50, 50 150)");
+    ensure(geom2_);
+    geom3_ = GEOSSymDifference(geom1_, geom2_);
+
+    ensure_equals("MULTILINESTRING ((50 150, 50 200), (50 50, 50 100))", toWKT(geom3_));
+}
+
+} // namespace tut
+

commit e1ed9fb157defef103b7197ca4007c07c1fb600d
Author: Jared Erickson <jared.erickson at gmail.com>
Date:   Mon Apr 5 20:04:31 2021 -0700

    Add capi tests for to hex, wkb buf and typeid

diff --git a/tests/unit/capi/GEOSGeomToHEX_bufTest.cpp b/tests/unit/capi/GEOSGeomToHEX_bufTest.cpp
new file mode 100644
index 000000000..2f88f38a2
--- /dev/null
+++ b/tests/unit/capi/GEOSGeomToHEX_bufTest.cpp
@@ -0,0 +1,36 @@
+#include <tut/tut.hpp>
+// geos
+#include <geos_c.h>
+
+#include "capi_test_utils.h"
+
+namespace tut {
+//
+// Test Group
+//
+
+struct test_geosgeomtohex_buf_data : public capitest::utility {};
+
+typedef test_group<test_geosgeomtohex_buf_data> group;
+typedef group::object object;
+
+group test_geosgeomtohex_buf("capi::GEOSGeomToHEX_buf");
+
+template<>
+template<>
+void object::test<1>()
+{
+    
+    geom1_ = fromWKT("POINT (1 2)");
+    ensure(nullptr != geom1_);
+
+    std::size_t size{};
+    unsigned char* hex = GEOSGeomToHEX_buf(geom1_, &size);
+    std::string hexStr(reinterpret_cast<char*>(hex));
+    ensure_equals(std::string{"0101000000000000000000F03F0000000000000040"}, hexStr);
+
+    free(hex);
+}
+
+} // namespace tut
+
diff --git a/tests/unit/capi/GEOSGeomToWKB_bufTest.cpp b/tests/unit/capi/GEOSGeomToWKB_bufTest.cpp
new file mode 100644
index 000000000..e7ce0f95c
--- /dev/null
+++ b/tests/unit/capi/GEOSGeomToWKB_bufTest.cpp
@@ -0,0 +1,38 @@
+#include <tut/tut.hpp>
+// geos
+#include <geos_c.h>
+
+#include "capi_test_utils.h"
+
+namespace tut {
+//
+// Test Group
+//
+
+struct test_geosgeomtowkb_buf_data : public capitest::utility {};
+
+typedef test_group<test_geosgeomtowkb_buf_data> group;
+typedef group::object object;
+
+group test_geosgeomtowkb_buf("capi::GEOSGeomToWKB_buf");
+
+template<>
+template<>
+void object::test<1>()
+{
+    
+    geom1_ = fromWKT("POINT (1 2)");
+    ensure(nullptr != geom1_);
+
+    std::size_t size{};
+    unsigned char* wkb = GEOSGeomToWKB_buf(geom1_, &size);
+    geom2_ = GEOSGeomFromWKB_buf(&wkb[0], size);
+    ensure(nullptr != geom2_);
+    
+    ensure_equals(toWKT(geom1_), toWKT(geom2_));
+
+    free(wkb);
+}
+
+} // namespace tut
+
diff --git a/tests/unit/capi/GEOSGeomTypeIdTest.cpp b/tests/unit/capi/GEOSGeomTypeIdTest.cpp
new file mode 100644
index 000000000..65eed116a
--- /dev/null
+++ b/tests/unit/capi/GEOSGeomTypeIdTest.cpp
@@ -0,0 +1,33 @@
+#include <tut/tut.hpp>
+// geos
+#include <geos_c.h>
+
+#include "capi_test_utils.h"
+
+namespace tut {
+//
+// Test Group
+//
+
+struct test_geosgeomtypeid_data : public capitest::utility {};
+
+typedef test_group<test_geosgeomtypeid_data> group;
+typedef group::object object;
+
+group test_geosgeomtypeid("capi::GEOSGeomTypeId");
+
+template<>
+template<>
+void object::test<1>()
+{
+    geom1_ = fromWKT("POINT (1 2)");
+    ensure(nullptr != geom1_);
+    geom2_ = fromWKT("LINESTRING (1 2, 3 4)");
+    ensure(nullptr != geom2_);
+
+    ensure_equals(0, GEOSGeomTypeId(geom1_));
+    ensure_equals(1, GEOSGeomTypeId(geom2_));
+}
+
+} // namespace tut
+

commit 86b978385f9f058dced7ae08dce79398df9b389c
Author: Jared Erickson <jared.erickson at gmail.com>
Date:   Sat Apr 3 10:18:57 2021 -0700

    Add capi unit tests for RelatePattern and Relate

diff --git a/tests/unit/capi/GEOSRelatePatternTest.cpp b/tests/unit/capi/GEOSRelatePatternTest.cpp
new file mode 100644
index 000000000..ef8e24f6e
--- /dev/null
+++ b/tests/unit/capi/GEOSRelatePatternTest.cpp
@@ -0,0 +1,35 @@
+#include <tut/tut.hpp>
+// geos
+#include <geos_c.h>
+
+#include "capi_test_utils.h"
+
+namespace tut {
+//
+// Test Group
+//
+
+struct test_geosrelatepattern_data : public capitest::utility {};
+
+typedef test_group<test_geosrelatepattern_data> group;
+typedef group::object object;
+
+group test_geosrelatepattern("capi::GEOSRelatePattern");
+
+template<>
+template<>
+void object::test<1>()
+{
+    geom1_ = fromWKT("POINT(1 2)");
+    ensure(nullptr != geom1_);
+    geom2_ = fromWKT("POINT(1 2)");
+    ensure(nullptr != geom2_);
+    geom3_ =  GEOSBuffer(geom2_, 2, 8);
+    ensure(nullptr != geom3_);
+
+    ensure_equals(1, GEOSRelatePattern(geom1_, geom3_, "0FFFFF212"));
+    ensure_equals(1, GEOSRelatePattern(geom1_, geom3_, "*FF*FF212"));
+}
+
+} // namespace tut
+
diff --git a/tests/unit/capi/GEOSRelateTest.cpp b/tests/unit/capi/GEOSRelateTest.cpp
new file mode 100644
index 000000000..7da699b17
--- /dev/null
+++ b/tests/unit/capi/GEOSRelateTest.cpp
@@ -0,0 +1,33 @@
+#include <tut/tut.hpp>
+// geos
+#include <geos_c.h>
+
+#include "capi_test_utils.h"
+
+namespace tut {
+//
+// Test Group
+//
+
+struct test_geosrelate_data : public capitest::utility {};
+
+typedef test_group<test_geosrelate_data> group;
+typedef group::object object;
+
+group test_geosrelate("capi::GEOSRelate");
+
+template<>
+template<>
+void object::test<1>()
+{
+    geom1_ = fromWKT("LINESTRING(1 2, 3 4)");
+    ensure(nullptr != geom1_);
+    geom2_ = fromWKT("LINESTRING(5 6, 7 8)");
+    ensure(nullptr != geom2_);
+
+
+    ensure_equals(std::string{"FF1FF0102"}, GEOSRelate(geom1_, geom2_));
+}
+
+} // namespace tut
+

commit 3b378da3b5b68b7760ea99aa864223014e53b912
Author: Jared Erickson <jared.erickson at gmail.com>
Date:   Sun Mar 28 19:16:44 2021 -0700

    Add covered by, covers, and overlaps c api unit tests

diff --git a/tests/unit/capi/GEOSCoveredByTest.cpp b/tests/unit/capi/GEOSCoveredByTest.cpp
new file mode 100644
index 000000000..19f4a084c
--- /dev/null
+++ b/tests/unit/capi/GEOSCoveredByTest.cpp
@@ -0,0 +1,39 @@
+#include <tut/tut.hpp>
+// geos
+#include <geos_c.h>
+
+#include "capi_test_utils.h"
+
+namespace tut {
+//
+// Test Group
+//
+
+struct test_geoscoveredby_data : public capitest::utility {};
+
+typedef test_group<test_geoscoveredby_data> group;
+typedef group::object object;
+
+group test_geoscoveredby("capi::GEOSCoveredBy");
+
+template<>
+template<>
+void object::test<1>()
+{
+    geom1_ = fromWKT("POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))");
+    ensure(nullptr != geom1_);
+    geom2_ = fromWKT("POLYGON ((5 5, 5 7, 7 7, 7 5, 5 5))");
+    ensure(nullptr != geom2_);
+    geom3_ = fromWKT("POLYGON ((20 20, 20 30, 30 30, 30 20, 20 20))");
+    ensure(nullptr != geom3_);
+
+    ensure_equals(1, GEOSCoveredBy(geom2_, geom1_));
+    ensure_equals(0, GEOSCoveredBy(geom1_, geom2_));
+    ensure_equals(0, GEOSCoveredBy(geom1_, geom3_));
+    ensure_equals(0, GEOSCoveredBy(geom3_, geom1_));
+    ensure_equals(0, GEOSCoveredBy(geom2_, geom3_));
+    ensure_equals(0, GEOSCoveredBy(geom3_, geom2_));
+}
+
+} // namespace tut
+
diff --git a/tests/unit/capi/GEOSCoversTest.cpp b/tests/unit/capi/GEOSCoversTest.cpp
new file mode 100644
index 000000000..e7c9b92b7
--- /dev/null
+++ b/tests/unit/capi/GEOSCoversTest.cpp
@@ -0,0 +1,39 @@
+#include <tut/tut.hpp>
+// geos
+#include <geos_c.h>
+
+#include "capi_test_utils.h"
+
+namespace tut {
+//
+// Test Group
+//
+
+struct test_geoscovers_data : public capitest::utility {};
+
+typedef test_group<test_geoscovers_data> group;
+typedef group::object object;
+
+group test_geoscovers("capi::GEOSCovers");
+
+template<>
+template<>
+void object::test<1>()
+{
+    geom1_ = fromWKT("POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))");
+    ensure(nullptr != geom1_);
+    geom2_ = fromWKT("POLYGON ((5 5, 5 7, 7 7, 7 5, 5 5))");
+    ensure(nullptr != geom2_);
+    geom3_ = fromWKT("POLYGON ((20 20, 20 30, 30 30, 30 20, 20 20))");
+    ensure(nullptr != geom3_);
+
+    ensure_equals(1, GEOSCovers(geom1_, geom2_));
+    ensure_equals(0, GEOSCovers(geom2_, geom1_));
+    ensure_equals(0, GEOSCovers(geom1_, geom3_));
+    ensure_equals(0, GEOSCovers(geom3_, geom1_));
+    ensure_equals(0, GEOSCovers(geom2_, geom3_));
+    ensure_equals(0, GEOSCovers(geom3_, geom2_));
+}
+
+} // namespace tut
+
diff --git a/tests/unit/capi/GEOSOverlapsTest.cpp b/tests/unit/capi/GEOSOverlapsTest.cpp
new file mode 100644
index 000000000..59cfa073e
--- /dev/null
+++ b/tests/unit/capi/GEOSOverlapsTest.cpp
@@ -0,0 +1,39 @@
+#include <tut/tut.hpp>
+// geos
+#include <geos_c.h>
+
+#include "capi_test_utils.h"
+
+namespace tut {
+//
+// Test Group
+//
+
+struct test_geosoverlaps_data : public capitest::utility {};
+
+typedef test_group<test_geosoverlaps_data> group;
+typedef group::object object;
+
+group test_geosoverlaps("capi::GEOSOverlaps");
+
+template<>
+template<>
+void object::test<1>()
+{
+    geom1_ = fromWKT("POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))");
+    ensure(nullptr != geom1_);
+    geom2_ = fromWKT("POLYGON ((5 5, 5 15, 15 15, 15 5, 5 5))");
+    ensure(nullptr != geom2_);
+    geom3_ = fromWKT("POLYGON ((20 20, 20 30, 30 30, 30 20, 20 20))");
+    ensure(nullptr != geom3_);
+
+    ensure_equals(1, GEOSOverlaps(geom1_, geom2_));
+    ensure_equals(1, GEOSOverlaps(geom2_, geom1_));
+    ensure_equals(0, GEOSOverlaps(geom1_, geom3_));
+    ensure_equals(0, GEOSOverlaps(geom3_, geom1_));
+    ensure_equals(0, GEOSOverlaps(geom2_, geom3_));
+    ensure_equals(0, GEOSOverlaps(geom3_, geom2_));
+}
+
+} // namespace tut
+

commit c7f9253b7721cacff70cb7214753c1f6778f5053
Author: Jared Erickson <jared.erickson at gmail.com>
Date:   Sun Mar 28 11:17:15 2021 -0700

    Add unit test for GEOSCrosses

diff --git a/tests/unit/capi/GEOSCrossesTest.cpp b/tests/unit/capi/GEOSCrossesTest.cpp
new file mode 100644
index 000000000..641c177f7
--- /dev/null
+++ b/tests/unit/capi/GEOSCrossesTest.cpp
@@ -0,0 +1,39 @@
+#include <tut/tut.hpp>
+// geos
+#include <geos_c.h>
+
+#include "capi_test_utils.h"
+
+namespace tut {
+//
+// Test Group
+//
+
+struct test_geoscrosses_data : public capitest::utility {};
+
+typedef test_group<test_geoscrosses_data> group;
+typedef group::object object;
+
+group test_geoscrosses("capi::GEOSCrosses");
+
+template<>
+template<>
+void object::test<1>()
+{
+    geom1_ = fromWKT("LINESTRING (1 1, 10 10)");
+    ensure(nullptr != geom1_);
+    geom2_ = fromWKT("LINESTRING (10 1, 1 10)");
+    ensure(nullptr != geom2_);
+    geom3_ = fromWKT("LINESTRING (20 20, 30 30)");
+    ensure(nullptr != geom3_);
+
+    ensure_equals(1, GEOSCrosses(geom1_, geom2_));
+    ensure_equals(1, GEOSCrosses(geom2_, geom1_));
+    ensure_equals(0, GEOSCrosses(geom1_, geom3_));
+    ensure_equals(0, GEOSCrosses(geom3_, geom1_));
+    ensure_equals(0, GEOSCrosses(geom2_, geom3_));
+    ensure_equals(0, GEOSCrosses(geom3_, geom2_));
+}
+
+} // namespace tut
+

commit 26539025fc22283db2df10c9b68d7f02be23569f
Author: Jared Erickson <jared.erickson at gmail.com>
Date:   Sun Mar 28 09:21:26 2021 -0700

    Refactor tests

diff --git a/tests/unit/capi/GEOSDisjointTest.cpp b/tests/unit/capi/GEOSDisjointTest.cpp
index 6ecbd47ca..1a127f4be 100644
--- a/tests/unit/capi/GEOSDisjointTest.cpp
+++ b/tests/unit/capi/GEOSDisjointTest.cpp
@@ -20,21 +20,15 @@ template<>
 template<>
 void object::test<1>()
 {
-    GEOSGeometry* a = GEOSGeomFromWKT("POLYGON ((-121.915 47.39, -122.64 46.995, -121.739 46.308, -121.168 46.777, -120.981 47.316, -121.409 47.413, -121.915 47.39))");
-    GEOSGeometry* b = GEOSGeomFromWKT("POLYGON ((-120.794 46.664, -121.541 46.995, -122.2 46.536, -121.937 45.89, -120.959 46.096, -120.794 46.664))");
-    GEOSGeometry* c = GEOSGeomFromWKT("POLYGON ((-120.541 47.376, -120.695 47.047, -119.794 46.83, -119.586 47.331, -120.102 47.509, -120.541 47.376))");
-
-    ensure(a);
-    ensure(b);
-    ensure(c);
-
-    ensure_equals(0, GEOSDisjoint(a, b));
-    ensure_equals(1, GEOSDisjoint(a, c));
-    ensure_equals(1, GEOSDisjoint(b, c));
-
-    GEOSGeom_destroy(a);
-    GEOSGeom_destroy(b);
-    GEOSGeom_destroy(c);
+    geom1_ = fromWKT("POINT (0 0)");
+    ensure(geom1_);
+    geom2_ = fromWKT("LINESTRING(2 0, 0 2)");
+    ensure(geom2_);
+    geom3_ = fromWKT("LINESTRING(0 0, 0 2)");
+    ensure(geom3_);
+
+    ensure_equals(1, GEOSDisjoint(geom1_, geom2_));
+    ensure_equals(0, GEOSDisjoint(geom1_, geom3_));
 }
 
 } // namespace tut
diff --git a/tests/unit/capi/GEOSTouchesTest.cpp b/tests/unit/capi/GEOSTouchesTest.cpp
index be8b76d69..79de79f62 100644
--- a/tests/unit/capi/GEOSTouchesTest.cpp
+++ b/tests/unit/capi/GEOSTouchesTest.cpp
@@ -20,24 +20,19 @@ template<>
 template<>
 void object::test<1>()
 {
-    GEOSGeometry* a = GEOSGeomFromWKT("LINESTRING (-122.440803 47.25315, -122.4401056 47.25322)");
-    GEOSGeometry* b = GEOSGeomFromWKT("LINESTRING (-122.4401056 47.25322, -122.439993 47.25271)");
-    GEOSGeometry* c = GEOSGeomFromWKT("LINESTRING (-122.4394243 47.25331, -122.4392044 47.25241)");
-
-    ensure(a);
-    ensure(b);
-    ensure(c);
-
-    ensure_equals(1, GEOSTouches(a, b));
-    ensure_equals(1, GEOSTouches(b, a));
-    ensure_equals(0, GEOSTouches(a, c));
-    ensure_equals(0, GEOSTouches(c, a));
-    ensure_equals(0, GEOSTouches(b, c));
-    ensure_equals(0, GEOSTouches(c, b));
-
-    GEOSGeom_destroy(a);
-    GEOSGeom_destroy(b);
-    GEOSGeom_destroy(c);
+    geom1_ = fromWKT("LINESTRING (1 1, 10 1)");
+    ensure(nullptr != geom1_);
+    geom2_ = fromWKT("LINESTRING (5 1, 5 10)");
+    ensure(nullptr != geom2_);
+    geom3_ = fromWKT("LINESTRING (20 20, 30 30)");
+    ensure(nullptr != geom3_);
+
+    ensure_equals(1, GEOSTouches(geom1_, geom2_));
+    ensure_equals(1, GEOSTouches(geom2_, geom1_));
+    ensure_equals(0, GEOSTouches(geom1_, geom3_));
+    ensure_equals(0, GEOSTouches(geom3_, geom1_));
+    ensure_equals(0, GEOSTouches(geom2_, geom3_));
+    ensure_equals(0, GEOSTouches(geom3_, geom2_));
 }
 
 } // namespace tut

commit 26463fa382f5c2db7a09e4ed088c3f6963580720
Author: Jared Erickson <jared.erickson at gmail.com>
Date:   Sat Mar 27 15:21:34 2021 -0700

    Add c api tests for disjoint and touches

diff --git a/tests/unit/capi/GEOSDisjointTest.cpp b/tests/unit/capi/GEOSDisjointTest.cpp
new file mode 100644
index 000000000..6ecbd47ca
--- /dev/null
+++ b/tests/unit/capi/GEOSDisjointTest.cpp
@@ -0,0 +1,41 @@
+#include <tut/tut.hpp>
+// geos
+#include <geos_c.h>
+
+#include "capi_test_utils.h"
+
+namespace tut {
+//
+// Test Group
+//
+
+struct test_geosdisjoint_data : public capitest::utility {};
+
+typedef test_group<test_geosdisjoint_data> group;
+typedef group::object object;
+
+group test_geosdisjoint("capi::GEOSDisjoint");
+
+template<>
+template<>
+void object::test<1>()
+{
+    GEOSGeometry* a = GEOSGeomFromWKT("POLYGON ((-121.915 47.39, -122.64 46.995, -121.739 46.308, -121.168 46.777, -120.981 47.316, -121.409 47.413, -121.915 47.39))");
+    GEOSGeometry* b = GEOSGeomFromWKT("POLYGON ((-120.794 46.664, -121.541 46.995, -122.2 46.536, -121.937 45.89, -120.959 46.096, -120.794 46.664))");
+    GEOSGeometry* c = GEOSGeomFromWKT("POLYGON ((-120.541 47.376, -120.695 47.047, -119.794 46.83, -119.586 47.331, -120.102 47.509, -120.541 47.376))");
+
+    ensure(a);
+    ensure(b);
+    ensure(c);
+
+    ensure_equals(0, GEOSDisjoint(a, b));
+    ensure_equals(1, GEOSDisjoint(a, c));
+    ensure_equals(1, GEOSDisjoint(b, c));
+
+    GEOSGeom_destroy(a);
+    GEOSGeom_destroy(b);
+    GEOSGeom_destroy(c);
+}
+
+} // namespace tut
+
diff --git a/tests/unit/capi/GEOSTouchesTest.cpp b/tests/unit/capi/GEOSTouchesTest.cpp
new file mode 100644
index 000000000..be8b76d69
--- /dev/null
+++ b/tests/unit/capi/GEOSTouchesTest.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_geostouches_data : public capitest::utility {};
+
+typedef test_group<test_geostouches_data> group;
+typedef group::object object;
+
+group test_geostouches("capi::GEOSTouches");
+
+template<>
+template<>
+void object::test<1>()
+{
+    GEOSGeometry* a = GEOSGeomFromWKT("LINESTRING (-122.440803 47.25315, -122.4401056 47.25322)");
+    GEOSGeometry* b = GEOSGeomFromWKT("LINESTRING (-122.4401056 47.25322, -122.439993 47.25271)");
+    GEOSGeometry* c = GEOSGeomFromWKT("LINESTRING (-122.4394243 47.25331, -122.4392044 47.25241)");
+
+    ensure(a);
+    ensure(b);
+    ensure(c);
+
+    ensure_equals(1, GEOSTouches(a, b));
+    ensure_equals(1, GEOSTouches(b, a));
+    ensure_equals(0, GEOSTouches(a, c));
+    ensure_equals(0, GEOSTouches(c, a));
+    ensure_equals(0, GEOSTouches(b, c));
+    ensure_equals(0, GEOSTouches(c, b));
+
+    GEOSGeom_destroy(a);
+    GEOSGeom_destroy(b);
+    GEOSGeom_destroy(c);
+}
+
+} // namespace tut
+

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

Summary of changes:
 tests/unit/capi/GEOSCoveredByTest.cpp         | 39 +++++++++++++++++++
 tests/unit/capi/GEOSCoversTest.cpp            | 39 +++++++++++++++++++
 tests/unit/capi/GEOSCrossesTest.cpp           | 39 +++++++++++++++++++
 tests/unit/capi/GEOSDisjointTest.cpp          | 35 +++++++++++++++++
 tests/unit/capi/GEOSGeomToHEX_bufTest.cpp     | 36 +++++++++++++++++
 tests/unit/capi/GEOSGeomToWKB_bufTest.cpp     | 38 ++++++++++++++++++
 tests/unit/capi/GEOSGeomTypeIdTest.cpp        | 33 ++++++++++++++++
 tests/unit/capi/GEOSGetExteriorRingTest.cpp   | 34 ++++++++++++++++
 tests/unit/capi/GEOSGetGeometryNTest.cpp      | 36 +++++++++++++++++
 tests/unit/capi/GEOSGetInteriorRingNTest.cpp  | 34 ++++++++++++++++
 tests/unit/capi/GEOSOverlapsTest.cpp          | 39 +++++++++++++++++++
 tests/unit/capi/GEOSRelatePatternTest.cpp     | 35 +++++++++++++++++
 tests/unit/capi/GEOSRelateTest.cpp            | 33 ++++++++++++++++
 tests/unit/capi/GEOSSymDifferencePrecTest.cpp | 33 ++++++++++++++++
 tests/unit/capi/GEOSSymDifferenceTest.cpp     | 33 ++++++++++++++++
 tests/unit/capi/GEOSTouchesTest.cpp           | 39 +++++++++++++++++++
 tests/unit/capi/GEOSUnaryUnionPrecTest.cpp    | 56 +++++++++++++++++++++++++++
 tests/unit/capi/GEOSUnionCascadedTest.cpp     | 35 +++++++++++++++++
 18 files changed, 666 insertions(+)
 create mode 100644 tests/unit/capi/GEOSCoveredByTest.cpp
 create mode 100644 tests/unit/capi/GEOSCoversTest.cpp
 create mode 100644 tests/unit/capi/GEOSCrossesTest.cpp
 create mode 100644 tests/unit/capi/GEOSDisjointTest.cpp
 create mode 100644 tests/unit/capi/GEOSGeomToHEX_bufTest.cpp
 create mode 100644 tests/unit/capi/GEOSGeomToWKB_bufTest.cpp
 create mode 100644 tests/unit/capi/GEOSGeomTypeIdTest.cpp
 create mode 100644 tests/unit/capi/GEOSGetExteriorRingTest.cpp
 create mode 100644 tests/unit/capi/GEOSGetGeometryNTest.cpp
 create mode 100644 tests/unit/capi/GEOSGetInteriorRingNTest.cpp
 create mode 100644 tests/unit/capi/GEOSOverlapsTest.cpp
 create mode 100644 tests/unit/capi/GEOSRelatePatternTest.cpp
 create mode 100644 tests/unit/capi/GEOSRelateTest.cpp
 create mode 100644 tests/unit/capi/GEOSSymDifferencePrecTest.cpp
 create mode 100644 tests/unit/capi/GEOSSymDifferenceTest.cpp
 create mode 100644 tests/unit/capi/GEOSTouchesTest.cpp
 create mode 100644 tests/unit/capi/GEOSUnaryUnionPrecTest.cpp
 create mode 100644 tests/unit/capi/GEOSUnionCascadedTest.cpp


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list