[geos-commits] [SCM] GEOS branch main updated. c679bff3e99208336c11aee3f9a6b16d9c4f85c0
git at osgeo.org
git at osgeo.org
Mon Feb 3 11:54:56 PST 2025
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 c679bff3e99208336c11aee3f9a6b16d9c4f85c0 (commit)
from e6e5fd799fddf29154c6e87171c8fb71713a3a58 (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 c679bff3e99208336c11aee3f9a6b16d9c4f85c0
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Mon Feb 3 11:54:05 2025 -0800
commit e71d48e1e4eaaed7c1e56bf6c8b8d7c565e6048d
Author: Aurèle Nitoref <aurele.nitoref at icloud.com>
Date: Sun Sep 8 01:04:31 2024 +0200
Add LinearRing tests for GEOSisClosed, GEOSGeomGetPointN, GEOSGeomGetStartPoint, GEOSGeomGetEndPoint, GEOSGeomGetLength
diff --git a/tests/unit/capi/GEOSGeomGetNumPointsTest.cpp b/tests/unit/capi/GEOSGeomGetNumPointsTest.cpp
index 80b7d2456..993d8703a 100644
--- a/tests/unit/capi/GEOSGeomGetNumPointsTest.cpp
+++ b/tests/unit/capi/GEOSGeomGetNumPointsTest.cpp
@@ -48,5 +48,13 @@ void object::test<4>()
ensure_equals(GEOSGeomGetNumPoints(input_), 3);
}
+template<>
+template<>
+void object::test<5>()
+{
+ input_ = fromWKT("LINEARRING (0 0, 1 1, 2 0, 0 0)");
+ ensure_equals(GEOSGeomGetNumPoints(input_), 4);
+}
+
} // namespace tut
diff --git a/tests/unit/capi/GEOSLineStringTest.cpp b/tests/unit/capi/GEOSLineStringTest.cpp
index 9d90c3b7c..d05a47a72 100644
--- a/tests/unit/capi/GEOSLineStringTest.cpp
+++ b/tests/unit/capi/GEOSLineStringTest.cpp
@@ -108,4 +108,67 @@ void object::test<3>
ensure_equals(GEOSGeomGetLength(geom1_, &length), 0);
}
+template<>
+template<>
+void object::test<4>
+()
+{
+ geom1_ = GEOSGeomFromWKT("LINEARRING(0 0, 5 5, 10 10, 0 0)");
+ GEOSGeometry* geom2;
+ double x, y, z;
+ ensure(nullptr != geom1_);
+
+ char const r1 = GEOSisClosed(geom1_);
+
+ ensure_equals(r1, 1);
+
+ geom2 = GEOSGeomGetPointN(geom1_, 0);
+ GEOSGeomGetX(geom2, &x);
+ GEOSGeomGetY(geom2, &y);
+ GEOSGeomGetZ(geom2, &z);
+
+ ensure_equals(x, 0);
+ ensure_equals(y, 0);
+ ensure(std::isnan(z));
+
+ GEOSGeom_destroy(geom2);
+
+ ensure(GEOSGeomGetPointN(geom1_, -1) == nullptr);
+
+ geom2 = GEOSGeomGetStartPoint(geom1_);
+ GEOSGeomGetX(geom2, &x);
+ GEOSGeomGetY(geom2, &y);
+ GEOSGeomGetZ(geom2, &z);
+
+ ensure_equals(x, 0);
+ ensure_equals(y, 0);
+ ensure(std::isnan(z));
+
+ GEOSGeom_destroy(geom2);
+
+ geom2 = GEOSGeomGetEndPoint(geom1_);
+ GEOSGeomGetX(geom2, &x);
+ GEOSGeomGetY(geom2, &y);
+ GEOSGeomGetZ(geom2, &z);
+
+ ensure_equals(x, 0);
+ ensure_equals(y, 0);
+ ensure(std::isnan(z));
+
+ GEOSGeom_destroy(geom2);
+}
+
+template<>
+template<>
+void object::test<5>
+()
+{
+ geom1_ = GEOSGeomFromWKT("LINEARRING(0 0, 5 5, 10 10, 0 0)");
+ double length;
+ ensure(nullptr != geom1_);
+
+ GEOSGeomGetLength(geom1_, &length);
+ ensure(length > 0.0);
+}
+
} // namespace tut
-----------------------------------------------------------------------
Summary of changes:
tests/unit/capi/GEOSGeomGetNumPointsTest.cpp | 8 ++++
tests/unit/capi/GEOSLineStringTest.cpp | 63 ++++++++++++++++++++++++++++
2 files changed, 71 insertions(+)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list