Changeset 171:02f4d5d9bfd7 in lemon for test/dfs_test.cc
 Timestamp:
 06/15/08 22:05:23 (13 years ago)
 Branch:
 default
 Children:
 172:c94a80f38d7f, 173:b026e9779b28, 175:4eb8900a865c
 Phase:
 public
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

test/dfs_test.cc
r100 r171 17 17 */ 18 18 19 #include "test_tools.h"20 //#include <lemon/smart_graph.h>19 #include <lemon/concepts/digraph.h> 20 #include <lemon/smart_graph.h> 21 21 #include <lemon/list_graph.h> 22 22 #include <lemon/dfs.h> 23 23 #include <lemon/path.h> 24 #include <lemon/concepts/digraph.h> 24 25 #include "graph_test.h" 26 #include "test_tools.h" 25 27 26 28 using namespace lemon; 27 29 28 const int PET_SIZE =5; 29 30 31 void check_Dfs_SmartDigraph_Compile() 30 void checkDfsCompile() 32 31 { 33 32 typedef concepts::Digraph Digraph; 34 35 typedef Digraph::Arc Arc;36 typedef Digraph::Node Node;37 typedef Digraph::ArcIt ArcIt;38 typedef Digraph::NodeIt NodeIt;39 40 33 typedef Dfs<Digraph> DType; 41 34 42 35 Digraph G; 43 Node n;44 Arc e;36 Digraph::Node n; 37 Digraph::Arc e; 45 38 int l; 46 39 bool b; … … 64 57 } 65 58 66 67 void check_Dfs_Function_Compile() 59 void checkDfsFunctionCompile() 68 60 { 69 61 typedef int VType; 70 62 typedef concepts::Digraph Digraph; 71 72 63 typedef Digraph::Arc Arc; 73 64 typedef Digraph::Node Node; 74 typedef Digraph::ArcIt ArcIt;75 typedef Digraph::NodeIt NodeIt;76 typedef concepts::ReadMap<Arc,VType> LengthMap;77 65 78 66 Digraph g; … … 84 72 .reachedMap(concepts::ReadWriteMap<Node,bool>()) 85 73 .processedMap(concepts::WriteMap<Node,bool>()) 86 .run(Node()); 87 74 .run(Node()); 88 75 } 89 76 90 int main() 91 { 92 93 // typedef SmartDigraph Digraph; 94 typedef ListDigraph Digraph; 95 96 typedef Digraph::Arc Arc; 97 typedef Digraph::Node Node; 98 typedef Digraph::ArcIt ArcIt; 99 typedef Digraph::NodeIt NodeIt; 100 typedef Digraph::ArcMap<int> LengthMap; 77 template <class Digraph> 78 void checkDfs() { 79 TEMPLATE_DIGRAPH_TYPEDEFS(Digraph); 101 80 102 81 Digraph G; 103 82 Node s, t; 104 PetStruct<Digraph> ps = addPetersen(G, PET_SIZE);83 PetStruct<Digraph> ps = addPetersen(G, 5); 105 84 106 85 s=ps.outer[2]; … … 111 90 112 91 Path<Digraph> p = dfs_test.path(t); 113 check(p.length() ==dfs_test.dist(t),"path() found a wrong path.");92 check(p.length() == dfs_test.dist(t),"path() found a wrong path."); 114 93 check(checkPath(G, p),"path() found a wrong path."); 115 94 check(pathSource(G, p) == s,"path() found a wrong path."); … … 129 108 } 130 109 110 int main() 111 { 112 checkDfs<ListDigraph>(); 113 checkDfs<SmartDigraph>(); 114 return 0; 115 }
Note: See TracChangeset
for help on using the changeset viewer.