Changeset 171:02f4d5d9bfd7 in lemon for test/bfs_test.cc
- Timestamp:
- 06/15/08 22:05:23 (16 years ago)
- Branch:
- default
- Children:
- 172:c94a80f38d7f, 173:b026e9779b28, 175:4eb8900a865c
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/bfs_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/bfs.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_Bfs_Compile() 30 void checkBfsCompile() 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 Bfs<Digraph> BType; 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 void check _Bfs_Function_Compile()59 void checkBfsFunctionCompile() 67 60 { 68 61 typedef int VType; 69 62 typedef concepts::Digraph Digraph; 70 71 63 typedef Digraph::Arc Arc; 72 64 typedef Digraph::Node Node; 73 typedef Digraph::ArcIt ArcIt;74 typedef Digraph::NodeIt NodeIt;75 typedef concepts::ReadMap<Arc,VType> LengthMap;76 65 77 66 Digraph g; … … 84 73 .processedMap(concepts::WriteMap<Node,bool>()) 85 74 .run(Node()); 86 87 75 } 88 76 89 int main() 90 { 91 92 // typedef SmartDigraph Digraph; 93 typedef ListDigraph Digraph; 94 95 typedef Digraph::Arc Arc; 96 typedef Digraph::Node Node; 97 typedef Digraph::ArcIt ArcIt; 98 typedef Digraph::NodeIt NodeIt; 99 typedef Digraph::ArcMap<int> LengthMap; 77 template <class Digraph> 78 void checkBfs() { 79 TEMPLATE_DIGRAPH_TYPEDEFS(Digraph); 100 80 101 81 Digraph G; 102 82 Node s, t; 103 PetStruct<Digraph> ps = addPetersen(G, PET_SIZE);83 PetStruct<Digraph> ps = addPetersen(G, 5); 104 84 105 85 s=ps.outer[2]; … … 109 89 bfs_test.run(s); 110 90 111 check(bfs_test.dist(t)==3,"Bfs found a wrong path. 91 check(bfs_test.dist(t)==3,"Bfs found a wrong path." << bfs_test.dist(t)); 112 92 113 93 Path<Digraph> p = bfs_test.path(t); 114 check(p.length()==3," getPath() found a wrong path.");94 check(p.length()==3,"path() found a wrong path."); 115 95 check(checkPath(G, p),"path() found a wrong path."); 116 96 check(pathSource(G, p) == s,"path() found a wrong path."); … … 140 120 } 141 121 122 int main() 123 { 124 checkBfs<ListDigraph>(); 125 checkBfs<SmartDigraph>(); 126 return 0; 127 }
Note: See TracChangeset
for help on using the changeset viewer.