src/test/dfs_test.cc
changeset 1307 d4acebef7276
parent 1233 f3d856bf1ebf
child 1359 1581f961cfaa
equal deleted inserted replaced
10:294168d22490 11:7c5669e545f8
    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/dfs.h>
    19 #include <lemon/dfs.h>
       
    20 #include <lemon/path.h>
    20 #include <lemon/concept/graph.h>
    21 #include <lemon/concept/graph.h>
    21 
    22 
    22 using namespace lemon;
    23 using namespace lemon;
    23 
    24 
    24 const int PET_SIZE =5;
    25 const int PET_SIZE =5;
    54   d  = dfs_test.distMap();
    55   d  = dfs_test.distMap();
    55   p  = dfs_test.predMap();
    56   p  = dfs_test.predMap();
    56   //  pn = dfs_test.predNodeMap();
    57   //  pn = dfs_test.predNodeMap();
    57   b  = dfs_test.reached(n);
    58   b  = dfs_test.reached(n);
    58 
    59 
       
    60   DirPath<Graph> pp(G);
       
    61   dfs_test.getPath(pp,n);
    59 }
    62 }
    60 
    63 
    61 
    64 
    62 void check_Dfs_Function_Compile() 
    65 void check_Dfs_Function_Compile() 
    63 {
    66 {
   100   t=ps.inner[0];
   103   t=ps.inner[0];
   101   
   104   
   102   Dfs<Graph> dfs_test(G);
   105   Dfs<Graph> dfs_test(G);
   103   dfs_test.run(s);  
   106   dfs_test.run(s);  
   104   
   107   
       
   108   DirPath<Graph> p(G);
       
   109   check(dfs_test.getPath(p,t),"getPath() failed to set the path.");
       
   110   check(p.length()==dfs_test.dist(t),"getPath() found a wrong path.");
       
   111   
   105   for(NodeIt v(G); v!=INVALID; ++v) {
   112   for(NodeIt v(G); v!=INVALID; ++v) {
   106     check(dfs_test.reached(v),"Each node should be reached.");
   113     check(dfs_test.reached(v),"Each node should be reached.");
   107     if ( dfs_test.pred(v)!=INVALID ) {
   114     if ( dfs_test.pred(v)!=INVALID ) {
   108       Edge e=dfs_test.pred(v);
   115       Edge e=dfs_test.pred(v);
   109       Node u=G.source(e);
   116       Node u=G.source(e);