1.1 --- a/test/bfs_test.cc Mon Jul 14 15:23:11 2008 +0100
1.2 +++ b/test/bfs_test.cc Fri Sep 26 09:52:28 2008 +0200
1.3 @@ -62,7 +62,6 @@
1.4 bool b;
1.5 BType::DistMap d(G);
1.6 BType::PredMap p(G);
1.7 - // BType::PredNodeMap pn(G);
1.8
1.9 BType bfs_test(G);
1.10
1.11 @@ -72,9 +71,7 @@
1.12 e = bfs_test.predArc(n);
1.13 n = bfs_test.predNode(n);
1.14 d = bfs_test.distMap();
1.15 -
1.16 p = bfs_test.predMap();
1.17 - // pn = bfs_test.predNodeMap();
1.18 b = bfs_test.reached(n);
1.19
1.20 Path<Digraph> pp = bfs_test.path(n);
1.21 @@ -88,14 +85,30 @@
1.22 typedef Digraph::Node Node;
1.23
1.24 Digraph g;
1.25 - bfs(g,Node()).run();
1.26 - bfs(g).source(Node()).run();
1.27 + bool b;
1.28 + bfs(g).run(Node());
1.29 + b=bfs(g).run(Node(),Node());
1.30 + bfs(g).run();
1.31 bfs(g)
1.32 - .predMap(concepts::WriteMap<Node,Arc>())
1.33 - .distMap(concepts::WriteMap<Node,VType>())
1.34 + .predMap(concepts::ReadWriteMap<Node,Arc>())
1.35 + .distMap(concepts::ReadWriteMap<Node,VType>())
1.36 .reachedMap(concepts::ReadWriteMap<Node,bool>())
1.37 .processedMap(concepts::WriteMap<Node,bool>())
1.38 .run(Node());
1.39 + b=bfs(g)
1.40 + .predMap(concepts::ReadWriteMap<Node,Arc>())
1.41 + .distMap(concepts::ReadWriteMap<Node,VType>())
1.42 + .reachedMap(concepts::ReadWriteMap<Node,bool>())
1.43 + .processedMap(concepts::WriteMap<Node,bool>())
1.44 + .path(concepts::Path<Digraph>())
1.45 + .dist(VType())
1.46 + .run(Node(),Node());
1.47 + bfs(g)
1.48 + .predMap(concepts::ReadWriteMap<Node,Arc>())
1.49 + .distMap(concepts::ReadWriteMap<Node,VType>())
1.50 + .reachedMap(concepts::ReadWriteMap<Node,bool>())
1.51 + .processedMap(concepts::WriteMap<Node,bool>())
1.52 + .run();
1.53 }
1.54
1.55 template <class Digraph>
1.56 @@ -114,7 +127,7 @@
1.57 Bfs<Digraph> bfs_test(G);
1.58 bfs_test.run(s);
1.59
1.60 - check(bfs_test.dist(t)==2,"Bfs found a wrong path." << bfs_test.dist(t));
1.61 + check(bfs_test.dist(t)==2,"Bfs found a wrong path.");
1.62
1.63 Path<Digraph> p = bfs_test.path(t);
1.64 check(p.length()==2,"path() found a wrong path.");
1.65 @@ -128,7 +141,7 @@
1.66 Node v=G.target(a);
1.67 check( !bfs_test.reached(u) ||
1.68 (bfs_test.dist(v) <= bfs_test.dist(u)+1),
1.69 - "Wrong output." << G.id(v) << ' ' << G.id(u));
1.70 + "Wrong output. " << G.id(u) << "->" << G.id(v));
1.71 }
1.72
1.73 for(NodeIt v(G); v!=INVALID; ++v) {
1.74 @@ -140,11 +153,15 @@
1.75 check(u==bfs_test.predNode(v),"Wrong tree.");
1.76 check(bfs_test.dist(v) - bfs_test.dist(u) == 1,
1.77 "Wrong distance. Difference: "
1.78 - << std::abs(bfs_test.dist(v) - bfs_test.dist(u)
1.79 - - 1));
1.80 + << std::abs(bfs_test.dist(v) - bfs_test.dist(u) - 1));
1.81 }
1.82 }
1.83 }
1.84 +
1.85 + {
1.86 + NullMap<Node,Arc> myPredMap;
1.87 + bfs(G).predMap(myPredMap).run(s);
1.88 + }
1.89 }
1.90
1.91 int main()