[Lemon-commits] [lemon_svn] deba: r2259 - hugo/trunk/test
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:51:19 CET 2006
Author: deba
Date: Fri Oct 21 10:34:47 2005
New Revision: 2259
Modified:
hugo/trunk/test/all_pairs_shortest_path_test.cc
Log:
Bugfix
Modified: hugo/trunk/test/all_pairs_shortest_path_test.cc
==============================================================================
--- hugo/trunk/test/all_pairs_shortest_path_test.cc (original)
+++ hugo/trunk/test/all_pairs_shortest_path_test.cc Fri Oct 21 10:34:47 2005
@@ -10,6 +10,7 @@
#include <lemon/johnson.h>
#include <lemon/time_measure.h>
+#include "test_tools.h"
using namespace lemon;
using namespace std;
@@ -26,7 +27,7 @@
typedef Graph::NodeMap<double> DistMap;
const int n = argc > 1 ? atoi(argv[1]) : 20;
- const int e = argc > 2 ? atoi(argv[2]) : (int)(n * log(n));
+ const int e = argc > 2 ? atoi(argv[2]) : (int)(n * log((double)n));
const double m = argc > 3 ? (double)atoi(argv[3]) : 100.0;
Graph graph;
@@ -64,16 +65,20 @@
for (NodeIt it(graph); it != INVALID; ++it) {
for (NodeIt jt(graph); jt != INVALID; ++jt) {
- assert(johnson.connected(it, jt) == floyd.connected(it, jt));
+ check(johnson.connected(it, jt) == floyd.connected(it, jt),
+ "Wrong connection in all pairs shortest path");
if (johnson.connected(it, jt)) {
- assert(johnson.dist(it, jt) == floyd.dist(it, jt));
+ check(johnson.dist(it, jt) == floyd.dist(it, jt),
+ "Wrong distance in all pairs shortest path");
if (it != jt) {
- assert(johnson.dist(it, jt) ==
- johnson.dist(it, johnson.predNode(it, jt)) +
- length[johnson.pred(it, jt)]);
- assert(floyd.dist(it, jt) ==
- floyd.dist(it, floyd.predNode(it, jt)) +
- length[floyd.pred(it, jt)]);
+ check(johnson.dist(it, jt) ==
+ johnson.dist(it, johnson.predNode(it, jt)) +
+ length[johnson.pred(it, jt)],
+ "Wrong edge in all pairs shortest path");
+ check(floyd.dist(it, jt) ==
+ floyd.dist(it, floyd.predNode(it, jt)) +
+ length[floyd.pred(it, jt)],
+ "Wrong edge in all pairs shortest path");
}
}
}
More information about the Lemon-commits
mailing list