test/graph_copy_test.cc
changeset 209 765619b7cbb2
parent 200 c0e2c043c060
child 220 a5d8c039f218
equal deleted inserted replaced
0:e96498ebc142 1:57d5d20a69cd
     1 /* -*- C++ -*-
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     2  *
     2  *
     3  * This file is a part of LEMON, a generic C++ optimization library
     3  * This file is a part of LEMON, a generic C++ optimization library.
     4  *
     4  *
     5  * Copyright (C) 2003-2008
     5  * Copyright (C) 2003-2008
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     6  * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     7  * (Egervary Research Group on Combinatorial Optimization, EGRES).
     8  *
     8  *
   120       fam[from.direct(edge, false)] = i * i + j;
   120       fam[from.direct(edge, false)] = i * i + j;
   121       if (i == 0 && j == 0) fa = from.direct(edge, true);
   121       if (i == 0 && j == 0) fa = from.direct(edge, true);
   122       if (i == 0 && j == 0) fe = edge;
   122       if (i == 0 && j == 0) fe = edge;
   123     }
   123     }
   124   }
   124   }
   125   
   125 
   126   ListGraph to;
   126   ListGraph to;
   127   ListGraph::NodeMap<int> tnm(to);
   127   ListGraph::NodeMap<int> tnm(to);
   128   ListGraph::ArcMap<int> tam(to);
   128   ListGraph::ArcMap<int> tam(to);
   129   ListGraph::EdgeMap<int> tem(to);
   129   ListGraph::EdgeMap<int> tem(to);
   130   ListGraph::Node tn;
   130   ListGraph::Node tn;
   158   }
   158   }
   159 
   159 
   160   for (SmartGraph::EdgeIt it(from); it != INVALID; ++it) {
   160   for (SmartGraph::EdgeIt it(from); it != INVALID; ++it) {
   161     check(ecr[er[it]] == it, "Wrong copy.");
   161     check(ecr[er[it]] == it, "Wrong copy.");
   162     check(fem[it] == tem[er[it]], "Wrong copy.");
   162     check(fem[it] == tem[er[it]], "Wrong copy.");
   163     check(nr[from.u(it)] == to.u(er[it]) || nr[from.u(it)] == to.v(er[it]), 
   163     check(nr[from.u(it)] == to.u(er[it]) || nr[from.u(it)] == to.v(er[it]),
   164 	  "Wrong copy.");
   164           "Wrong copy.");
   165     check(nr[from.v(it)] == to.u(er[it]) || nr[from.v(it)] == to.v(er[it]), 
   165     check(nr[from.v(it)] == to.u(er[it]) || nr[from.v(it)] == to.v(er[it]),
   166 	  "Wrong copy.");
   166           "Wrong copy.");
   167     check((from.u(it) != from.v(it)) == (to.u(er[it]) != to.v(er[it])), 
   167     check((from.u(it) != from.v(it)) == (to.u(er[it]) != to.v(er[it])),
   168 	  "Wrong copy.");
   168           "Wrong copy.");
   169   }
   169   }
   170 
   170 
   171   for (ListGraph::NodeIt it(to); it != INVALID; ++it) {
   171   for (ListGraph::NodeIt it(to); it != INVALID; ++it) {
   172     check(nr[ncr[it]] == it, "Wrong copy.");
   172     check(nr[ncr[it]] == it, "Wrong copy.");
   173   }
   173   }
   186 
   186 
   187 int main() {
   187 int main() {
   188   digraph_copy_test();
   188   digraph_copy_test();
   189   graph_copy_test();
   189   graph_copy_test();
   190 
   190 
   191   return 0; 
   191   return 0;
   192 }
   192 }