[geos-commits] r2454 - trunk/tests/xmltester

svn_geos at osgeo.org svn_geos at osgeo.org
Sat May 2 05:40:10 EDT 2009


Author: strk
Date: 2009-05-02 05:40:10 -0400 (Sat, 02 May 2009)
New Revision: 2454

Modified:
   trunk/tests/xmltester/XMLTester.cpp
Log:
Add support for testing within, covers and coveredby. Properly use 'arg1' and 'arg2' for these tests.


Modified: trunk/tests/xmltester/XMLTester.cpp
===================================================================
--- trunk/tests/xmltester/XMLTester.cpp	2009-05-02 09:25:36 UTC (rev 2453)
+++ trunk/tests/xmltester/XMLTester.cpp	2009-05-02 09:40:10 UTC (rev 2454)
@@ -614,7 +614,10 @@
 
 		else if (opName=="intersects")
 		{
-			if (gA->intersects(gB)) actual_result="true";
+			geom::Geometry *g1 = opArg1 == "B" ? gB : gA;
+			geom::Geometry *g2 = opArg2 == "B" ? gB : gA;
+
+			if (g1->intersects(g2)) actual_result="true";
 			else actual_result="false";
 			
 			if (actual_result==opRes) success=1;
@@ -622,12 +625,48 @@
 
 		else if (opName=="contains")
 		{
-			if (gA->contains(gB)) actual_result="true";
+			geom::Geometry *g1 = opArg1 == "B" ? gB : gA;
+			geom::Geometry *g2 = opArg2 == "B" ? gB : gA;
+
+			if (g1->contains(g2)) actual_result="true";
 			else actual_result="false";
 			
 			if (actual_result==opRes) success=1;
 		}
 
+		else if (opName=="within")
+		{
+			geom::Geometry *g1 = opArg1 == "B" ? gB : gA;
+			geom::Geometry *g2 = opArg2 == "B" ? gB : gA;
+
+			if (g1->within(g2)) actual_result="true";
+			else actual_result="false";
+			
+			if (actual_result==opRes) success=1;
+		}
+
+		else if (opName=="covers")
+		{
+			geom::Geometry *g1 = opArg1 == "B" ? gB : gA;
+			geom::Geometry *g2 = opArg2 == "B" ? gB : gA;
+
+			if (g1->covers(g2)) actual_result="true";
+			else actual_result="false";
+			
+			if (actual_result==opRes) success=1;
+		}
+
+		else if (opName=="coveredby")
+		{
+			geom::Geometry *g1 = opArg1 == "B" ? gB : gA;
+			geom::Geometry *g2 = opArg2 == "B" ? gB : gA;
+
+			if (g1->coveredBy(g2)) actual_result="true";
+			else actual_result="false";
+			
+			if (actual_result==opRes) success=1;
+		}
+
 		else if (opName=="getboundary")
 		{
 			geom::Geometry *gT=gA;



More information about the geos-commits mailing list