Changeset 1193:c8fa41fcc4a7 in lemon for test/graph_copy_test.cc
- Timestamp:
- 12/01/11 09:05:47 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
test/graph_copy_test.cc
r1190 r1193 222 222 SmartBpGraph::EdgeMap<int> fem(from); 223 223 SmartBpGraph::Node fn = INVALID; 224 SmartBpGraph::RedNode frn = INVALID; 225 SmartBpGraph::BlueNode fbn = INVALID; 224 226 SmartBpGraph::Arc fa = INVALID; 225 227 SmartBpGraph::Edge fe = INVALID; 226 228 227 std::vector<SmartBpGraph:: Node> frnv;228 for (int i = 0; i < nn; ++i) { 229 SmartBpGraph:: Node node = from.addRedNode();229 std::vector<SmartBpGraph::RedNode> frnv; 230 for (int i = 0; i < nn; ++i) { 231 SmartBpGraph::RedNode node = from.addRedNode(); 230 232 frnv.push_back(node); 231 233 fnm[node] = i * i; 232 234 frnm[node] = i + i; 233 if (i == 0) fn = node; 234 } 235 236 std::vector<SmartBpGraph::Node> fbnv; 237 for (int i = 0; i < nn; ++i) { 238 SmartBpGraph::Node node = from.addBlueNode(); 235 if (i == 0) { 236 fn = node; 237 frn = node; 238 } 239 } 240 241 std::vector<SmartBpGraph::BlueNode> fbnv; 242 for (int i = 0; i < nn; ++i) { 243 SmartBpGraph::BlueNode node = from.addBlueNode(); 239 244 fbnv.push_back(node); 240 245 fnm[node] = i * i; 241 246 fbnm[node] = i + i; 247 if (i == 0) fbn = node; 242 248 } 243 249 … … 261 267 typename GR::template EdgeMap<int> tem(to); 262 268 typename GR::Node tn; 269 typename GR::RedNode trn; 270 typename GR::BlueNode tbn; 263 271 typename GR::Arc ta; 264 272 typename GR::Edge te; 265 273 266 274 SmartBpGraph::NodeMap<typename GR::Node> nr(from); 267 SmartBpGraph::RedMap<typename GR:: Node> rnr(from);268 SmartBpGraph::BlueMap<typename GR:: Node> bnr(from);275 SmartBpGraph::RedMap<typename GR::RedNode> rnr(from); 276 SmartBpGraph::BlueMap<typename GR::BlueNode> bnr(from); 269 277 SmartBpGraph::ArcMap<typename GR::Arc> ar(from); 270 278 SmartBpGraph::EdgeMap<typename GR::Edge> er(from); 271 279 272 280 typename GR::template NodeMap<SmartBpGraph::Node> ncr(to); 273 typename GR::template RedMap<SmartBpGraph:: Node> rncr(to);274 typename GR::template BlueMap<SmartBpGraph:: Node> bncr(to);281 typename GR::template RedMap<SmartBpGraph::RedNode> rncr(to); 282 typename GR::template BlueMap<SmartBpGraph::BlueNode> bncr(to); 275 283 typename GR::template ArcMap<SmartBpGraph::Arc> acr(to); 276 284 typename GR::template EdgeMap<SmartBpGraph::Edge> ecr(to); … … 283 291 nodeCrossRef(ncr).redCrossRef(rncr).blueCrossRef(bncr). 284 292 arcCrossRef(acr).edgeCrossRef(ecr). 285 node(fn, tn).arc(fa, ta).edge(fe, te).run(); 293 node(fn, tn).redNode(frn, trn).blueNode(fbn, tbn). 294 arc(fa, ta).edge(fe, te).run(); 286 295 287 296 check(countNodes(from) == countNodes(to), "Wrong copy."); … … 294 303 check(ncr[nr[it]] == it, "Wrong copy."); 295 304 check(fnm[it] == tnm[nr[it]], "Wrong copy."); 296 if (from.red(it)) { 297 check(rnr[it] == nr[it], "Wrong copy."); 298 check(rncr[rnr[it]] == it, "Wrong copy."); 299 check(frnm[it] == trnm[rnr[it]], "Wrong copy."); 300 check(to.red(rnr[it]), "Wrong copy."); 301 } else { 302 check(bnr[it] == nr[it], "Wrong copy."); 303 check(bncr[bnr[it]] == it, "Wrong copy."); 304 check(fbnm[it] == tbnm[bnr[it]], "Wrong copy."); 305 check(to.blue(bnr[it]), "Wrong copy."); 306 } 305 } 306 307 for (SmartBpGraph::RedIt it(from); it != INVALID; ++it) { 308 check(ncr[nr[it]] == it, "Wrong copy."); 309 check(fnm[it] == tnm[nr[it]], "Wrong copy."); 310 check(rnr[it] == nr[it], "Wrong copy."); 311 check(rncr[rnr[it]] == it, "Wrong copy."); 312 check(frnm[it] == trnm[rnr[it]], "Wrong copy."); 313 check(to.red(rnr[it]), "Wrong copy."); 314 } 315 316 for (SmartBpGraph::BlueIt it(from); it != INVALID; ++it) { 317 check(ncr[nr[it]] == it, "Wrong copy."); 318 check(fnm[it] == tnm[nr[it]], "Wrong copy."); 319 check(bnr[it] == nr[it], "Wrong copy."); 320 check(bncr[bnr[it]] == it, "Wrong copy."); 321 check(fbnm[it] == tbnm[bnr[it]], "Wrong copy."); 322 check(to.blue(bnr[it]), "Wrong copy."); 307 323 } 308 324 … … 343 359 } 344 360 check(tn == nr[fn], "Wrong copy."); 361 check(trn == rnr[frn], "Wrong copy."); 362 check(tbn == bnr[fbn], "Wrong copy."); 345 363 check(ta == ar[fa], "Wrong copy."); 346 364 check(te == er[fe], "Wrong copy.");
Note: See TracChangeset
for help on using the changeset viewer.