test/graph_copy_test.cc
branch1.0
changeset 981 a5cb98ee8d91
parent 282 dc9e8d2c0df9
child 984 9f22c22fe227
child 1078 c59bdcc8e33e
     1.1 --- a/test/graph_copy_test.cc	Mon Apr 12 16:49:51 2010 +0200
     1.2 +++ b/test/graph_copy_test.cc	Fri Jun 25 06:03:25 2010 +0200
     1.3 @@ -29,6 +29,7 @@
     1.4  void digraph_copy_test() {
     1.5    const int nn = 10;
     1.6  
     1.7 +  // Build a digraph
     1.8    SmartDigraph from;
     1.9    SmartDigraph::NodeMap<int> fnm(from);
    1.10    SmartDigraph::ArcMap<int> fam(from);
    1.11 @@ -51,6 +52,7 @@
    1.12      }
    1.13    }
    1.14  
    1.15 +  // Test digraph copy
    1.16    ListDigraph to;
    1.17    ListDigraph::NodeMap<int> tnm(to);
    1.18    ListDigraph::ArcMap<int> tam(to);
    1.19 @@ -68,6 +70,9 @@
    1.20      nodeRef(nr).arcRef(er).
    1.21      nodeCrossRef(ncr).arcCrossRef(ecr).
    1.22      node(fn, tn).arc(fa, ta).run();
    1.23 +  
    1.24 +  check(countNodes(from) == countNodes(to), "Wrong copy.");
    1.25 +  check(countArcs(from) == countArcs(to), "Wrong copy.");
    1.26  
    1.27    for (SmartDigraph::NodeIt it(from); it != INVALID; ++it) {
    1.28      check(ncr[nr[it]] == it, "Wrong copy.");
    1.29 @@ -90,11 +95,18 @@
    1.30    }
    1.31    check(tn == nr[fn], "Wrong copy.");
    1.32    check(ta == er[fa], "Wrong copy.");
    1.33 +
    1.34 +  // Test repeated copy
    1.35 +  digraphCopy(from, to).run();
    1.36 +  
    1.37 +  check(countNodes(from) == countNodes(to), "Wrong copy.");
    1.38 +  check(countArcs(from) == countArcs(to), "Wrong copy.");
    1.39  }
    1.40  
    1.41  void graph_copy_test() {
    1.42    const int nn = 10;
    1.43  
    1.44 +  // Build a graph
    1.45    SmartGraph from;
    1.46    SmartGraph::NodeMap<int> fnm(from);
    1.47    SmartGraph::ArcMap<int> fam(from);
    1.48 @@ -122,6 +134,7 @@
    1.49      }
    1.50    }
    1.51  
    1.52 +  // Test graph copy
    1.53    ListGraph to;
    1.54    ListGraph::NodeMap<int> tnm(to);
    1.55    ListGraph::ArcMap<int> tam(to);
    1.56 @@ -144,6 +157,10 @@
    1.57      nodeCrossRef(ncr).arcCrossRef(acr).edgeCrossRef(ecr).
    1.58      node(fn, tn).arc(fa, ta).edge(fe, te).run();
    1.59  
    1.60 +  check(countNodes(from) == countNodes(to), "Wrong copy.");
    1.61 +  check(countEdges(from) == countEdges(to), "Wrong copy.");
    1.62 +  check(countArcs(from) == countArcs(to), "Wrong copy.");
    1.63 +
    1.64    for (SmartGraph::NodeIt it(from); it != INVALID; ++it) {
    1.65      check(ncr[nr[it]] == it, "Wrong copy.");
    1.66      check(fnm[it] == tnm[nr[it]], "Wrong copy.");
    1.67 @@ -180,6 +197,13 @@
    1.68    check(tn == nr[fn], "Wrong copy.");
    1.69    check(ta == ar[fa], "Wrong copy.");
    1.70    check(te == er[fe], "Wrong copy.");
    1.71 +
    1.72 +  // Test repeated copy
    1.73 +  graphCopy(from, to).run();
    1.74 +  
    1.75 +  check(countNodes(from) == countNodes(to), "Wrong copy.");
    1.76 +  check(countEdges(from) == countEdges(to), "Wrong copy.");
    1.77 +  check(countArcs(from) == countArcs(to), "Wrong copy.");
    1.78  }
    1.79  
    1.80