test/graph_copy_test.cc
changeset 1193 c8fa41fcc4a7
parent 1190 523e45e37e52
child 1194 699c7eac2c6d
     1.1 --- a/test/graph_copy_test.cc	Thu Nov 25 22:45:29 2010 +0100
     1.2 +++ b/test/graph_copy_test.cc	Thu Dec 01 09:05:47 2011 +0100
     1.3 @@ -221,24 +221,30 @@
     1.4    SmartBpGraph::ArcMap<int> fam(from);
     1.5    SmartBpGraph::EdgeMap<int> fem(from);
     1.6    SmartBpGraph::Node fn = INVALID;
     1.7 +  SmartBpGraph::RedNode frn = INVALID;
     1.8 +  SmartBpGraph::BlueNode fbn = INVALID;
     1.9    SmartBpGraph::Arc fa = INVALID;
    1.10    SmartBpGraph::Edge fe = INVALID;
    1.11  
    1.12 -  std::vector<SmartBpGraph::Node> frnv;
    1.13 +  std::vector<SmartBpGraph::RedNode> frnv;
    1.14    for (int i = 0; i < nn; ++i) {
    1.15 -    SmartBpGraph::Node node = from.addRedNode();
    1.16 +    SmartBpGraph::RedNode node = from.addRedNode();
    1.17      frnv.push_back(node);
    1.18      fnm[node] = i * i;
    1.19      frnm[node] = i + i;
    1.20 -    if (i == 0) fn = node;
    1.21 +    if (i == 0) {
    1.22 +      fn = node;
    1.23 +      frn = node;
    1.24 +    }
    1.25    }
    1.26  
    1.27 -  std::vector<SmartBpGraph::Node> fbnv;
    1.28 +  std::vector<SmartBpGraph::BlueNode> fbnv;
    1.29    for (int i = 0; i < nn; ++i) {
    1.30 -    SmartBpGraph::Node node = from.addBlueNode();
    1.31 +    SmartBpGraph::BlueNode node = from.addBlueNode();
    1.32      fbnv.push_back(node);
    1.33      fnm[node] = i * i;
    1.34      fbnm[node] = i + i;
    1.35 +    if (i == 0) fbn = node;
    1.36    }
    1.37  
    1.38    for (int i = 0; i < nn; ++i) {
    1.39 @@ -260,18 +266,20 @@
    1.40    typename GR::template ArcMap<int> tam(to);
    1.41    typename GR::template EdgeMap<int> tem(to);
    1.42    typename GR::Node tn;
    1.43 +  typename GR::RedNode trn;
    1.44 +  typename GR::BlueNode tbn;
    1.45    typename GR::Arc ta;
    1.46    typename GR::Edge te;
    1.47  
    1.48    SmartBpGraph::NodeMap<typename GR::Node> nr(from);
    1.49 -  SmartBpGraph::RedMap<typename GR::Node> rnr(from);
    1.50 -  SmartBpGraph::BlueMap<typename GR::Node> bnr(from);
    1.51 +  SmartBpGraph::RedMap<typename GR::RedNode> rnr(from);
    1.52 +  SmartBpGraph::BlueMap<typename GR::BlueNode> bnr(from);
    1.53    SmartBpGraph::ArcMap<typename GR::Arc> ar(from);
    1.54    SmartBpGraph::EdgeMap<typename GR::Edge> er(from);
    1.55  
    1.56    typename GR::template NodeMap<SmartBpGraph::Node> ncr(to);
    1.57 -  typename GR::template RedMap<SmartBpGraph::Node> rncr(to);
    1.58 -  typename GR::template BlueMap<SmartBpGraph::Node> bncr(to);
    1.59 +  typename GR::template RedMap<SmartBpGraph::RedNode> rncr(to);
    1.60 +  typename GR::template BlueMap<SmartBpGraph::BlueNode> bncr(to);
    1.61    typename GR::template ArcMap<SmartBpGraph::Arc> acr(to);
    1.62    typename GR::template EdgeMap<SmartBpGraph::Edge> ecr(to);
    1.63  
    1.64 @@ -282,7 +290,8 @@
    1.65      arcRef(ar).edgeRef(er).
    1.66      nodeCrossRef(ncr).redCrossRef(rncr).blueCrossRef(bncr).
    1.67      arcCrossRef(acr).edgeCrossRef(ecr).
    1.68 -    node(fn, tn).arc(fa, ta).edge(fe, te).run();
    1.69 +    node(fn, tn).redNode(frn, trn).blueNode(fbn, tbn).
    1.70 +    arc(fa, ta).edge(fe, te).run();
    1.71  
    1.72    check(countNodes(from) == countNodes(to), "Wrong copy.");
    1.73    check(countRedNodes(from) == countRedNodes(to), "Wrong copy.");
    1.74 @@ -293,17 +302,24 @@
    1.75    for (SmartBpGraph::NodeIt it(from); it != INVALID; ++it) {
    1.76      check(ncr[nr[it]] == it, "Wrong copy.");
    1.77      check(fnm[it] == tnm[nr[it]], "Wrong copy.");
    1.78 -    if (from.red(it)) {
    1.79 -      check(rnr[it] == nr[it], "Wrong copy.");
    1.80 -      check(rncr[rnr[it]] == it, "Wrong copy.");
    1.81 -      check(frnm[it] == trnm[rnr[it]], "Wrong copy.");
    1.82 -      check(to.red(rnr[it]), "Wrong copy.");
    1.83 -    } else {
    1.84 -      check(bnr[it] == nr[it], "Wrong copy.");
    1.85 -      check(bncr[bnr[it]] == it, "Wrong copy.");
    1.86 -      check(fbnm[it] == tbnm[bnr[it]], "Wrong copy.");
    1.87 -      check(to.blue(bnr[it]), "Wrong copy.");
    1.88 -    }
    1.89 +  }
    1.90 +
    1.91 +  for (SmartBpGraph::RedIt it(from); it != INVALID; ++it) {
    1.92 +    check(ncr[nr[it]] == it, "Wrong copy.");
    1.93 +    check(fnm[it] == tnm[nr[it]], "Wrong copy.");
    1.94 +    check(rnr[it] == nr[it], "Wrong copy.");
    1.95 +    check(rncr[rnr[it]] == it, "Wrong copy.");
    1.96 +    check(frnm[it] == trnm[rnr[it]], "Wrong copy.");
    1.97 +    check(to.red(rnr[it]), "Wrong copy.");
    1.98 +  }
    1.99 +
   1.100 +  for (SmartBpGraph::BlueIt it(from); it != INVALID; ++it) {
   1.101 +    check(ncr[nr[it]] == it, "Wrong copy.");
   1.102 +    check(fnm[it] == tnm[nr[it]], "Wrong copy.");
   1.103 +    check(bnr[it] == nr[it], "Wrong copy.");
   1.104 +    check(bncr[bnr[it]] == it, "Wrong copy.");
   1.105 +    check(fbnm[it] == tbnm[bnr[it]], "Wrong copy.");
   1.106 +    check(to.blue(bnr[it]), "Wrong copy.");
   1.107    }
   1.108  
   1.109    for (SmartBpGraph::ArcIt it(from); it != INVALID; ++it) {
   1.110 @@ -342,6 +358,8 @@
   1.111      check(er[ecr[it]] == it, "Wrong copy.");
   1.112    }
   1.113    check(tn == nr[fn], "Wrong copy.");
   1.114 +  check(trn == rnr[frn], "Wrong copy.");
   1.115 +  check(tbn == bnr[fbn], "Wrong copy.");
   1.116    check(ta == ar[fa], "Wrong copy.");
   1.117    check(te == er[fe], "Wrong copy.");
   1.118