src/test/dijkstra_test.cc
changeset 792 147eb3a58706
parent 776 f2994a2b10b2
child 793 9cd0aeea47b0
equal deleted inserted replaced
5:9d3035fbaeea 6:a433c272ad1a
    84 	   << dijkstra_test.dist(v) - dijkstra_test.dist(u) 
    84 	   << dijkstra_test.dist(v) - dijkstra_test.dist(u) 
    85 	   - cap[e]);
    85 	   - cap[e]);
    86   }
    86   }
    87 
    87 
    88   ///\bug This works only for integer lengths
    88   ///\bug This works only for integer lengths
    89   for(NodeIt v(G); v!=INVALID; ++v)
    89   for(NodeIt v(G); v!=INVALID; ++v){
    90     if ( dijkstra_test.reached(v) ) {
    90     check(dijkstra_test.reached(v),"Each node should be reached.");
       
    91     if ( dijkstra_test.pred(v)!=INVALID ) {
    91       Edge e=dijkstra_test.pred(v);
    92       Edge e=dijkstra_test.pred(v);
    92       Node u=G.tail(e);
    93       Node u=G.tail(e);
       
    94       check(u==dijkstra_test.predNode(v),"Wrong tree.");
    93       check(dijkstra_test.dist(v) - dijkstra_test.dist(u) == cap[e],
    95       check(dijkstra_test.dist(v) - dijkstra_test.dist(u) == cap[e],
    94 	    "Bad shortest path tree edge! Difference: " 
    96 	    "Wrong distance! Difference: " 
    95 	    << std::abs(dijkstra_test.dist(v) - dijkstra_test.dist(u) 
    97 	    << std::abs(dijkstra_test.dist(v) - dijkstra_test.dist(u) 
    96 			    - cap[e]));
    98 			    - cap[e]));
    97     }
    99     }
       
   100   }
    98 }
   101 }
       
   102