[geos-commits] [SCM] GEOS branch main updated. 34b29f889987fc528b490491d5595bb3c791ea9e

git at osgeo.org git at osgeo.org
Wed Nov 22 15:01:44 PST 2023


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  34b29f889987fc528b490491d5595bb3c791ea9e (commit)
      from  b3415ca77a8f177493bd36e7d47dc04f5a266096 (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 34b29f889987fc528b490491d5595bb3c791ea9e
Author: Mike Taves <mwtoews at gmail.com>
Date:   Thu Nov 23 12:01:04 2023 +1300

    Add test for invalid value warning from GEOSProject and GEOSProjectNormalized

diff --git a/tests/unit/capi/GEOSProjectTest.cpp b/tests/unit/capi/GEOSProjectTest.cpp
index aae51860e..91c861823 100644
--- a/tests/unit/capi/GEOSProjectTest.cpp
+++ b/tests/unit/capi/GEOSProjectTest.cpp
@@ -95,4 +95,25 @@ void object::test<4>
     ensure_equals(dist_norm, 0.0);
 }
 
+// Test invalid value warning
+// https://github.com/shapely/shapely/issues/1796
+template<>
+template<>
+void object::test<5>
+()
+{
+    geom1_ = GEOSGeomFromWKT("LINESTRING (0 0, 1 1, 1 1, 2 2)");
+    geom2_ = GEOSGeomFromWKT("POINT (0 1)");
+
+    std::feclearexcept(FE_ALL_EXCEPT);
+    double dist = GEOSProject(geom1_, geom2_);
+    ensure("FE_INVALID raised", !std::fetestexcept(FE_INVALID));
+    ensure_equals("GEOSProject", dist, 0.7071, 0.0001);
+
+    std::feclearexcept(FE_ALL_EXCEPT);
+    double dist_norm = GEOSProjectNormalized(geom1_, geom2_);
+    ensure("FE_INVALID raised", !std::fetestexcept(FE_INVALID));
+    ensure_equals("GEOSProjectNormalized", dist_norm, 0.25);
+}
+
 } // namespace tut

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

Summary of changes:
 tests/unit/capi/GEOSProjectTest.cpp | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list