# HG changeset patch
# User Peter Kovacs <kpeter@inf.elte.hu>
# Date 1239754320 -7200
# Node ID f134d3e99740ae0509196607dd5f985be6738414
# Parent 99a31b399b599c78cc46644de96c74b5a031d71f
Better tests for query functions (#263)
diff --git a/test/bfs_test.cc b/test/bfs_test.cc
a
|
b
|
|
68 | 68 | |
69 | 69 | { |
70 | 70 | BType bfs_test(G); |
| 71 | const BType& const_bfs_test = bfs_test; |
71 | 72 | |
72 | 73 | bfs_test.run(s); |
73 | 74 | bfs_test.run(s,t); |
74 | 75 | bfs_test.run(); |
75 | 76 | |
76 | | l = bfs_test.dist(t); |
77 | | e = bfs_test.predArc(t); |
78 | | s = bfs_test.predNode(t); |
79 | | b = bfs_test.reached(t); |
80 | | d = bfs_test.distMap(); |
81 | | p = bfs_test.predMap(); |
82 | | pp = bfs_test.path(t); |
| 77 | l = const_bfs_test.dist(t); |
| 78 | e = const_bfs_test.predArc(t); |
| 79 | s = const_bfs_test.predNode(t); |
| 80 | b = const_bfs_test.reached(t); |
| 81 | d = const_bfs_test.distMap(); |
| 82 | p = const_bfs_test.predMap(); |
| 83 | pp = const_bfs_test.path(t); |
83 | 84 | } |
84 | 85 | { |
85 | 86 | BType |
diff --git a/test/circulation_test.cc b/test/circulation_test.cc
a
|
b
|
|
71 | 71 | DeltaMap delta; |
72 | 72 | FlowMap flow; |
73 | 73 | BarrierMap bar; |
| 74 | VType v; |
| 75 | bool b; |
74 | 76 | |
75 | | Circulation<Digraph, CapMap, CapMap, DeltaMap> |
76 | | ::SetFlowMap<FlowMap> |
77 | | ::SetElevator<Elev> |
78 | | ::SetStandardElevator<LinkedElev> |
79 | | ::Create circ_test(g,lcap,ucap,delta); |
80 | | |
81 | | circ_test.lowerCapMap(lcap); |
82 | | circ_test.upperCapMap(ucap); |
83 | | circ_test.deltaMap(delta); |
84 | | flow = circ_test.flowMap(); |
85 | | circ_test.flowMap(flow); |
| 77 | typedef Circulation<Digraph, CapMap, CapMap, DeltaMap> |
| 78 | ::SetFlowMap<FlowMap> |
| 79 | ::SetElevator<Elev> |
| 80 | ::SetStandardElevator<LinkedElev> |
| 81 | ::Create CirculationType; |
| 82 | CirculationType circ_test(g, lcap, ucap, delta); |
| 83 | const CirculationType& const_circ_test = circ_test; |
| 84 | |
| 85 | circ_test |
| 86 | .lowerCapMap(lcap) |
| 87 | .upperCapMap(ucap) |
| 88 | .deltaMap(delta) |
| 89 | .flowMap(flow); |
86 | 90 | |
87 | 91 | circ_test.init(); |
88 | 92 | circ_test.greedyInit(); |
89 | 93 | circ_test.start(); |
90 | 94 | circ_test.run(); |
91 | 95 | |
92 | | circ_test.barrier(n); |
93 | | circ_test.barrierMap(bar); |
94 | | circ_test.flow(a); |
| 96 | v = const_circ_test.flow(a); |
| 97 | const FlowMap& fm = const_circ_test.flowMap(); |
| 98 | b = const_circ_test.barrier(n); |
| 99 | const_circ_test.barrierMap(bar); |
| 100 | |
| 101 | ignore_unused_variable_warning(fm); |
95 | 102 | } |
96 | 103 | |
97 | 104 | template <class G, class LM, class UM, class DM> |
diff --git a/test/dfs_test.cc b/test/dfs_test.cc
a
|
b
|
|
70 | 70 | |
71 | 71 | { |
72 | 72 | DType dfs_test(G); |
| 73 | const DType& const_dfs_test = dfs_test; |
73 | 74 | |
74 | 75 | dfs_test.run(s); |
75 | 76 | dfs_test.run(s,t); |
76 | 77 | dfs_test.run(); |
77 | 78 | |
78 | | l = dfs_test.dist(t); |
79 | | e = dfs_test.predArc(t); |
80 | | s = dfs_test.predNode(t); |
81 | | b = dfs_test.reached(t); |
82 | | d = dfs_test.distMap(); |
83 | | p = dfs_test.predMap(); |
84 | | pp = dfs_test.path(t); |
| 79 | l = const_dfs_test.dist(t); |
| 80 | e = const_dfs_test.predArc(t); |
| 81 | s = const_dfs_test.predNode(t); |
| 82 | b = const_dfs_test.reached(t); |
| 83 | d = const_dfs_test.distMap(); |
| 84 | p = const_dfs_test.predMap(); |
| 85 | pp = const_dfs_test.path(t); |
85 | 86 | } |
86 | 87 | { |
87 | 88 | DType |
diff --git a/test/dijkstra_test.cc b/test/dijkstra_test.cc
a
|
b
|
|
71 | 71 | |
72 | 72 | { |
73 | 73 | DType dijkstra_test(G,length); |
| 74 | const DType& const_dijkstra_test = dijkstra_test; |
74 | 75 | |
75 | 76 | dijkstra_test.run(s); |
76 | 77 | dijkstra_test.run(s,t); |
77 | 78 | |
78 | | l = dijkstra_test.dist(t); |
79 | | e = dijkstra_test.predArc(t); |
80 | | s = dijkstra_test.predNode(t); |
81 | | b = dijkstra_test.reached(t); |
82 | | d = dijkstra_test.distMap(); |
83 | | p = dijkstra_test.predMap(); |
84 | | pp = dijkstra_test.path(t); |
| 79 | l = const_dijkstra_test.dist(t); |
| 80 | e = const_dijkstra_test.predArc(t); |
| 81 | s = const_dijkstra_test.predNode(t); |
| 82 | b = const_dijkstra_test.reached(t); |
| 83 | d = const_dijkstra_test.distMap(); |
| 84 | p = const_dijkstra_test.predMap(); |
| 85 | pp = const_dijkstra_test.path(t); |
85 | 86 | } |
86 | 87 | { |
87 | 88 | DType |
diff --git a/test/preflow_test.cc b/test/preflow_test.cc
a
|
b
|
|
84 | 84 | CapMap cap; |
85 | 85 | FlowMap flow; |
86 | 86 | CutMap cut; |
| 87 | VType v; |
| 88 | bool b; |
87 | 89 | |
88 | | Preflow<Digraph, CapMap> |
89 | | ::SetFlowMap<FlowMap> |
90 | | ::SetElevator<Elev> |
91 | | ::SetStandardElevator<LinkedElev> |
92 | | ::Create preflow_test(g,cap,n,n); |
| 90 | typedef Preflow<Digraph, CapMap> |
| 91 | ::SetFlowMap<FlowMap> |
| 92 | ::SetElevator<Elev> |
| 93 | ::SetStandardElevator<LinkedElev> |
| 94 | ::Create PreflowType; |
| 95 | PreflowType preflow_test(g, cap, n, n); |
| 96 | const PreflowType& const_preflow_test = preflow_test; |
93 | 97 | |
94 | | preflow_test.capacityMap(cap); |
95 | | flow = preflow_test.flowMap(); |
96 | | preflow_test.flowMap(flow); |
97 | | preflow_test.source(n); |
98 | | preflow_test.target(n); |
| 98 | preflow_test |
| 99 | .capacityMap(cap) |
| 100 | .flowMap(flow) |
| 101 | .source(n) |
| 102 | .target(n); |
99 | 103 | |
100 | 104 | preflow_test.init(); |
101 | 105 | preflow_test.init(cap); |
… |
… |
|
104 | 108 | preflow_test.run(); |
105 | 109 | preflow_test.runMinCut(); |
106 | 110 | |
107 | | preflow_test.flowValue(); |
108 | | preflow_test.minCut(n); |
109 | | preflow_test.minCutMap(cut); |
110 | | preflow_test.flow(e); |
111 | | |
| 111 | v = const_preflow_test.flowValue(); |
| 112 | v = const_preflow_test.flow(e); |
| 113 | const FlowMap& fm = const_preflow_test.flowMap(); |
| 114 | b = const_preflow_test.minCut(n); |
| 115 | const_preflow_test.minCutMap(cut); |
| 116 | |
| 117 | ignore_unused_variable_warning(fm); |
112 | 118 | } |
113 | 119 | |
114 | 120 | int cutValue (const SmartDigraph& g, |