test/path_test.cc
changeset 1433 a278d16bd2d0
parent 1270 dceba191c00d
equal deleted inserted replaced
5:43e99fb2e4b4 6:1b4105db3957
   105 
   105 
   106   void run() {
   106   void run() {
   107     checkBackAndFrontInsertablePath<Path<GR> >();
   107     checkBackAndFrontInsertablePath<Path<GR> >();
   108     checkBackAndFrontInsertablePath<ListPath<GR> >();
   108     checkBackAndFrontInsertablePath<ListPath<GR> >();
   109     checkBackInsertablePath<SimplePath<GR> >();
   109     checkBackInsertablePath<SimplePath<GR> >();
       
   110 
       
   111     checkSubscriptOperator<Path<GR> >();
       
   112     checkSubscriptOperator<SimplePath<GR> >();
       
   113     checkSubscriptOperator<StaticPath<GR> >();
       
   114     checkSubscriptOperator<ListPath<GR> >();
   110 
   115 
   111     checkListPathSplitAndSplice();
   116     checkListPathSplitAndSplice();
   112   }
   117   }
   113 
   118 
   114 private:
   119 private:
   271     check(pathSource(cgr, cp) == n4, "Wrong pathSource()");
   276     check(pathSource(cgr, cp) == n4, "Wrong pathSource()");
   272     check(pathTarget(cgr, cp) == n3, "Wrong pathTarget()");
   277     check(pathTarget(cgr, cp) == n3, "Wrong pathTarget()");
   273     check(checkPath(cgr, cp), "Wrong checkPath()");
   278     check(checkPath(cgr, cp), "Wrong checkPath()");
   274   }
   279   }
   275 
   280 
       
   281   template <typename P>
       
   282   void checkSubscriptOperator() {
       
   283     SimplePath<GR> p0;
       
   284     p0.addBack(a1);
       
   285     p0.addBack(a3);
       
   286     p0.addBack(a2);
       
   287     P p = p0;
       
   288     check(!p.empty(), "Wrong empty()");
       
   289     check(p.length() == 3, "Wrong length");
       
   290     check(p.front() == a1, "Wrong front()");
       
   291     check(p.back() == a2, "Wrong back()");
       
   292     check(p.nth(0) == a1, "Wrong nth()");
       
   293     check(p.nth(1) == a3, "Wrong nth()");
       
   294     check(p.nth(2) == a2, "Wrong nth()");
       
   295     check(p[0] == a1, "Wrong operator[]");
       
   296     check(p[1] == a3, "Wrong operator[]");
       
   297     check(p[2] == a2, "Wrong operator[]");
       
   298   }
       
   299 
   276   void checkListPathSplitAndSplice() {
   300   void checkListPathSplitAndSplice() {
   277 
   301 
   278     // Build a path with spliceFront() and spliceBack()
   302     // Build a path with spliceFront() and spliceBack()
   279     ListPath<GR> p1, p2, p3, p4;
   303     ListPath<GR> p1, p2, p3, p4;
   280     p1.addBack(a3);
   304     p1.addBack(a3);