diff -r c691064dfd4f -r 931190050520 test/bfs_test.cc --- a/test/bfs_test.cc Thu Sep 11 11:10:44 2008 +0100 +++ b/test/bfs_test.cc Mon Sep 22 15:33:23 2008 +0200 @@ -62,7 +62,6 @@ bool b; BType::DistMap d(G); BType::PredMap p(G); - // BType::PredNodeMap pn(G); BType bfs_test(G); @@ -72,9 +71,7 @@ e = bfs_test.predArc(n); n = bfs_test.predNode(n); d = bfs_test.distMap(); - p = bfs_test.predMap(); - // pn = bfs_test.predNodeMap(); b = bfs_test.reached(n); Path pp = bfs_test.path(n); @@ -88,14 +85,30 @@ typedef Digraph::Node Node; Digraph g; - bfs(g,Node()).run(); - bfs(g).source(Node()).run(); + bool b; + bfs(g).run(Node()); + b=bfs(g).run(Node(),Node()); + bfs(g).run(); bfs(g) - .predMap(concepts::WriteMap()) - .distMap(concepts::WriteMap()) + .predMap(concepts::ReadWriteMap()) + .distMap(concepts::ReadWriteMap()) .reachedMap(concepts::ReadWriteMap()) .processedMap(concepts::WriteMap()) .run(Node()); + b=bfs(g) + .predMap(concepts::ReadWriteMap()) + .distMap(concepts::ReadWriteMap()) + .reachedMap(concepts::ReadWriteMap()) + .processedMap(concepts::WriteMap()) + .path(concepts::Path()) + .dist(VType()) + .run(Node(),Node()); + bfs(g) + .predMap(concepts::ReadWriteMap()) + .distMap(concepts::ReadWriteMap()) + .reachedMap(concepts::ReadWriteMap()) + .processedMap(concepts::WriteMap()) + .run(); } template @@ -114,7 +127,7 @@ Bfs bfs_test(G); bfs_test.run(s); - check(bfs_test.dist(t)==2,"Bfs found a wrong path." << bfs_test.dist(t)); + check(bfs_test.dist(t)==2,"Bfs found a wrong path."); Path p = bfs_test.path(t); check(p.length()==2,"path() found a wrong path."); @@ -128,7 +141,7 @@ Node v=G.target(a); check( !bfs_test.reached(u) || (bfs_test.dist(v) <= bfs_test.dist(u)+1), - "Wrong output." << G.id(v) << ' ' << G.id(u)); + "Wrong output. " << G.id(u) << "->" << G.id(v)); } for(NodeIt v(G); v!=INVALID; ++v) { @@ -140,11 +153,15 @@ check(u==bfs_test.predNode(v),"Wrong tree."); check(bfs_test.dist(v) - bfs_test.dist(u) == 1, "Wrong distance. Difference: " - << std::abs(bfs_test.dist(v) - bfs_test.dist(u) - - 1)); + << std::abs(bfs_test.dist(v) - bfs_test.dist(u) - 1)); } } } + + { + NullMap myPredMap; + bfs(G).predMap(myPredMap).run(s); + } } int main()