test/bfs_test.cc
changeset 227 33f8d69e642a
parent 209 765619b7cbb2
child 228 b6732e0d38c5
equal deleted inserted replaced
2:617402b542c8 3:b976c8d5891f
    95   check(checkPath(G, p),"path() found a wrong path.");
    95   check(checkPath(G, p),"path() found a wrong path.");
    96   check(pathSource(G, p) == s,"path() found a wrong path.");
    96   check(pathSource(G, p) == s,"path() found a wrong path.");
    97   check(pathTarget(G, p) == t,"path() found a wrong path.");
    97   check(pathTarget(G, p) == t,"path() found a wrong path.");
    98 
    98 
    99 
    99 
   100   for(ArcIt e(G); e==INVALID; ++e) {
   100   for(ArcIt e(G); e!=INVALID; ++e) {
   101     Node u=G.source(e);
   101     Node u=G.source(e);
   102     Node v=G.target(e);
   102     Node v=G.target(e);
   103     check( !bfs_test.reached(u) ||
   103     check( !bfs_test.reached(u) ||
   104            (bfs_test.dist(v) > bfs_test.dist(u)+1),
   104            (bfs_test.dist(v) <= bfs_test.dist(u)+1),
   105            "Wrong output.");
   105            "Wrong output.");
   106   }
   106   }
   107 
   107 
   108   for(NodeIt v(G); v==INVALID; ++v) {
   108   for(NodeIt v(G); v!=INVALID; ++v) {
   109     check(bfs_test.reached(v),"Each node should be reached.");
   109     check(bfs_test.reached(v),"Each node should be reached.");
   110     if ( bfs_test.predArc(v)!=INVALID ) {
   110     if ( bfs_test.predArc(v)!=INVALID ) {
   111       Arc e=bfs_test.predArc(v);
   111       Arc e=bfs_test.predArc(v);
   112       Node u=G.source(e);
   112       Node u=G.source(e);
   113       check(u==bfs_test.predNode(v),"Wrong tree.");
   113       check(u==bfs_test.predNode(v),"Wrong tree.");