[geos-commits] [SCM] GEOS branch master updated. 339f8caaa6e778dd579db70ca618018e4a8ca507

git at osgeo.org git at osgeo.org
Wed Mar 3 15:24:49 PST 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, master has been updated
       via  339f8caaa6e778dd579db70ca618018e4a8ca507 (commit)
      from  72b58feb34343f40a27badb2bbba9e6e1050a62a (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 339f8caaa6e778dd579db70ca618018e4a8ca507
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Wed Mar 3 15:24:36 2021 -0800

    Add NaN coordinate test turned up in PyGEOS. https://github.com/pygeos/pygeos/issues/306

diff --git a/tests/unit/geom/LineStringTest.cpp b/tests/unit/geom/LineStringTest.cpp
index f97eedb..3d03d03 100644
--- a/tests/unit/geom/LineStringTest.cpp
+++ b/tests/unit/geom/LineStringTest.cpp
@@ -15,6 +15,7 @@
 #include <geos/io/WKTReader.h>
 #include <geos/util/GEOSException.h>
 #include <geos/util/IllegalArgumentException.h>
+#include <geos/constants.h>
 // std
 #include <string>
 #include <cmath>
@@ -540,6 +541,38 @@ void object::test<30>()
     ensure_equals(cs->getSize(), 2u);
 }
 
+// Test of LinearRing constructor with a NaN coordinate
+template<>
+template<>
+void object::test<31>
+()
+{
+    using geos::geom::Coordinate;
+
+    // Non-empty sequence of coordinates
+    const std::size_t size3 = 3;
+
+    CoordArrayPtr pseq = new geos::geom::CoordinateArraySequence();
+    ensure("sequence is null pointer.", pseq != nullptr);
+
+    pseq->add(Coordinate(0, geos::DoubleNotANumber));
+    pseq->add(Coordinate(5, 5));
+    pseq->add(Coordinate(0, geos::DoubleNotANumber));
+    ensure_equals(pseq->size(), size3);
+
+    try {
+        // Create non-empty LineString instance
+        auto lr(factory_->createLinearRing(pseq));
+        fail("IllegalArgumentException expected.");
+        ensure(!lr->isEmpty());
+    }
+    catch(geos::util::IllegalArgumentException const& e) {
+        const char* msg = e.what(); // OK
+        ensure(msg != nullptr);
+    }
+
+}
+
 
 } // namespace tut
 

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

Summary of changes:
 tests/unit/geom/LineStringTest.cpp | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list