src/test/bfs_test.cc
changeset 1302 3f90ae31200a
parent 1220 20b26ee5812b
child 1359 1581f961cfaa
equal deleted inserted replaced
10:e9e7e22a0b34 11:0eafc9dcba69
    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/bfs.h>
    19 #include <lemon/bfs.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  = bfs_test.distMap();
    55   d  = bfs_test.distMap();
    55   p  = bfs_test.predMap();
    56   p  = bfs_test.predMap();
    56   //  pn = bfs_test.predNodeMap();
    57   //  pn = bfs_test.predNodeMap();
    57   b  = bfs_test.reached(n);
    58   b  = bfs_test.reached(n);
    58 
    59 
       
    60   DirPath<Graph> pp(G);
       
    61   bfs_test.getPath(pp,n);
    59 }
    62 }
    60 
    63 
    61 void check_Bfs_Function_Compile() 
    64 void check_Bfs_Function_Compile() 
    62 {
    65 {
    63   typedef int VType;
    66   typedef int VType;
   101   Bfs<Graph> bfs_test(G);
   104   Bfs<Graph> bfs_test(G);
   102   bfs_test.run(s);
   105   bfs_test.run(s);
   103   
   106   
   104   check(bfs_test.dist(t)==3,"Bfs found a wrong path. " << bfs_test.dist(t));
   107   check(bfs_test.dist(t)==3,"Bfs found a wrong path. " << bfs_test.dist(t));
   105 
   108 
       
   109   DirPath<Graph> p(G);
       
   110   check(bfs_test.getPath(p,t),"getPath() failed to set the path.");
       
   111   check(p.length()==3,"getPath() found a wrong path.");
       
   112   
   106 
   113 
   107   for(EdgeIt e(G); e==INVALID; ++e) {
   114   for(EdgeIt e(G); e==INVALID; ++e) {
   108     Node u=G.source(e);
   115     Node u=G.source(e);
   109     Node v=G.target(e);
   116     Node v=G.target(e);
   110     check( !bfs_test.reached(u) ||
   117     check( !bfs_test.reached(u) ||