# HG changeset patch # User alpar # Date 1084032057 0 # Node ID 87c34740a0ec6fb3de9a443eed4557546fdc5db8 # Parent 1d4855f5312e9f10489946049dc9a12bf6cac7de Some more test cases. diff -r 1d4855f5312e -r 87c34740a0ec src/test/dijkstra_test.cc --- a/src/test/dijkstra_test.cc Sat May 08 15:58:34 2004 +0000 +++ b/src/test/dijkstra_test.cc Sat May 08 16:00:57 2004 +0000 @@ -73,5 +73,26 @@ dijkstra_test.run(s); check(dijkstra_test.dist(t)==13,"Dijkstra found a wrong path."); - + + + for(EdgeIt e(G); G.valid(e); G.next(e)) { + Node u=G.tail(e); + Node v=G.head(e); + check( !dijkstra_test.reached(u) || + (dijkstra_test.dist(v) - dijkstra_test.dist(u) <= cap[e]), + "dist(head)-dist(tail)- edge_length= " + << dijkstra_test.dist(v) - dijkstra_test.dist(u) + - cap[e]); + } + + ///\bug This works only for integer lengths + for(NodeIt v(G); G.valid(v); G.next(v)) + if ( dijkstra_test.reached(v) ) { + Edge e=dijkstra_test.pred(v); + Node u=G.tail(e); + check(dijkstra_test.dist(v) - dijkstra_test.dist(u) == cap[e], + "Bad shortest path tree edge! Difference: " + << std::abs(dijkstra_test.dist(v) - dijkstra_test.dist(u) + - cap[e])); + } }