44 void checkGraphRedNodeList(const Graph &G, int cnt) |
44 void checkGraphRedNodeList(const Graph &G, int cnt) |
45 { |
45 { |
46 typename Graph::RedIt n(G); |
46 typename Graph::RedIt n(G); |
47 for(int i=0;i<cnt;i++) { |
47 for(int i=0;i<cnt;i++) { |
48 check(n!=INVALID,"Wrong red Node list linking."); |
48 check(n!=INVALID,"Wrong red Node list linking."); |
|
49 check(G.red(n),"Wrong node set check."); |
|
50 check(!G.blue(n),"Wrong node set check."); |
|
51 typename Graph::Node nn = n; |
|
52 check(G.asRedNodeUnsafe(nn) == n,"Wrong node conversion."); |
|
53 check(G.asRedNode(nn) == n,"Wrong node conversion."); |
|
54 check(G.asBlueNode(nn) == INVALID,"Wrong node conversion."); |
|
55 std::pair<typename Graph::RedNode, typename Graph::BlueNode> rbn = |
|
56 G.asRedBlueNode(nn); |
|
57 check(rbn.first == n,"Wrong node conversion."); |
|
58 check(rbn.second == INVALID,"Wrong node conversion."); |
49 ++n; |
59 ++n; |
50 } |
60 } |
51 check(n==INVALID,"Wrong red Node list linking."); |
61 check(n==INVALID,"Wrong red Node list linking."); |
52 check(countRedNodes(G)==cnt,"Wrong red Node number."); |
62 check(countRedNodes(G)==cnt,"Wrong red Node number."); |
53 } |
63 } |
56 void checkGraphBlueNodeList(const Graph &G, int cnt) |
66 void checkGraphBlueNodeList(const Graph &G, int cnt) |
57 { |
67 { |
58 typename Graph::BlueIt n(G); |
68 typename Graph::BlueIt n(G); |
59 for(int i=0;i<cnt;i++) { |
69 for(int i=0;i<cnt;i++) { |
60 check(n!=INVALID,"Wrong blue Node list linking."); |
70 check(n!=INVALID,"Wrong blue Node list linking."); |
|
71 check(G.blue(n),"Wrong node set check."); |
|
72 check(!G.red(n),"Wrong node set check."); |
|
73 typename Graph::Node nn = n; |
|
74 check(G.asBlueNodeUnsafe(nn) == n,"Wrong node conversion."); |
|
75 check(G.asBlueNode(nn) == n,"Wrong node conversion."); |
|
76 check(G.asRedNode(nn) == INVALID,"Wrong node conversion."); |
|
77 std::pair<typename Graph::RedNode, typename Graph::BlueNode> rbn = |
|
78 G.asRedBlueNode(nn); |
|
79 check(rbn.first == INVALID,"Wrong node conversion."); |
|
80 check(rbn.second == n,"Wrong node conversion."); |
61 ++n; |
81 ++n; |
62 } |
82 } |
63 check(n==INVALID,"Wrong blue Node list linking."); |
83 check(n==INVALID,"Wrong blue Node list linking."); |
64 check(countBlueNodes(G)==cnt,"Wrong blue Node number."); |
84 check(countBlueNodes(G)==cnt,"Wrong blue Node number."); |
65 } |
85 } |
205 void checkRedNodeIds(const Graph& G) { |
225 void checkRedNodeIds(const Graph& G) { |
206 typedef typename Graph::RedNode RedNode; |
226 typedef typename Graph::RedNode RedNode; |
207 std::set<int> values; |
227 std::set<int> values; |
208 for (typename Graph::RedIt n(G); n != INVALID; ++n) { |
228 for (typename Graph::RedIt n(G); n != INVALID; ++n) { |
209 check(G.red(n), "Wrong partition"); |
229 check(G.red(n), "Wrong partition"); |
210 check(G.redId(n) == G.id(RedNode(n)), "Wrong id"); |
230 check(values.find(G.id(n)) == values.end(), "Wrong id"); |
211 check(values.find(G.redId(n)) == values.end(), "Wrong id"); |
231 check(G.id(n) <= G.maxRedId(), "Wrong maximum id"); |
212 check(G.redId(n) <= G.maxRedId(), "Wrong maximum id"); |
|
213 values.insert(G.id(n)); |
232 values.insert(G.id(n)); |
214 } |
233 } |
215 check(G.maxId(RedNode()) == G.maxRedId(), "Wrong maximum id"); |
234 check(G.maxId(RedNode()) == G.maxRedId(), "Wrong maximum id"); |
216 } |
235 } |
217 |
236 |
219 void checkBlueNodeIds(const Graph& G) { |
238 void checkBlueNodeIds(const Graph& G) { |
220 typedef typename Graph::BlueNode BlueNode; |
239 typedef typename Graph::BlueNode BlueNode; |
221 std::set<int> values; |
240 std::set<int> values; |
222 for (typename Graph::BlueIt n(G); n != INVALID; ++n) { |
241 for (typename Graph::BlueIt n(G); n != INVALID; ++n) { |
223 check(G.blue(n), "Wrong partition"); |
242 check(G.blue(n), "Wrong partition"); |
224 check(G.blueId(n) == G.id(BlueNode(n)), "Wrong id"); |
243 check(values.find(G.id(n)) == values.end(), "Wrong id"); |
225 check(values.find(G.blueId(n)) == values.end(), "Wrong id"); |
244 check(G.id(n) <= G.maxBlueId(), "Wrong maximum id"); |
226 check(G.blueId(n) <= G.maxBlueId(), "Wrong maximum id"); |
|
227 values.insert(G.id(n)); |
245 values.insert(G.id(n)); |
228 } |
246 } |
229 check(G.maxId(BlueNode()) == G.maxBlueId(), "Wrong maximum id"); |
247 check(G.maxId(BlueNode()) == G.maxBlueId(), "Wrong maximum id"); |
230 } |
248 } |
231 |
249 |