[geos-commits] [SCM] GEOS branch main-relate-ng updated. b3a3490336b917576d8f14538d680d7ec24dadc0

git at osgeo.org git at osgeo.org
Fri Aug 9 17:11:16 PDT 2024


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-relate-ng has been updated
       via  b3a3490336b917576d8f14538d680d7ec24dadc0 (commit)
      from  02987197e3a45cf2bf46b5644d42ffbd902232e6 (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 b3a3490336b917576d8f14538d680d7ec24dadc0
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Fri Aug 9 17:10:48 2024 -0700

    Add prepared geometry test

diff --git a/tests/unit/operation/relateng/RelateNGTest.cpp b/tests/unit/operation/relateng/RelateNGTest.cpp
index 5e3fca8d2..295e7edd0 100644
--- a/tests/unit/operation/relateng/RelateNGTest.cpp
+++ b/tests/unit/operation/relateng/RelateNGTest.cpp
@@ -867,6 +867,15 @@ void object::test<61> ()
 
 }
 
+// Prepared test
+template<>
+template<>
+void object::test<62> ()
+{
+    std::string a = "POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))";
+    std::string b = "POLYGON((0.5 0.5, 1.5 0.5, 1.5 1.5, 0.5 1.5, 0.5 0.5))";
+    checkPrepared(a, b);
+}
 
 
 } // namespace tut
diff --git a/tests/unit/operation/relateng/RelateNGTest.h b/tests/unit/operation/relateng/RelateNGTest.h
index 36a0d0e9a..a5664825b 100644
--- a/tests/unit/operation/relateng/RelateNGTest.h
+++ b/tests/unit/operation/relateng/RelateNGTest.h
@@ -27,6 +27,24 @@ struct test_relateng_support {
     WKTReader r;
     WKTWriter w;
 
+    void checkPrepared(const std::string& wkta, const std::string& wktb)
+    {
+        std::unique_ptr<Geometry> a = r.read(wkta);
+        std::unique_ptr<Geometry> b = r.read(wktb);
+        auto prep_a = RelateNG::prepare(a.get());
+        auto prep_b = RelateNG::prepare(b.get());
+        ensure_equals("equalsTopo", prep_a->equalsTopo(b.get()), a->equals(b.get()));
+        ensure_equals("intersects", prep_a->intersects(b.get()), a->intersects(b.get()));
+        ensure_equals("disjoint", prep_a->disjoint(b.get()), a->disjoint(b.get()));
+        ensure_equals("covers", prep_a->covers(b.get()), a->covers(b.get()));
+        ensure_equals("coveredby", prep_a->coveredBy(b.get()), a->coveredBy(b.get()));
+        ensure_equals("within", prep_a->within(b.get()), a->within(b.get()));
+        ensure_equals("contains", prep_a->contains(b.get()), a->contains(b.get()));
+        ensure_equals("crosses", prep_a->crosses(b.get()), a->crosses(b.get()));
+        ensure_equals("touches", prep_a->touches(b.get()), a->touches(b.get()));
+        ensure_equals("relate", prep_a->relate(b.get()), a->relate(b.get())->toString());
+    }
+
     void checkIntersectsDisjoint(const std::string& wkta, const std::string& wktb, bool expectedValue)
     {
         checkPredicate(*RelatePredicate::intersects(), wkta, wktb, expectedValue);

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

Summary of changes:
 tests/unit/operation/relateng/RelateNGTest.cpp |  9 +++++++++
 tests/unit/operation/relateng/RelateNGTest.h   | 18 ++++++++++++++++++
 2 files changed, 27 insertions(+)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list