1.1 --- a/test/all_pairs_shortest_path_test.cc Thu Oct 20 15:50:23 2005 +0000
1.2 +++ b/test/all_pairs_shortest_path_test.cc Fri Oct 21 08:34:47 2005 +0000
1.3 @@ -10,6 +10,7 @@
1.4 #include <lemon/johnson.h>
1.5
1.6 #include <lemon/time_measure.h>
1.7 +#include "test_tools.h"
1.8
1.9 using namespace lemon;
1.10 using namespace std;
1.11 @@ -26,7 +27,7 @@
1.12 typedef Graph::NodeMap<double> DistMap;
1.13
1.14 const int n = argc > 1 ? atoi(argv[1]) : 20;
1.15 - const int e = argc > 2 ? atoi(argv[2]) : (int)(n * log(n));
1.16 + const int e = argc > 2 ? atoi(argv[2]) : (int)(n * log((double)n));
1.17 const double m = argc > 3 ? (double)atoi(argv[3]) : 100.0;
1.18
1.19 Graph graph;
1.20 @@ -64,16 +65,20 @@
1.21
1.22 for (NodeIt it(graph); it != INVALID; ++it) {
1.23 for (NodeIt jt(graph); jt != INVALID; ++jt) {
1.24 - assert(johnson.connected(it, jt) == floyd.connected(it, jt));
1.25 + check(johnson.connected(it, jt) == floyd.connected(it, jt),
1.26 + "Wrong connection in all pairs shortest path");
1.27 if (johnson.connected(it, jt)) {
1.28 - assert(johnson.dist(it, jt) == floyd.dist(it, jt));
1.29 + check(johnson.dist(it, jt) == floyd.dist(it, jt),
1.30 + "Wrong distance in all pairs shortest path");
1.31 if (it != jt) {
1.32 - assert(johnson.dist(it, jt) ==
1.33 - johnson.dist(it, johnson.predNode(it, jt)) +
1.34 - length[johnson.pred(it, jt)]);
1.35 - assert(floyd.dist(it, jt) ==
1.36 - floyd.dist(it, floyd.predNode(it, jt)) +
1.37 - length[floyd.pred(it, jt)]);
1.38 + check(johnson.dist(it, jt) ==
1.39 + johnson.dist(it, johnson.predNode(it, jt)) +
1.40 + length[johnson.pred(it, jt)],
1.41 + "Wrong edge in all pairs shortest path");
1.42 + check(floyd.dist(it, jt) ==
1.43 + floyd.dist(it, floyd.predNode(it, jt)) +
1.44 + length[floyd.pred(it, jt)],
1.45 + "Wrong edge in all pairs shortest path");
1.46 }
1.47 }
1.48 }