Upgrading tests
authordeba
Wed, 26 Oct 2005 11:10:18 +0000
changeset 1745d356e54bdafc
parent 1744 51d5d41e15b1
child 1746 874e4bc21435
Upgrading tests
test/all_pairs_shortest_path_test.cc
test/heap_test.h
     1.1 --- a/test/all_pairs_shortest_path_test.cc	Wed Oct 26 11:09:29 2005 +0000
     1.2 +++ b/test/all_pairs_shortest_path_test.cc	Wed Oct 26 11:10:18 2005 +0000
     1.3 @@ -9,6 +9,8 @@
     1.4  #include <lemon/floyd_warshall.h>
     1.5  #include <lemon/johnson.h>
     1.6  
     1.7 +#include <lemon/fib_heap.h>
     1.8 +
     1.9  #include <lemon/time_measure.h>
    1.10  #include "test_tools.h"
    1.11  
    1.12 @@ -56,6 +58,15 @@
    1.13      cout << "Johnson: " << timer << endl;
    1.14    }
    1.15  
    1.16 +  typedef FibHeap<Node, double, Graph::NodeMap<int> > DoubleFibHeap;
    1.17 +  Johnson<Graph, LengthMap>::DefStandardHeap<DoubleFibHeap>
    1.18 +    ::Create fibJohnson(graph, length);
    1.19 +  {
    1.20 +    Timer timer;
    1.21 +    fibJohnson.run();
    1.22 +    cout << "Johnson with fibonacci heap: " << timer << endl;
    1.23 +  }
    1.24 +
    1.25    FloydWarshall<Graph, LengthMap> floyd(graph, length);
    1.26    {
    1.27      Timer timer;
    1.28 @@ -67,14 +78,22 @@
    1.29      for (NodeIt jt(graph); jt != INVALID; ++jt) {
    1.30        check(johnson.connected(it, jt) == floyd.connected(it, jt),
    1.31  	    "Wrong connection in all pairs shortest path");
    1.32 +      check(johnson.connected(it, jt) == fibJohnson.connected(it, jt),
    1.33 +	    "Wrong connection in all pairs shortest path");
    1.34        if (johnson.connected(it, jt)) {
    1.35  	check(johnson.dist(it, jt) == floyd.dist(it, jt),
    1.36  	      "Wrong distance in all pairs shortest path");
    1.37 +	check(johnson.dist(it, jt) == fibJohnson.dist(it, jt),
    1.38 +	      "Wrong distance in all pairs shortest path");
    1.39  	if (it != jt) {
    1.40   	  check(johnson.dist(it, jt) == 
    1.41  		johnson.dist(it, johnson.predNode(it, jt)) +
    1.42  		length[johnson.pred(it, jt)],
    1.43  		"Wrong edge in all pairs shortest path");
    1.44 + 	  check(fibJohnson.dist(it, jt) == 
    1.45 +		fibJohnson.dist(it, fibJohnson.predNode(it, jt)) +
    1.46 +		length[fibJohnson.pred(it, jt)],
    1.47 +		"Wrong edge in all pairs shortest path");
    1.48  	  check(floyd.dist(it, jt) == 
    1.49  		floyd.dist(it, floyd.predNode(it, jt)) +
    1.50  		length[floyd.pred(it, jt)],
     2.1 --- a/test/heap_test.h	Wed Oct 26 11:09:29 2005 +0000
     2.2 +++ b/test/heap_test.h	Wed Oct 26 11:10:18 2005 +0000
     2.3 @@ -78,7 +78,7 @@
     2.4    typedef typename Graph::NodeIt NodeIt;
     2.5    typedef typename Graph::EdgeIt EdgeIt;
     2.6  
     2.7 -  typename Dijkstra<Graph, LengthMap>::template DefHeap<Heap>::
     2.8 +  typename Dijkstra<Graph, LengthMap>::template DefStandardHeap<Heap>::
     2.9      Create dijkstra(graph, length);
    2.10  
    2.11    dijkstra.run(start);