gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Bug fix in (di)graphCopy() (#371) The target graph is cleared before adding nodes and arcs/edges.
0 2 0
default
2 files changed with 26 insertions and 0 deletions:
↑ Collapse diff ↑
Show white space 6 line context
... ...
@@ -386,2 +386,3 @@
386 386
                       NodeRefMap& nodeRefMap, ArcRefMap& arcRefMap) {
387
        to.clear();
387 388
        for (typename From::NodeIt it(from); it != INVALID; ++it) {
... ...
@@ -413,2 +414,3 @@
413 414
                       NodeRefMap& nodeRefMap, EdgeRefMap& edgeRefMap) {
415
        to.clear();
414 416
        for (typename From::NodeIt it(from); it != INVALID; ++it) {
Ignore white space 6 line context
... ...
@@ -31,2 +31,3 @@
31 31

	
32
  // Build a digraph
32 33
  SmartDigraph from;
... ...
@@ -53,2 +54,3 @@
53 54

	
55
  // Test digraph copy
54 56
  ListDigraph to;
... ...
@@ -70,2 +72,5 @@
70 72
    node(fn, tn).arc(fa, ta).run();
73
  
74
  check(countNodes(from) == countNodes(to), "Wrong copy.");
75
  check(countArcs(from) == countArcs(to), "Wrong copy.");
71 76

	
... ...
@@ -92,2 +97,8 @@
92 97
  check(ta == er[fa], "Wrong copy.");
98

	
99
  // Test repeated copy
100
  digraphCopy(from, to).run();
101
  
102
  check(countNodes(from) == countNodes(to), "Wrong copy.");
103
  check(countArcs(from) == countArcs(to), "Wrong copy.");
93 104
}
... ...
@@ -97,2 +108,3 @@
97 108

	
109
  // Build a graph
98 110
  SmartGraph from;
... ...
@@ -124,2 +136,3 @@
124 136

	
137
  // Test graph copy
125 138
  ListGraph to;
... ...
@@ -146,2 +159,6 @@
146 159

	
160
  check(countNodes(from) == countNodes(to), "Wrong copy.");
161
  check(countEdges(from) == countEdges(to), "Wrong copy.");
162
  check(countArcs(from) == countArcs(to), "Wrong copy.");
163

	
147 164
  for (SmartGraph::NodeIt it(from); it != INVALID; ++it) {
... ...
@@ -182,2 +199,9 @@
182 199
  check(te == er[fe], "Wrong copy.");
200

	
201
  // Test repeated copy
202
  graphCopy(from, to).run();
203
  
204
  check(countNodes(from) == countNodes(to), "Wrong copy.");
205
  check(countEdges(from) == countEdges(to), "Wrong copy.");
206
  check(countArcs(from) == countArcs(to), "Wrong copy.");
183 207
}
0 comments (0 inline)