test/dijkstra_test.cc
changeset 278 931190050520
parent 228 b6732e0d38c5
child 286 da414906fe21
     1.1 --- a/test/dijkstra_test.cc	Thu Sep 11 11:10:44 2008 +0100
     1.2 +++ b/test/dijkstra_test.cc	Mon Sep 22 15:33:23 2008 +0200
     1.3 @@ -20,7 +20,6 @@
     1.4  #include <lemon/smart_graph.h>
     1.5  #include <lemon/list_graph.h>
     1.6  #include <lemon/lgf_reader.h>
     1.7 -
     1.8  #include <lemon/dijkstra.h>
     1.9  #include <lemon/path.h>
    1.10  
    1.11 @@ -64,7 +63,6 @@
    1.12    bool b;
    1.13    DType::DistMap d(G);
    1.14    DType::PredMap p(G);
    1.15 -  //  DType::PredNodeMap pn(G);
    1.16    LengthMap length;
    1.17  
    1.18    DType dijkstra_test(G,length);
    1.19 @@ -76,7 +74,6 @@
    1.20    n  = dijkstra_test.predNode(n);
    1.21    d  = dijkstra_test.distMap();
    1.22    p  = dijkstra_test.predMap();
    1.23 -  //  pn = dijkstra_test.predNodeMap();
    1.24    b  = dijkstra_test.reached(n);
    1.25  
    1.26    Path<Digraph> pp = dijkstra_test.path(n);
    1.27 @@ -91,12 +88,21 @@
    1.28    typedef concepts::ReadMap<Digraph::Arc,VType> LengthMap;
    1.29  
    1.30    Digraph g;
    1.31 -  dijkstra(g,LengthMap(),Node()).run();
    1.32 -  dijkstra(g,LengthMap()).source(Node()).run();
    1.33 +  bool b;
    1.34 +  dijkstra(g,LengthMap()).run(Node());
    1.35 +  b=dijkstra(g,LengthMap()).run(Node(),Node());
    1.36    dijkstra(g,LengthMap())
    1.37 -    .predMap(concepts::WriteMap<Node,Arc>())
    1.38 -    .distMap(concepts::WriteMap<Node,VType>())
    1.39 +    .predMap(concepts::ReadWriteMap<Node,Arc>())
    1.40 +    .distMap(concepts::ReadWriteMap<Node,VType>())
    1.41 +    .processedMap(concepts::WriteMap<Node,bool>())
    1.42      .run(Node());
    1.43 +  b=dijkstra(g,LengthMap())
    1.44 +    .predMap(concepts::ReadWriteMap<Node,Arc>())
    1.45 +    .distMap(concepts::ReadWriteMap<Node,VType>())
    1.46 +    .processedMap(concepts::WriteMap<Node,bool>())
    1.47 +    .path(concepts::Path<Digraph>())
    1.48 +    .dist(VType())
    1.49 +    .run(Node(),Node());
    1.50  }
    1.51  
    1.52  template <class Digraph>
    1.53 @@ -122,7 +128,7 @@
    1.54    check(dijkstra_test.dist(t)==3,"Dijkstra found a wrong path.");
    1.55  
    1.56    Path<Digraph> p = dijkstra_test.path(t);
    1.57 -  check(p.length()==3,"getPath() found a wrong path.");
    1.58 +  check(p.length()==3,"path() found a wrong path.");
    1.59    check(checkPath(G, p),"path() found a wrong path.");
    1.60    check(pathSource(G, p) == s,"path() found a wrong path.");
    1.61    check(pathTarget(G, p) == t,"path() found a wrong path.");
    1.62 @@ -132,7 +138,7 @@
    1.63      Node v=G.target(e);
    1.64      check( !dijkstra_test.reached(u) ||
    1.65             (dijkstra_test.dist(v) - dijkstra_test.dist(u) <= length[e]),
    1.66 -           "dist(target)-dist(source)-arc_length= " <<
    1.67 +           "Wrong output. dist(target)-dist(source)-arc_length=" <<
    1.68             dijkstra_test.dist(v) - dijkstra_test.dist(u) - length[e]);
    1.69    }
    1.70