test/bfs_test.cc
changeset 1790 c7dd9d8c770a
parent 1435 8e85e6bbefdf
child 1875 98698b69a902
equal deleted inserted replaced
0:7dbf365776c5 1:b7ce31ef0b69
    48   BType bfs_test(G);
    48   BType bfs_test(G);
    49   
    49   
    50   bfs_test.run(n);
    50   bfs_test.run(n);
    51   
    51   
    52   l  = bfs_test.dist(n);
    52   l  = bfs_test.dist(n);
    53   e  = bfs_test.pred(n);
    53   e  = bfs_test.predEdge(n);
    54   n  = bfs_test.predNode(n);
    54   n  = bfs_test.predNode(n);
    55   d  = bfs_test.distMap();
    55   d  = bfs_test.distMap();
    56   p  = bfs_test.predMap();
    56   p  = bfs_test.predMap();
    57   //  pn = bfs_test.predNodeMap();
    57   //  pn = bfs_test.predNodeMap();
    58   b  = bfs_test.reached(n);
    58   b  = bfs_test.reached(n);
   119 	   "Wrong output.");
   119 	   "Wrong output.");
   120   }
   120   }
   121 
   121 
   122   for(NodeIt v(G); v==INVALID; ++v) {
   122   for(NodeIt v(G); v==INVALID; ++v) {
   123     check(bfs_test.reached(v),"Each node should be reached.");
   123     check(bfs_test.reached(v),"Each node should be reached.");
   124     if ( bfs_test.pred(v)!=INVALID ) {
   124     if ( bfs_test.predEdge(v)!=INVALID ) {
   125       Edge e=bfs_test.pred(v);
   125       Edge e=bfs_test.predEdge(v);
   126       Node u=G.source(e);
   126       Node u=G.source(e);
   127       check(u==bfs_test.predNode(v),"Wrong tree.");
   127       check(u==bfs_test.predNode(v),"Wrong tree.");
   128       check(bfs_test.dist(v) - bfs_test.dist(u) == 1,
   128       check(bfs_test.dist(v) - bfs_test.dist(u) == 1,
   129 	    "Wrong distance. Difference: " 
   129 	    "Wrong distance. Difference: " 
   130 	    << std::abs(bfs_test.dist(v) - bfs_test.dist(u) 
   130 	    << std::abs(bfs_test.dist(v) - bfs_test.dist(u)