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

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


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

Modified:
   trunk/tests/unit/operation/sharedpaths/SharedPathsOpTest.cpp
Log:
Add tests for multiline-multiline both single dir and mixed dirs

Modified: trunk/tests/unit/operation/sharedpaths/SharedPathsOpTest.cpp
===================================================================
--- trunk/tests/unit/operation/sharedpaths/SharedPathsOpTest.cpp	2010-11-29 09:34:18 UTC (rev 3130)
+++ trunk/tests/unit/operation/sharedpaths/SharedPathsOpTest.cpp	2010-11-29 09:34:26 UTC (rev 3131)
@@ -211,5 +211,75 @@
     SharedPathsOp::clearEdges(backDir);
   }
 
+  // MultiLine-Line (back and forth)
+  template<> template<>
+  void object::test<12>()
+  {
+    GeomPtr g0(wktreader.read("MULTILINESTRING((-10 0, -5 0),(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);
+  }
+
+  // MultiLine-MultiLine (back and forth)
+  template<> template<>
+  void object::test<13>()
+  {
+    GeomPtr g0(wktreader.read("MULTILINESTRING((-10 0, -5 0),(10 0, 5 0))"));
+    GeomPtr g1(wktreader.read("MULTILINESTRING((-8 0, -2 0),(6 0, 12 0))"));
+    forwDir.clear(); backDir.clear();
+    SharedPathsOp::sharedPathsOp(*g0, *g1, forwDir, backDir);
+
+    ensure_equals(forwDir.size(), 1u);
+    ensure_equals(wktwriter.write(forwDir[0]), "LINESTRING (-8 0, -5 0)");
+    SharedPathsOp::clearEdges(forwDir);
+
+    ensure_equals(backDir.size(), 1u);
+    ensure_equals(wktwriter.write(backDir[0]), "LINESTRING (10 0, 6 0)");
+    SharedPathsOp::clearEdges(backDir);
+  }
+
+  // MultiLine-MultiLine (forth and forth)
+  template<> template<>
+  void object::test<14>()
+  {
+    GeomPtr g0(wktreader.read("MULTILINESTRING((-10 0, -5 0),(10 0, 5 0))"));
+    GeomPtr g1(wktreader.read("MULTILINESTRING((-8 0, -2 0),(12 0, 6 0))"));
+    forwDir.clear(); backDir.clear();
+    SharedPathsOp::sharedPathsOp(*g0, *g1, forwDir, backDir);
+
+    ensure_equals(forwDir.size(), 2u);
+    ensure_equals(wktwriter.write(forwDir[0]), "LINESTRING (-8 0, -5 0)");
+    ensure_equals(wktwriter.write(forwDir[1]), "LINESTRING (10 0, 6 0)");
+    SharedPathsOp::clearEdges(forwDir);
+
+    ensure(backDir.empty());
+  }
+
+  // MultiLine-MultiLine (back and back)
+  template<> template<>
+  void object::test<15>()
+  {
+    GeomPtr g0(wktreader.read("MULTILINESTRING((-10 0, -5 0),(10 0, 5 0))"));
+    GeomPtr g1(wktreader.read("MULTILINESTRING((6 0, 12 0),(-2 0, -8 0))"));
+    forwDir.clear(); backDir.clear();
+    SharedPathsOp::sharedPathsOp(*g0, *g1, forwDir, backDir);
+
+    ensure_equals(backDir.size(), 2u);
+    ensure_equals(wktwriter.write(backDir[0]), "LINESTRING (-8 0, -5 0)");
+    ensure_equals(wktwriter.write(backDir[1]), "LINESTRING (10 0, 6 0)");
+    SharedPathsOp::clearEdges(backDir);
+
+    ensure(forwDir.empty());
+  }
+
 } // namespace tut
 



More information about the geos-commits mailing list