1.1 --- a/test/bfs_test.cc Tue Apr 14 10:40:33 2009 +0100
1.2 +++ b/test/bfs_test.cc Wed Apr 15 03:26:45 2009 +0200
1.3 @@ -58,41 +58,80 @@
1.4 typedef Digraph::Arc Arc;
1.5
1.6 Digraph G;
1.7 - Node s, t;
1.8 + Node s, t, n;
1.9 Arc e;
1.10 - int l;
1.11 + int l, i;
1.12 bool b;
1.13 BType::DistMap d(G);
1.14 BType::PredMap p(G);
1.15 Path<Digraph> pp;
1.16 + concepts::ReadMap<Node,bool> nm;
1.17
1.18 {
1.19 BType bfs_test(G);
1.20 + const BType& const_bfs_test = bfs_test;
1.21
1.22 bfs_test.run(s);
1.23 bfs_test.run(s,t);
1.24 bfs_test.run();
1.25
1.26 - l = bfs_test.dist(t);
1.27 - e = bfs_test.predArc(t);
1.28 - s = bfs_test.predNode(t);
1.29 - b = bfs_test.reached(t);
1.30 - d = bfs_test.distMap();
1.31 - p = bfs_test.predMap();
1.32 - pp = bfs_test.path(t);
1.33 + bfs_test.init();
1.34 + bfs_test.addSource(s);
1.35 + n = bfs_test.processNextNode();
1.36 + n = bfs_test.processNextNode(t, b);
1.37 + n = bfs_test.processNextNode(nm, n);
1.38 + n = const_bfs_test.nextNode();
1.39 + b = const_bfs_test.emptyQueue();
1.40 + i = const_bfs_test.queueSize();
1.41 +
1.42 + bfs_test.start();
1.43 + bfs_test.start(t);
1.44 + bfs_test.start(nm);
1.45 +
1.46 + l = const_bfs_test.dist(t);
1.47 + e = const_bfs_test.predArc(t);
1.48 + s = const_bfs_test.predNode(t);
1.49 + b = const_bfs_test.reached(t);
1.50 + d = const_bfs_test.distMap();
1.51 + p = const_bfs_test.predMap();
1.52 + pp = const_bfs_test.path(t);
1.53 }
1.54 {
1.55 BType
1.56 ::SetPredMap<concepts::ReadWriteMap<Node,Arc> >
1.57 ::SetDistMap<concepts::ReadWriteMap<Node,int> >
1.58 ::SetReachedMap<concepts::ReadWriteMap<Node,bool> >
1.59 + ::SetStandardProcessedMap
1.60 ::SetProcessedMap<concepts::WriteMap<Node,bool> >
1.61 - ::SetStandardProcessedMap
1.62 ::Create bfs_test(G);
1.63 +
1.64 + concepts::ReadWriteMap<Node,Arc> pred_map;
1.65 + concepts::ReadWriteMap<Node,int> dist_map;
1.66 + concepts::ReadWriteMap<Node,bool> reached_map;
1.67 + concepts::WriteMap<Node,bool> processed_map;
1.68 +
1.69 + bfs_test
1.70 + .predMap(pred_map)
1.71 + .distMap(dist_map)
1.72 + .reachedMap(reached_map)
1.73 + .processedMap(processed_map);
1.74
1.75 bfs_test.run(s);
1.76 bfs_test.run(s,t);
1.77 bfs_test.run();
1.78 +
1.79 + bfs_test.init();
1.80 + bfs_test.addSource(s);
1.81 + n = bfs_test.processNextNode();
1.82 + n = bfs_test.processNextNode(t, b);
1.83 + n = bfs_test.processNextNode(nm, n);
1.84 + n = bfs_test.nextNode();
1.85 + b = bfs_test.emptyQueue();
1.86 + i = bfs_test.queueSize();
1.87 +
1.88 + bfs_test.start();
1.89 + bfs_test.start(t);
1.90 + bfs_test.start(nm);
1.91
1.92 l = bfs_test.dist(t);
1.93 e = bfs_test.predArc(t);
2.1 --- a/test/circulation_test.cc Tue Apr 14 10:40:33 2009 +0100
2.2 +++ b/test/circulation_test.cc Wed Apr 15 03:26:45 2009 +0200
2.3 @@ -71,27 +71,34 @@
2.4 DeltaMap delta;
2.5 FlowMap flow;
2.6 BarrierMap bar;
2.7 + VType v;
2.8 + bool b;
2.9
2.10 - Circulation<Digraph, CapMap, CapMap, DeltaMap>
2.11 - ::SetFlowMap<FlowMap>
2.12 - ::SetElevator<Elev>
2.13 - ::SetStandardElevator<LinkedElev>
2.14 - ::Create circ_test(g,lcap,ucap,delta);
2.15 -
2.16 - circ_test.lowerCapMap(lcap);
2.17 - circ_test.upperCapMap(ucap);
2.18 - circ_test.deltaMap(delta);
2.19 - flow = circ_test.flowMap();
2.20 - circ_test.flowMap(flow);
2.21 + typedef Circulation<Digraph, CapMap, CapMap, DeltaMap>
2.22 + ::SetFlowMap<FlowMap>
2.23 + ::SetElevator<Elev>
2.24 + ::SetStandardElevator<LinkedElev>
2.25 + ::Create CirculationType;
2.26 + CirculationType circ_test(g, lcap, ucap, delta);
2.27 + const CirculationType& const_circ_test = circ_test;
2.28 +
2.29 + circ_test
2.30 + .lowerCapMap(lcap)
2.31 + .upperCapMap(ucap)
2.32 + .deltaMap(delta)
2.33 + .flowMap(flow);
2.34
2.35 circ_test.init();
2.36 circ_test.greedyInit();
2.37 circ_test.start();
2.38 circ_test.run();
2.39
2.40 - circ_test.barrier(n);
2.41 - circ_test.barrierMap(bar);
2.42 - circ_test.flow(a);
2.43 + v = const_circ_test.flow(a);
2.44 + const FlowMap& fm = const_circ_test.flowMap();
2.45 + b = const_circ_test.barrier(n);
2.46 + const_circ_test.barrierMap(bar);
2.47 +
2.48 + ignore_unused_variable_warning(fm);
2.49 }
2.50
2.51 template <class G, class LM, class UM, class DM>
3.1 --- a/test/dfs_test.cc Tue Apr 14 10:40:33 2009 +0100
3.2 +++ b/test/dfs_test.cc Wed Apr 15 03:26:45 2009 +0200
3.3 @@ -62,39 +62,74 @@
3.4 Digraph G;
3.5 Node s, t;
3.6 Arc e;
3.7 - int l;
3.8 + int l, i;
3.9 bool b;
3.10 DType::DistMap d(G);
3.11 DType::PredMap p(G);
3.12 Path<Digraph> pp;
3.13 + concepts::ReadMap<Arc,bool> am;
3.14
3.15 {
3.16 DType dfs_test(G);
3.17 + const DType& const_dfs_test = dfs_test;
3.18
3.19 dfs_test.run(s);
3.20 dfs_test.run(s,t);
3.21 dfs_test.run();
3.22
3.23 - l = dfs_test.dist(t);
3.24 - e = dfs_test.predArc(t);
3.25 - s = dfs_test.predNode(t);
3.26 - b = dfs_test.reached(t);
3.27 - d = dfs_test.distMap();
3.28 - p = dfs_test.predMap();
3.29 - pp = dfs_test.path(t);
3.30 + dfs_test.init();
3.31 + dfs_test.addSource(s);
3.32 + e = dfs_test.processNextArc();
3.33 + e = const_dfs_test.nextArc();
3.34 + b = const_dfs_test.emptyQueue();
3.35 + i = const_dfs_test.queueSize();
3.36 +
3.37 + dfs_test.start();
3.38 + dfs_test.start(t);
3.39 + dfs_test.start(am);
3.40 +
3.41 + l = const_dfs_test.dist(t);
3.42 + e = const_dfs_test.predArc(t);
3.43 + s = const_dfs_test.predNode(t);
3.44 + b = const_dfs_test.reached(t);
3.45 + d = const_dfs_test.distMap();
3.46 + p = const_dfs_test.predMap();
3.47 + pp = const_dfs_test.path(t);
3.48 }
3.49 {
3.50 DType
3.51 ::SetPredMap<concepts::ReadWriteMap<Node,Arc> >
3.52 ::SetDistMap<concepts::ReadWriteMap<Node,int> >
3.53 ::SetReachedMap<concepts::ReadWriteMap<Node,bool> >
3.54 + ::SetStandardProcessedMap
3.55 ::SetProcessedMap<concepts::WriteMap<Node,bool> >
3.56 - ::SetStandardProcessedMap
3.57 ::Create dfs_test(G);
3.58
3.59 + concepts::ReadWriteMap<Node,Arc> pred_map;
3.60 + concepts::ReadWriteMap<Node,int> dist_map;
3.61 + concepts::ReadWriteMap<Node,bool> reached_map;
3.62 + concepts::WriteMap<Node,bool> processed_map;
3.63 +
3.64 + dfs_test
3.65 + .predMap(pred_map)
3.66 + .distMap(dist_map)
3.67 + .reachedMap(reached_map)
3.68 + .processedMap(processed_map);
3.69 +
3.70 dfs_test.run(s);
3.71 dfs_test.run(s,t);
3.72 dfs_test.run();
3.73 + dfs_test.init();
3.74 +
3.75 + dfs_test.addSource(s);
3.76 + e = dfs_test.processNextArc();
3.77 + e = dfs_test.nextArc();
3.78 + b = dfs_test.emptyQueue();
3.79 + i = dfs_test.queueSize();
3.80 +
3.81 + dfs_test.start();
3.82 + dfs_test.start(t);
3.83 + dfs_test.start(am);
3.84
3.85 l = dfs_test.dist(t);
3.86 e = dfs_test.predArc(t);
4.1 --- a/test/dijkstra_test.cc Tue Apr 14 10:40:33 2009 +0100
4.2 +++ b/test/dijkstra_test.cc Wed Apr 15 03:26:45 2009 +0200
4.3 @@ -60,48 +60,94 @@
4.4 typedef Digraph::Arc Arc;
4.5
4.6 Digraph G;
4.7 - Node s, t;
4.8 + Node s, t, n;
4.9 Arc e;
4.10 VType l;
4.11 + int i;
4.12 bool b;
4.13 DType::DistMap d(G);
4.14 DType::PredMap p(G);
4.15 LengthMap length;
4.16 Path<Digraph> pp;
4.17 + concepts::ReadMap<Node,bool> nm;
4.18
4.19 {
4.20 DType dijkstra_test(G,length);
4.21 + const DType& const_dijkstra_test = dijkstra_test;
4.22
4.23 dijkstra_test.run(s);
4.24 dijkstra_test.run(s,t);
4.25
4.26 + dijkstra_test.init();
4.27 + dijkstra_test.addSource(s);
4.28 + dijkstra_test.addSource(s, 1);
4.29 + n = dijkstra_test.processNextNode();
4.30 + n = const_dijkstra_test.nextNode();
4.31 + b = const_dijkstra_test.emptyQueue();
4.32 + i = const_dijkstra_test.queueSize();
4.33 +
4.34 + dijkstra_test.start();
4.35 + dijkstra_test.start(t);
4.36 + dijkstra_test.start(nm);
4.37 +
4.38 + l = const_dijkstra_test.dist(t);
4.39 + e = const_dijkstra_test.predArc(t);
4.40 + s = const_dijkstra_test.predNode(t);
4.41 + b = const_dijkstra_test.reached(t);
4.42 + b = const_dijkstra_test.processed(t);
4.43 + d = const_dijkstra_test.distMap();
4.44 + p = const_dijkstra_test.predMap();
4.45 + pp = const_dijkstra_test.path(t);
4.46 + l = const_dijkstra_test.currentDist(t);
4.47 + }
4.48 + {
4.49 + DType
4.50 + ::SetPredMap<concepts::ReadWriteMap<Node,Arc> >
4.51 + ::SetDistMap<concepts::ReadWriteMap<Node,VType> >
4.52 + ::SetStandardProcessedMap
4.53 + ::SetProcessedMap<concepts::WriteMap<Node,bool> >
4.54 + ::SetOperationTraits<DijkstraDefaultOperationTraits<VType> >
4.55 + ::SetHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > >
4.56 + ::SetStandardHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > >
4.57 + ::SetHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> >,
4.58 + concepts::ReadWriteMap<Node,int> >
4.59 + ::Create dijkstra_test(G,length);
4.60 +
4.61 + LengthMap length_map;
4.62 + concepts::ReadWriteMap<Node,Arc> pred_map;
4.63 + concepts::ReadWriteMap<Node,VType> dist_map;
4.64 + concepts::WriteMap<Node,bool> processed_map;
4.65 + concepts::ReadWriteMap<Node,int> heap_cross_ref;
4.66 + BinHeap<VType, concepts::ReadWriteMap<Node,int> > heap(heap_cross_ref);
4.67 +
4.68 + dijkstra_test
4.69 + .lengthMap(length_map)
4.70 + .predMap(pred_map)
4.71 + .distMap(dist_map)
4.72 + .processedMap(processed_map)
4.73 + .heap(heap, heap_cross_ref);
4.74 +
4.75 + dijkstra_test.run(s);
4.76 + dijkstra_test.run(s,t);
4.77 +
4.78 + dijkstra_test.addSource(s);
4.79 + dijkstra_test.addSource(s, 1);
4.80 + n = dijkstra_test.processNextNode();
4.81 + n = dijkstra_test.nextNode();
4.82 + b = dijkstra_test.emptyQueue();
4.83 + i = dijkstra_test.queueSize();
4.84 +
4.85 + dijkstra_test.start();
4.86 + dijkstra_test.start(t);
4.87 + dijkstra_test.start(nm);
4.88 +
4.89 l = dijkstra_test.dist(t);
4.90 e = dijkstra_test.predArc(t);
4.91 s = dijkstra_test.predNode(t);
4.92 b = dijkstra_test.reached(t);
4.93 - d = dijkstra_test.distMap();
4.94 - p = dijkstra_test.predMap();
4.95 + b = dijkstra_test.processed(t);
4.96 pp = dijkstra_test.path(t);
4.97 - }
4.98 - {
4.99 - DType
4.100 - ::SetPredMap<concepts::ReadWriteMap<Node,Arc> >
4.101 - ::SetDistMap<concepts::ReadWriteMap<Node,VType> >
4.102 - ::SetProcessedMap<concepts::WriteMap<Node,bool> >
4.103 - ::SetStandardProcessedMap
4.104 - ::SetOperationTraits<DijkstraDefaultOperationTraits<VType> >
4.105 - ::SetHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > >
4.106 - ::SetStandardHeap<BinHeap<VType, concepts::ReadWriteMap<Node,int> > >
4.107 - ::Create dijkstra_test(G,length);
4.108 -
4.109 - dijkstra_test.run(s);
4.110 - dijkstra_test.run(s,t);
4.111 -
4.112 - l = dijkstra_test.dist(t);
4.113 - e = dijkstra_test.predArc(t);
4.114 - s = dijkstra_test.predNode(t);
4.115 - b = dijkstra_test.reached(t);
4.116 - pp = dijkstra_test.path(t);
4.117 + l = dijkstra_test.currentDist(t);
4.118 }
4.119
4.120 }
5.1 --- a/test/preflow_test.cc Tue Apr 14 10:40:33 2009 +0100
5.2 +++ b/test/preflow_test.cc Wed Apr 15 03:26:45 2009 +0200
5.3 @@ -84,18 +84,22 @@
5.4 CapMap cap;
5.5 FlowMap flow;
5.6 CutMap cut;
5.7 + VType v;
5.8 + bool b;
5.9
5.10 - Preflow<Digraph, CapMap>
5.11 - ::SetFlowMap<FlowMap>
5.12 - ::SetElevator<Elev>
5.13 - ::SetStandardElevator<LinkedElev>
5.14 - ::Create preflow_test(g,cap,n,n);
5.15 + typedef Preflow<Digraph, CapMap>
5.16 + ::SetFlowMap<FlowMap>
5.17 + ::SetElevator<Elev>
5.18 + ::SetStandardElevator<LinkedElev>
5.19 + ::Create PreflowType;
5.20 + PreflowType preflow_test(g, cap, n, n);
5.21 + const PreflowType& const_preflow_test = preflow_test;
5.22
5.23 - preflow_test.capacityMap(cap);
5.24 - flow = preflow_test.flowMap();
5.25 - preflow_test.flowMap(flow);
5.26 - preflow_test.source(n);
5.27 - preflow_test.target(n);
5.28 + preflow_test
5.29 + .capacityMap(cap)
5.30 + .flowMap(flow)
5.31 + .source(n)
5.32 + .target(n);
5.33
5.34 preflow_test.init();
5.35 preflow_test.init(cap);
5.36 @@ -104,11 +108,13 @@
5.37 preflow_test.run();
5.38 preflow_test.runMinCut();
5.39
5.40 - preflow_test.flowValue();
5.41 - preflow_test.minCut(n);
5.42 - preflow_test.minCutMap(cut);
5.43 - preflow_test.flow(e);
5.44 -
5.45 + v = const_preflow_test.flowValue();
5.46 + v = const_preflow_test.flow(e);
5.47 + const FlowMap& fm = const_preflow_test.flowMap();
5.48 + b = const_preflow_test.minCut(n);
5.49 + const_preflow_test.minCutMap(cut);
5.50 +
5.51 + ignore_unused_variable_warning(fm);
5.52 }
5.53
5.54 int cutValue (const SmartDigraph& g,