test/dfs_test.cc
changeset 1763 49045f2d28d4
parent 1435 8e85e6bbefdf
child 1875 98698b69a902
equal deleted inserted replaced
0:34c174214eaa 1:cf539860fe3b
    48   DType dfs_test(G);
    48   DType dfs_test(G);
    49   
    49   
    50   dfs_test.run(n);
    50   dfs_test.run(n);
    51   
    51   
    52   l  = dfs_test.dist(n);
    52   l  = dfs_test.dist(n);
    53   e  = dfs_test.pred(n);
    53   e  = dfs_test.predEdge(n);
    54   n  = dfs_test.predNode(n);
    54   n  = dfs_test.predNode(n);
    55   d  = dfs_test.distMap();
    55   d  = dfs_test.distMap();
    56   p  = dfs_test.predMap();
    56   p  = dfs_test.predMap();
    57   //  pn = dfs_test.predNodeMap();
    57   //  pn = dfs_test.predNodeMap();
    58   b  = dfs_test.reached(n);
    58   b  = dfs_test.reached(n);
   109   check(dfs_test.getPath(p,t),"getPath() failed to set the path.");
   109   check(dfs_test.getPath(p,t),"getPath() failed to set the path.");
   110   check(p.length()==dfs_test.dist(t),"getPath() found a wrong path.");
   110   check(p.length()==dfs_test.dist(t),"getPath() found a wrong path.");
   111   
   111   
   112   for(NodeIt v(G); v!=INVALID; ++v) {
   112   for(NodeIt v(G); v!=INVALID; ++v) {
   113     check(dfs_test.reached(v),"Each node should be reached.");
   113     check(dfs_test.reached(v),"Each node should be reached.");
   114     if ( dfs_test.pred(v)!=INVALID ) {
   114     if ( dfs_test.predEdge(v)!=INVALID ) {
   115       Edge e=dfs_test.pred(v);
   115       Edge e=dfs_test.predEdge(v);
   116       Node u=G.source(e);
   116       Node u=G.source(e);
   117       check(u==dfs_test.predNode(v),"Wrong tree.");
   117       check(u==dfs_test.predNode(v),"Wrong tree.");
   118       check(dfs_test.dist(v) - dfs_test.dist(u) == 1,
   118       check(dfs_test.dist(v) - dfs_test.dist(u) == 1,
   119 	    "Wrong distance. (" << dfs_test.dist(u) << "->" 
   119 	    "Wrong distance. (" << dfs_test.dist(u) << "->" 
   120 	    <<dfs_test.dist(v) << ')');
   120 	    <<dfs_test.dist(v) << ')');