[geos-commits] [SCM] GEOS branch master updated.	a1eed0f993839c4cff5ccfb1644e8b6a2ff2cc1d
    git at osgeo.org 
    git at osgeo.org
       
    Mon Nov  2 12:12:33 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  a1eed0f993839c4cff5ccfb1644e8b6a2ff2cc1d (commit)
      from  572a212b0f8f15ac401d5ef6c2c699f6102ae9d5 (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 a1eed0f993839c4cff5ccfb1644e8b6a2ff2cc1d
Author: Sandro Santilli <strk at kbt.io>
Date:   Mon Nov 2 21:11:09 2020 +0100
    Add GEOSNearestPoints test for point contained in polygon
diff --git a/tests/unit/capi/GEOSNearestPointsTest.cpp b/tests/unit/capi/GEOSNearestPointsTest.cpp
index c170459..1b7a6f2 100644
--- a/tests/unit/capi/GEOSNearestPointsTest.cpp
+++ b/tests/unit/capi/GEOSNearestPointsTest.cpp
@@ -117,5 +117,45 @@ void object::test<2>
     GEOSCoordSeq_destroy(coords_);
 }
 
+template<>
+template<>
+void object::test<3>
+()
+{
+    geom1_ = GEOSGeomFromWKT("POLYGON((1 1,1 5,5 5,5 1,1 1))");
+    geom2_ = GEOSGeomFromWKT("POINT(2 2)");
+
+    ensure(nullptr != geom1_);
+    ensure(nullptr != geom2_);
+
+    GEOSCoordSequence* coords_;
+    coords_ = GEOSNearestPoints(geom1_, geom2_);
+
+    ensure(nullptr != coords_);
+
+    unsigned int size;
+    GEOSCoordSeq_getSize(coords_, &size);
+    ensure(2 == size);
+
+    double  x1, x2, y1, y2;
+
+    /* Point in geom1_
+     */
+    GEOSCoordSeq_getOrdinate(coords_, 0, 0, &x1);
+    GEOSCoordSeq_getOrdinate(coords_, 0, 1, &y1);
+
+    /* Point in geom2_
+     */
+    GEOSCoordSeq_getOrdinate(coords_, 1, 0, &x2);
+    GEOSCoordSeq_getOrdinate(coords_, 1, 1, &y2);
+
+    ensure(2 == x1);
+    ensure(2 == y1);
+    ensure(2 == x2);
+    ensure(2 == y2);
+
+    GEOSCoordSeq_destroy(coords_);
+}
+
 } // namespace tut
 
-----------------------------------------------------------------------
Summary of changes:
 tests/unit/capi/GEOSNearestPointsTest.cpp | 40 +++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
hooks/post-receive
-- 
GEOS
    
    
More information about the geos-commits
mailing list