[geos-commits] [SCM] GEOS branch master updated. b5eb5cd30df17480a55d81e8c087049d03c13ef3

git at osgeo.org git at osgeo.org
Fri Nov 30 10:17:50 PST 2018


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  b5eb5cd30df17480a55d81e8c087049d03c13ef3 (commit)
      from  52aba2ca24177acc5ceecbcfb8e47d41d45c034b (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 b5eb5cd30df17480a55d81e8c087049d03c13ef3
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Fri Nov 30 10:17:26 2018 -0800

    Add TestEqualsExact.xml and update XMLTester

diff --git a/tests/xmltester/CMakeLists.txt b/tests/xmltester/CMakeLists.txt
index 2f3e299..f9004ab 100644
--- a/tests/xmltester/CMakeLists.txt
+++ b/tests/xmltester/CMakeLists.txt
@@ -69,6 +69,7 @@ if(GEOS_ENABLE_TESTS)
     ${XMLTESTS_DIR}/general/TestConvexHull-big.xml
     ${XMLTESTS_DIR}/general/TestConvexHull.xml
     ${XMLTESTS_DIR}/general/TestDistance.xml
+    ${XMLTESTS_DIR}/general/TestEqualsExact.xml
     ${XMLTESTS_DIR}/general/TestFunctionAA.xml
     ${XMLTESTS_DIR}/general/TestFunctionAAPrec.xml
     ${XMLTESTS_DIR}/general/TestFunctionLA.xml
diff --git a/tests/xmltester/Makefile.am b/tests/xmltester/Makefile.am
index e38f00b..5a01f1b 100644
--- a/tests/xmltester/Makefile.am
+++ b/tests/xmltester/Makefile.am
@@ -37,6 +37,7 @@ SAFE_XMLTESTS= \
 	$(srcdir)/tests/general/TestConvexHull-big.xml \
 	$(srcdir)/tests/general/TestConvexHull.xml \
 	$(srcdir)/tests/general/TestDistance.xml \
+	$(srcdir)/tests/general/TestEqualsExact.xml \
 	$(srcdir)/tests/general/TestFunctionAA.xml \
 	$(srcdir)/tests/general/TestFunctionAAPrec.xml \
 	$(srcdir)/tests/general/TestFunctionLA.xml \
diff --git a/tests/xmltester/XMLTester.cpp b/tests/xmltester/XMLTester.cpp
index 3ad7e53..624de71 100644
--- a/tests/xmltester/XMLTester.cpp
+++ b/tests/xmltester/XMLTester.cpp
@@ -1051,6 +1051,34 @@ XMLTester::parseTest(const tinyxml2::XMLNode* node)
             if (actual_result==opRes) success=1;
         }
 
