src/test/bfs_test.cc
changeset 782 df2e45e09652
parent 774 4297098d9677
child 793 9cd0aeea47b0
equal deleted inserted replaced
0:330ab783e8a2 1:cc7e9c5cd72e
    74     check( !bfs_test.reached(u) ||
    74     check( !bfs_test.reached(u) ||
    75 	   (bfs_test.dist(v) > bfs_test.dist(u)+1),
    75 	   (bfs_test.dist(v) > bfs_test.dist(u)+1),
    76 	   "Wrong output.");
    76 	   "Wrong output.");
    77   }
    77   }
    78 
    78 
    79   ///\bug This works only for integer lengths
    79   for(NodeIt v(G); v==INVALID; ++v) {
    80   for(NodeIt v(G); v==INVALID; ++v)
    80     check(bfs_test.reached(v),"Each node should be reached.");
    81     if ( bfs_test.reached(v) ) {
    81     if ( bfs_test.pred(v)!=INVALID ) {
    82       Edge e=bfs_test.pred(v);
    82       Edge e=bfs_test.pred(v);
    83       Node u=G.tail(e);
    83       Node u=G.tail(e);
       
    84       check(u==bfs_test.predNode(v),"Wrong tree.");
    84       check(bfs_test.dist(v) - bfs_test.dist(u) == 1,
    85       check(bfs_test.dist(v) - bfs_test.dist(u) == 1,
    85 	    "Bad shortest path tree edge! Difference: " 
    86 	    "Wrong distance. Difference: " 
    86 	    << std::abs(bfs_test.dist(v) - bfs_test.dist(u) 
    87 	    << std::abs(bfs_test.dist(v) - bfs_test.dist(u) 
    87 			- 1));
    88 			- 1));
    88     }
    89     }
       
    90   }
    89 }
    91 }
       
    92