[geos-commits] r3130 - trunk/tests/unit/operation/sharedpaths

svn_geos at osgeo.org svn_geos at osgeo.org
Mon Nov 29 04:34:18 EST 2010


Author: strk
Date: 2010-11-29 01:34:18 -0800 (Mon, 29 Nov 2010)
New Revision: 3130

Modified:
   trunk/tests/unit/operation/sharedpaths/SharedPathsOpTest.cpp
Log:
Add two tests of mixed direction shared paths

Modified: trunk/tests/unit/operation/sharedpaths/SharedPathsOpTest.cpp
===================================================================
--- trunk/tests/unit/operation/sharedpaths/SharedPathsOpTest.cpp	2010-11-29 09:34:03 UTC (rev 3129)
+++ trunk/tests/unit/operation/sharedpaths/SharedPathsOpTest.cpp	2010-11-29 09:34:18 UTC (rev 3130)
@@ -175,5 +175,41 @@
     SharedPathsOp::clearEdges(backDir);
   }
 
+  // Line-Line (back and forw)
+  template<> template<>
+  void object::test<10>()
+  {
+    GeomPtr g0(wktreader.read("LINESTRING(-15 0, 15 0)"));
+    GeomPtr g1(wktreader.read("LINESTRING(-10 0, -5 0, 0 5, 10 0, 5 0)"));
+    forwDir.clear(); backDir.clear();
+    SharedPathsOp::sharedPathsOp(*g0, *g1, forwDir, backDir);
+
+    ensure_equals(forwDir.size(), 1u);
+    ensure_equals(wktwriter.write(forwDir[0]), "LINESTRING (-10 0, -5 0)");
+    SharedPathsOp::clearEdges(forwDir);
+
+    ensure_equals(backDir.size(), 1u);
+    ensure_equals(wktwriter.write(backDir[0]), "LINESTRING (5 0, 10 0)");
+    SharedPathsOp::clearEdges(backDir);
+  }
+
+  // Line-Line (back and forw, swapped)
+  template<> template<>
+  void object::test<11>()
+  {
+    GeomPtr g0(wktreader.read("LINESTRING(-10 0, -5 0, 0 5, 10 0, 5 0)"));
+    GeomPtr g1(wktreader.read("LINESTRING(-15 0, 15 0)"));
+    forwDir.clear(); backDir.clear();
+    SharedPathsOp::sharedPathsOp(*g0, *g1, forwDir, backDir);
+
+    ensure_equals(forwDir.size(), 1u);
+    ensure_equals(wktwriter.write(forwDir[0]), "LINESTRING (-10 0, -5 0)");
+    SharedPathsOp::clearEdges(forwDir);
+
+    ensure_equals(backDir.size(), 1u);
+    ensure_equals(wktwriter.write(backDir[0]), "LINESTRING (10 0, 5 0)");
+    SharedPathsOp::clearEdges(backDir);
+  }
+
 } // namespace tut
 



More information about the geos-commits mailing list