+        else if (opName=="equalsexact")
+        {
+            geom::Geometry *g1 = opArg1 == "B" ? gB : gA;
+            geom::Geometry *g2 = opArg2 == "B" ? gB : gA;
+
+            actual_result="false";
+            if (g1->equalsExact(g2)) actual_result="true";
+
+            if (actual_result==opRes) success=1;
+        }
+
+        // rather than implementing equalsnorm in the library,
+        // we just do it in this one test case for now
+        else if (opName=="equalsnorm")
+        {
+            geom::Geometry *g1 = opArg1 == "B" ? gB : gA;
+            geom::Geometry *g2 = opArg2 == "B" ? gB : gA;
+
+            g1->normalize();
+            g2->normalize();
+
+            actual_result="false";
+            if (g1->equalsExact(g2)) actual_result="true";
+
+            if (actual_result==opRes) success=1;
+        }
+
+
         else if (opName=="coveredby")
         {
             geom::Geometry *g1 = opArg1 == "B" ? gB : gA;
diff --git a/tests/xmltester/tests/general/TestEqualsExact.xml b/tests/xmltester/tests/general/TestEqualsExact.xml
new file mode 100644
index 0000000..d5d0380
--- /dev/null
+++ b/tests/xmltester/tests/general/TestEqualsExact.xml
@@ -0,0 +1,157 @@
+<run>
+<description> 
+Tests of exact equality and exact equality with normalization
+</description>
+
+<case>
+  <desc>P - point</desc>
+  <a>    POINT(10 10)  </a>
+  <b>    POINT(10 10)  </b>
+<test><op name="equalsExact" arg1="A" arg2="B">    true  </op></test>
+</case>
+
+<case>
+  <desc>P - point</desc>
+  <a>    POINT(10 10)  </a>
+  <b>    POINT(10 11)  </b>
+<test><op name="equalsExact" arg1="A" arg2="B">    false  </op></test>
+</case>
+
+<case>
+  <desc>mP - MultiPoint</desc>
+  <a>    MULTIPOINT((10 10), (20 20))  </a>
+  <b>    MULTIPOINT((10 10), (20 20))  </b>
+<test><op name="equalsExact" arg1="A" arg2="B">    true  </op></test>
+</case>
+
+<case>
+  <desc>mP - MultiPoint, permuted</desc>
+  <a>    MULTIPOINT((10 10), (20 20))  </a>
+  <b>    MULTIPOINT((20 20), (10 10))  </b>
+<test><op name="equalsExact" arg1="A" arg2="B">    false  </op></test>
+<test><op name="equalsNorm"  arg1="A" arg2="B">    true  </op></test>
+</case>
+
+<case>
+  <desc>mP - MultiPoint empty</desc>
+  <a>    MULTIPOINT EMPTY </a>
+  <b>    MULTIPOINT EMPTY </b>
+<test><op name="equalsExact" arg1="A" arg2="B">    true  </op></test>
+</case>
+
+<!-- =========================================================== -->
+
+<case>
+  <desc>L - Line</desc>
+  <a>    LINESTRING(10 10, 20 20, 30 30)  </a>
+  <b>    LINESTRING(10 10, 20 20, 30 30)  </b>
+<test><op name="equalsExact" arg1="A" arg2="B">    true  </op></test>
+</case>
+
+<case>
+  <desc>L - Line, permuted</desc>
+  <a>    LINESTRING(10 10, 20 20, 30 30)  </a>
+  <b>    LINESTRING(30 30, 20 20, 10 10)  </b>
+<test><op name="equalsExact" arg1="A" arg2="B">    false  </op></test>
+<test><op name="equalsNorm"  arg1="A" arg2="B">    true  </op></test>
+</case>
+
+<case>
+  <desc>L - closed</desc>
+  <a>    LINESTRING(10 10, 20 20, 20 10, 10 10)  </a>
+  <b>    LINESTRING(10 10, 20 20, 20 10, 10 10)  </b>
+<test><op name="equalsExact" arg1="A" arg2="B">    true  </op></test>
+</case>
+
+<case>
+  <desc>L - empty</desc>
+  <a>    LINESTRING EMPTY  </a>
+  <b>    LINESTRING EMPTY  </b>
+<test><op name="equalsExact" arg1="A" arg2="B">    true  </op></test>
+</case>
+
+<case>
+  <desc>mL - 2 lines with common endpoint</desc>
+  <a> MULTILINESTRING(
+      (10 10, 20 20), 
+      (20 20, 30 30)) </a>
+  <b> MULTILINESTRING(
+      (10 10, 20 20), 
+      (20 20, 30 30)) </b>
+<test><op name="equalsExact" arg1="A" arg2="B">    true  </op></test>
+</case>
+
+<case>
+  <desc>mL - 2 lines with common endpoint, permuted</desc>
+  <a> MULTILINESTRING(
+      (10 10, 20 20), 
+      (20 20, 30 30)) </a>
+  <b> MULTILINESTRING(
+      (30 30, 20 20),
+      (10 10, 20 20)) </b>
+<test><op name="equalsExact" arg1="A" arg2="B">    false  </op></test>
+<test><op name="equalsNorm"  arg1="A" arg2="B">    true  </op></test>
+</case>
+
+<!-- =========================================================== -->
+
+<case>
+  <desc>A - polygon with no holes</desc>
+  <a>  POLYGON((40 60, 420 60, 420 320, 40 320, 40 60))  </a>
+  <b>  POLYGON((40 60, 420 60, 420 320, 40 320, 40 60))  </b>
+<test><op name="equalsExact" arg1="A" arg2="B">    true  </op></test>
+</case>
+
+<case>
+  <desc>A - polygon with no holes, permuted</desc>
+  <a>  POLYGON((40 60, 420 60, 420 320, 40 320, 40 60))  </a>
+  <b>  POLYGON((420 60, 420 320, 40 320, 40 60, 420 60))  </b>
+<test><op name="equalsExact" arg1="A" arg2="B">    false  </op></test>
+<test><op name="equalsNorm"  arg1="A" arg2="B">    true  </op></test>
+</case>
+
+<case>
+  <desc>A - polygon with 1 hole</desc>
+  <a>
+    POLYGON(
+      (40 60, 420 60, 420 320, 40 320, 40 60), 
+      (200 140, 160 220, 260 200, 200 140))
+  </a>
+  <b>
+    POLYGON(
+      (40 60, 420 60, 420 320, 40 320, 40 60), 
+      (200 140, 160 220, 260 200, 200 140))
+  </b>
+<test><op name="equalsExact" arg1="A" arg2="B">    true  </op></test>
+</case>
+
+<case>
+  <desc>A - empty</desc>
+  <a>    POLYGON EMPTY  </a>
+  <b>    POLYGON EMPTY  </b>
+<test><op name="equalsExact" arg1="A" arg2="B">    true  </op></test>
+</case>
+
+<case>
+  <desc>mA</desc>
+  <a>    MULTIPOLYGON (((50 100, 100 100, 100 50, 50 50, 50 100)), ((150 100, 200 100, 200 50, 150 50, 150 100)))  </a>
+  <b>    MULTIPOLYGON (((50 100, 100 100, 100 50, 50 50, 50 100)), ((150 100, 200 100, 200 50, 150 50, 150 100)))  </b>
+<test><op name="equalsExact" arg1="A" arg2="B">    true  </op></test>
+</case>
+
+<case>
+  <desc>mA - permuted</desc>
+  <a>    MULTIPOLYGON (((50 100, 100 100, 100 50, 50 50, 50 100)), ((150 100, 200 100, 200 50, 150 50, 150 100)))  </a>
+  <b>    MULTIPOLYGON (((150 100, 200 100, 200 50, 150 50, 150 100)), ((50 100, 100 100, 100 50, 50 50, 50 100)))  </b>
+<test><op name="equalsExact" arg1="A" arg2="B">    false  </op></test>
+<test><op name="equalsNorm"  arg1="A" arg2="B">    true  </op></test>
+</case>
+
+<case>
+  <desc>mA - empty</desc>
+  <a>    MULTIPOLYGON EMPTY  </a>
+  <b>    MULTIPOLYGON EMPTY  </b>
+<test><op name="equalsExact" arg1="A" arg2="B">    true  </op></test>
+</case>
+
+</run>

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

Summary of changes:
 tests/xmltester/CMakeLists.txt                    |   1 +
 tests/xmltester/Makefile.am                       |   1 +
 tests/xmltester/XMLTester.cpp                     |  28 ++++
 tests/xmltester/tests/general/TestEqualsExact.xml | 157 ++++++++++++++++++++++
 4 files changed, 187 insertions(+)
 create mode 100644 tests/xmltester/tests/general/TestEqualsExact.xml


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list