test/graph_copy_test.cc
branch1.1
changeset 1248 14394c9603c2
parent 984 9f22c22fe227
equal deleted inserted replaced
6:0942a9569053 9:69ab73cf1807
     1 /* -*- mode: C++; indent-tabs-mode: nil; -*-
     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-2009
     5  * Copyright (C) 2003-2011
     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  *
     9  * Permission to use, modify and distribute this software is granted
     9  * Permission to use, modify and distribute this software is granted
    10  * provided that this copyright notice appears in all copies. For
    10  * provided that this copyright notice appears in all copies. For
    68   digraphCopy(from, to).
    68   digraphCopy(from, to).
    69     nodeMap(fnm, tnm).arcMap(fam, tam).
    69     nodeMap(fnm, tnm).arcMap(fam, tam).
    70     nodeRef(nr).arcRef(er).
    70     nodeRef(nr).arcRef(er).
    71     nodeCrossRef(ncr).arcCrossRef(ecr).
    71     nodeCrossRef(ncr).arcCrossRef(ecr).
    72     node(fn, tn).arc(fa, ta).run();
    72     node(fn, tn).arc(fa, ta).run();
    73   
    73 
    74   check(countNodes(from) == countNodes(to), "Wrong copy.");
    74   check(countNodes(from) == countNodes(to), "Wrong copy.");
    75   check(countArcs(from) == countArcs(to), "Wrong copy.");
    75   check(countArcs(from) == countArcs(to), "Wrong copy.");
    76 
    76 
    77   for (SmartDigraph::NodeIt it(from); it != INVALID; ++it) {
    77   for (SmartDigraph::NodeIt it(from); it != INVALID; ++it) {
    78     check(ncr[nr[it]] == it, "Wrong copy.");
    78     check(ncr[nr[it]] == it, "Wrong copy.");
    96   check(tn == nr[fn], "Wrong copy.");
    96   check(tn == nr[fn], "Wrong copy.");
    97   check(ta == er[fa], "Wrong copy.");
    97   check(ta == er[fa], "Wrong copy.");
    98 
    98 
    99   // Test repeated copy
    99   // Test repeated copy
   100   digraphCopy(from, to).run();
   100   digraphCopy(from, to).run();
   101   
   101 
   102   check(countNodes(from) == countNodes(to), "Wrong copy.");
   102   check(countNodes(from) == countNodes(to), "Wrong copy.");
   103   check(countArcs(from) == countArcs(to), "Wrong copy.");
   103   check(countArcs(from) == countArcs(to), "Wrong copy.");
   104 }
   104 }
   105 
   105 
   106 void graph_copy_test() {
   106 void graph_copy_test() {
   198   check(ta == ar[fa], "Wrong copy.");
   198   check(ta == ar[fa], "Wrong copy.");
   199   check(te == er[fe], "Wrong copy.");
   199   check(te == er[fe], "Wrong copy.");
   200 
   200 
   201   // Test repeated copy
   201   // Test repeated copy
   202   graphCopy(from, to).run();
   202   graphCopy(from, to).run();
   203   
   203 
   204   check(countNodes(from) == countNodes(to), "Wrong copy.");
   204   check(countNodes(from) == countNodes(to), "Wrong copy.");
   205   check(countEdges(from) == countEdges(to), "Wrong copy.");
   205   check(countEdges(from) == countEdges(to), "Wrong copy.");
   206   check(countArcs(from) == countArcs(to), "Wrong copy.");
   206   check(countArcs(from) == countArcs(to), "Wrong copy.");
   207 }
   207 }
   208 
   208