Changeset 278:931190050520 in lemon1.0 for test
 Timestamp:
 09/22/08 15:33:23 (11 years ago)
 Branch:
 default
 Phase:
 public
 Location:
 test
 Files:

 3 edited
Legend:
 Unmodified
 Added
 Removed

test/bfs_test.cc
r228 r278 63 63 BType::DistMap d(G); 64 64 BType::PredMap p(G); 65 // BType::PredNodeMap pn(G);66 65 67 66 BType bfs_test(G); … … 73 72 n = bfs_test.predNode(n); 74 73 d = bfs_test.distMap(); 75 76 74 p = bfs_test.predMap(); 77 // pn = bfs_test.predNodeMap();78 75 b = bfs_test.reached(n); 79 76 … … 89 86 90 87 Digraph g; 91 bfs(g,Node()).run(); 92 bfs(g).source(Node()).run(); 88 bool b; 89 bfs(g).run(Node()); 90 b=bfs(g).run(Node(),Node()); 91 bfs(g).run(); 93 92 bfs(g) 94 .predMap(concepts:: WriteMap<Node,Arc>())95 .distMap(concepts:: WriteMap<Node,VType>())93 .predMap(concepts::ReadWriteMap<Node,Arc>()) 94 .distMap(concepts::ReadWriteMap<Node,VType>()) 96 95 .reachedMap(concepts::ReadWriteMap<Node,bool>()) 97 96 .processedMap(concepts::WriteMap<Node,bool>()) 98 97 .run(Node()); 98 b=bfs(g) 99 .predMap(concepts::ReadWriteMap<Node,Arc>()) 100 .distMap(concepts::ReadWriteMap<Node,VType>()) 101 .reachedMap(concepts::ReadWriteMap<Node,bool>()) 102 .processedMap(concepts::WriteMap<Node,bool>()) 103 .path(concepts::Path<Digraph>()) 104 .dist(VType()) 105 .run(Node(),Node()); 106 bfs(g) 107 .predMap(concepts::ReadWriteMap<Node,Arc>()) 108 .distMap(concepts::ReadWriteMap<Node,VType>()) 109 .reachedMap(concepts::ReadWriteMap<Node,bool>()) 110 .processedMap(concepts::WriteMap<Node,bool>()) 111 .run(); 99 112 } 100 113 … … 115 128 bfs_test.run(s); 116 129 117 check(bfs_test.dist(t)==2,"Bfs found a wrong path." << bfs_test.dist(t));130 check(bfs_test.dist(t)==2,"Bfs found a wrong path."); 118 131 119 132 Path<Digraph> p = bfs_test.path(t); … … 129 142 check( !bfs_test.reached(u)  130 143 (bfs_test.dist(v) <= bfs_test.dist(u)+1), 131 "Wrong output. " << G.id(v) << ' ' << G.id(u));144 "Wrong output. " << G.id(u) << ">" << G.id(v)); 132 145 } 133 146 … … 141 154 check(bfs_test.dist(v)  bfs_test.dist(u) == 1, 142 155 "Wrong distance. Difference: " 143 << std::abs(bfs_test.dist(v)  bfs_test.dist(u) 144  1)); 156 << std::abs(bfs_test.dist(v)  bfs_test.dist(u)  1)); 145 157 } 146 158 } 159 } 160 161 { 162 NullMap<Node,Arc> myPredMap; 163 bfs(G).predMap(myPredMap).run(s); 147 164 } 148 165 } 
test/dfs_test.cc
r228 r278 21 21 #include <lemon/list_graph.h> 22 22 #include <lemon/lgf_reader.h> 23 24 23 #include <lemon/dfs.h> 25 24 #include <lemon/path.h> … … 89 88 90 89 Digraph g; 91 dfs(g,Node()).run(); 92 dfs(g).source(Node()).run(); 90 bool b; 91 dfs(g).run(Node()); 92 b=dfs(g).run(Node(),Node()); 93 dfs(g).run(); 93 94 dfs(g) 94 .predMap(concepts:: WriteMap<Node,Arc>())95 .distMap(concepts:: WriteMap<Node,VType>())95 .predMap(concepts::ReadWriteMap<Node,Arc>()) 96 .distMap(concepts::ReadWriteMap<Node,VType>()) 96 97 .reachedMap(concepts::ReadWriteMap<Node,bool>()) 97 98 .processedMap(concepts::WriteMap<Node,bool>()) 98 99 .run(Node()); 100 b=dfs(g) 101 .predMap(concepts::ReadWriteMap<Node,Arc>()) 102 .distMap(concepts::ReadWriteMap<Node,VType>()) 103 .reachedMap(concepts::ReadWriteMap<Node,bool>()) 104 .processedMap(concepts::WriteMap<Node,bool>()) 105 .path(concepts::Path<Digraph>()) 106 .dist(VType()) 107 .run(Node(),Node()); 108 dfs(g) 109 .predMap(concepts::ReadWriteMap<Node,Arc>()) 110 .distMap(concepts::ReadWriteMap<Node,VType>()) 111 .reachedMap(concepts::ReadWriteMap<Node,bool>()) 112 .processedMap(concepts::WriteMap<Node,bool>()) 113 .run(); 99 114 } 100 115 … … 130 145 check(dfs_test.dist(v)  dfs_test.dist(u) == 1, 131 146 "Wrong distance. (" << dfs_test.dist(u) << ">" 132 << dfs_test.dist(v) << ')');147 << dfs_test.dist(v) << ")"); 133 148 } 134 149 } 150 } 151 152 { 153 NullMap<Node,Arc> myPredMap; 154 dfs(G).predMap(myPredMap).run(s); 135 155 } 136 156 } 
test/dijkstra_test.cc
r228 r278 21 21 #include <lemon/list_graph.h> 22 22 #include <lemon/lgf_reader.h> 23 24 23 #include <lemon/dijkstra.h> 25 24 #include <lemon/path.h> … … 65 64 DType::DistMap d(G); 66 65 DType::PredMap p(G); 67 // DType::PredNodeMap pn(G);68 66 LengthMap length; 69 67 … … 77 75 d = dijkstra_test.distMap(); 78 76 p = dijkstra_test.predMap(); 79 // pn = dijkstra_test.predNodeMap();80 77 b = dijkstra_test.reached(n); 81 78 … … 92 89 93 90 Digraph g; 94 dijkstra(g,LengthMap(),Node()).run(); 95 dijkstra(g,LengthMap()).source(Node()).run(); 91 bool b; 92 dijkstra(g,LengthMap()).run(Node()); 93 b=dijkstra(g,LengthMap()).run(Node(),Node()); 96 94 dijkstra(g,LengthMap()) 97 .predMap(concepts::WriteMap<Node,Arc>()) 98 .distMap(concepts::WriteMap<Node,VType>()) 95 .predMap(concepts::ReadWriteMap<Node,Arc>()) 96 .distMap(concepts::ReadWriteMap<Node,VType>()) 97 .processedMap(concepts::WriteMap<Node,bool>()) 99 98 .run(Node()); 99 b=dijkstra(g,LengthMap()) 100 .predMap(concepts::ReadWriteMap<Node,Arc>()) 101 .distMap(concepts::ReadWriteMap<Node,VType>()) 102 .processedMap(concepts::WriteMap<Node,bool>()) 103 .path(concepts::Path<Digraph>()) 104 .dist(VType()) 105 .run(Node(),Node()); 100 106 } 101 107 … … 123 129 124 130 Path<Digraph> p = dijkstra_test.path(t); 125 check(p.length()==3," getPath() found a wrong path.");131 check(p.length()==3,"path() found a wrong path."); 126 132 check(checkPath(G, p),"path() found a wrong path."); 127 133 check(pathSource(G, p) == s,"path() found a wrong path."); … … 133 139 check( !dijkstra_test.reached(u)  134 140 (dijkstra_test.dist(v)  dijkstra_test.dist(u) <= length[e]), 135 " dist(target)dist(source)arc_length=" <<141 "Wrong output. dist(target)dist(source)arc_length=" << 136 142 dijkstra_test.dist(v)  dijkstra_test.dist(u)  length[e]); 137 143 }
Note: See TracChangeset
for help on using the changeset viewer.