src/test/dijkstra_test.cc
changeset 1306 4ea2147274db
parent 1220 20b26ee5812b
child 1359 1581f961cfaa
equal deleted inserted replaced
16:52735fcdf05b 17:d1b41c55dadb
    15  */
    15  */
    16 
    16 
    17 #include "test_tools.h"
    17 #include "test_tools.h"
    18 #include <lemon/smart_graph.h>
    18 #include <lemon/smart_graph.h>
    19 #include <lemon/dijkstra.h>
    19 #include <lemon/dijkstra.h>
       
    20 #include <lemon/path.h>
    20 #include <lemon/maps.h>
    21 #include <lemon/maps.h>
    21 #include <lemon/concept/graph.h>
    22 #include <lemon/concept/graph.h>
    22 #include <lemon/concept/maps.h>
    23 #include <lemon/concept/maps.h>
    23 using namespace lemon;
    24 using namespace lemon;
    24 
    25 
    57   n  = dijkstra_test.predNode(n);
    58   n  = dijkstra_test.predNode(n);
    58   d  = dijkstra_test.distMap();
    59   d  = dijkstra_test.distMap();
    59   p  = dijkstra_test.predMap();
    60   p  = dijkstra_test.predMap();
    60   //  pn = dijkstra_test.predNodeMap();
    61   //  pn = dijkstra_test.predNodeMap();
    61   b  = dijkstra_test.reached(n);
    62   b  = dijkstra_test.reached(n);
    62   
    63 
       
    64   DirPath<Graph> pp(G);
       
    65   dijkstra_test.getPath(pp,n);
    63 }
    66 }
    64 
    67 
    65 void check_Dijkstra_Function_Compile() 
    68 void check_Dijkstra_Function_Compile() 
    66 {
    69 {
    67   typedef int VType;
    70   typedef int VType;
   112   dijkstra_test.run(s);
   115   dijkstra_test.run(s);
   113   
   116   
   114   check(dijkstra_test.dist(t)==13,"Dijkstra found a wrong path.");
   117   check(dijkstra_test.dist(t)==13,"Dijkstra found a wrong path.");
   115 
   118 
   116 
   119 
       
   120   DirPath<Graph> p(G);
       
   121   check(dijkstra_test.getPath(p,t),"getPath() failed to set the path.");
       
   122   check(p.length()==4,"getPath() found a wrong path.");
       
   123   
       
   124 
   117   for(EdgeIt e(G); e!=INVALID; ++e) {
   125   for(EdgeIt e(G); e!=INVALID; ++e) {
   118     Node u=G.source(e);
   126     Node u=G.source(e);
   119     Node v=G.target(e);
   127     Node v=G.target(e);
   120     check( !dijkstra_test.reached(u) ||
   128     check( !dijkstra_test.reached(u) ||
   121 	   (dijkstra_test.dist(v) - dijkstra_test.dist(u) <= cap[e]),
   129 	   (dijkstra_test.dist(v) - dijkstra_test.dist(u) <= cap[e]),