COIN-OR::LEMON - Graph Library

Changeset 209:765619b7cbb2 in lemon-1.0 for test


Ignore:
Timestamp:
07/13/08 20:51:02 (16 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Phase:
public
Message:

Apply unify-sources.sh to the source tree

Location:
test
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • test/bfs_test.cc

    r171 r209  
    1 /* -*- C++ -*-
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
    22 *
    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.
    44 *
    55 * Copyright (C) 2003-2008
     
    2828using namespace lemon;
    2929
    30 void checkBfsCompile() 
     30void checkBfsCompile()
    3131{
    3232  typedef concepts::Digraph Digraph;
    3333  typedef Bfs<Digraph> BType;
    34  
     34
    3535  Digraph G;
    3636  Digraph::Node n;
     
    4141  BType::PredMap p(G);
    4242  //  BType::PredNodeMap pn(G);
    43  
     43
    4444  BType bfs_test(G);
    45  
     45
    4646  bfs_test.run(n);
    47  
     47
    4848  l  = bfs_test.dist(n);
    4949  e  = bfs_test.predArc(n);
     
    5757}
    5858
    59 void checkBfsFunctionCompile() 
     59void checkBfsFunctionCompile()
    6060{
    6161  typedef int VType;
     
    6363  typedef Digraph::Arc Arc;
    6464  typedef Digraph::Node Node;
    65    
     65
    6666  Digraph g;
    6767  bfs(g,Node()).run();
     
    8282  Node s, t;
    8383  PetStruct<Digraph> ps = addPetersen(G, 5);
    84    
     84
    8585  s=ps.outer[2];
    8686  t=ps.inner[0];
    87  
     87
    8888  Bfs<Digraph> bfs_test(G);
    8989  bfs_test.run(s);
    90  
     90
    9191  check(bfs_test.dist(t)==3,"Bfs found a wrong path." << bfs_test.dist(t));
    9292
     
    9696  check(pathSource(G, p) == s,"path() found a wrong path.");
    9797  check(pathTarget(G, p) == t,"path() found a wrong path.");
    98  
     98
    9999
    100100  for(ArcIt e(G); e==INVALID; ++e) {
     
    102102    Node v=G.target(e);
    103103    check( !bfs_test.reached(u) ||
    104            (bfs_test.dist(v) > bfs_test.dist(u)+1),
    105            "Wrong output.");
     104           (bfs_test.dist(v) > bfs_test.dist(u)+1),
     105           "Wrong output.");
    106106  }
    107107
     
    113113      check(u==bfs_test.predNode(v),"Wrong tree.");
    114114      check(bfs_test.dist(v) - bfs_test.dist(u) == 1,
    115             "Wrong distance. Difference: "
    116             << std::abs(bfs_test.dist(v) - bfs_test.dist(u)
    117                         - 1));
     115            "Wrong distance. Difference: "
     116            << std::abs(bfs_test.dist(v) - bfs_test.dist(u)
     117                        - 1));
    118118    }
    119119  }
  • test/counter_test.cc

    r171 r209  
    1 /* -*- C++ -*-
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
    22 *
    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.
    44 *
    55 * Copyright (C) 2003-2008
     
    7676void init(std::vector<int>& v) {
    7777  v[0] = 10; v[1] = 60; v[2] = 20; v[3] = 90; v[4] = 100;
    78   v[5] = 80; v[6] = 40; v[7] = 30; v[8] = 50; v[9] = 70; 
     78  v[5] = 80; v[6] = 40; v[7] = 30; v[8] = 50; v[9] = 70;
    7979}
    8080
     
    8383  counterTest<Counter>();
    8484  counterTest<NoCounter>();
    85  
     85
    8686  std::vector<int> x(10);
    8787  init(x); bubbleSort(x);
  • test/dfs_test.cc

    r171 r209  
    1 /* -*- C++ -*-
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
    22 *
    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.
    44 *
    55 * Copyright (C) 2003-2008
     
    2828using namespace lemon;
    2929
    30 void checkDfsCompile() 
     30void checkDfsCompile()
    3131{
    3232  typedef concepts::Digraph Digraph;
    3333  typedef Dfs<Digraph> DType;
    34  
     34
    3535  Digraph G;
    3636  Digraph::Node n;
     
    4141  DType::PredMap p(G);
    4242  //  DType::PredNodeMap pn(G);
    43  
     43
    4444  DType dfs_test(G);
    45  
     45
    4646  dfs_test.run(n);
    47  
     47
    4848  l  = dfs_test.dist(n);
    4949  e  = dfs_test.predArc(n);
     
    5757}
    5858
    59 void checkDfsFunctionCompile() 
     59void checkDfsFunctionCompile()
    6060{
    6161  typedef int VType;
     
    6363  typedef Digraph::Arc Arc;
    6464  typedef Digraph::Node Node;
    65    
     65
    6666  Digraph g;
    6767  dfs(g,Node()).run();
     
    7272    .reachedMap(concepts::ReadWriteMap<Node,bool>())
    7373    .processedMap(concepts::WriteMap<Node,bool>())
    74     .run(Node()); 
     74    .run(Node());
    7575}
    7676
     
    8282  Node s, t;
    8383  PetStruct<Digraph> ps = addPetersen(G, 5);
    84    
     84
    8585  s=ps.outer[2];
    8686  t=ps.inner[0];
    87  
     87
    8888  Dfs<Digraph> dfs_test(G);
    89   dfs_test.run(s); 
    90  
     89  dfs_test.run(s);
     90
    9191  Path<Digraph> p = dfs_test.path(t);
    9292  check(p.length() == dfs_test.dist(t),"path() found a wrong path.");
     
    9494  check(pathSource(G, p) == s,"path() found a wrong path.");
    9595  check(pathTarget(G, p) == t,"path() found a wrong path.");
    96  
     96
    9797  for(NodeIt v(G); v!=INVALID; ++v) {
    9898    check(dfs_test.reached(v),"Each node should be reached.");
     
    102102      check(u==dfs_test.predNode(v),"Wrong tree.");
    103103      check(dfs_test.dist(v) - dfs_test.dist(u) == 1,
    104             "Wrong distance. (" << dfs_test.dist(u) << "->"
    105             <<dfs_test.dist(v) << ')');
     104            "Wrong distance. (" << dfs_test.dist(u) << "->"
     105            <<dfs_test.dist(v) << ')');
    106106    }
    107107  }
  • test/digraph_test.cc

    r171 r209  
    1 /* -*- C++ -*-
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
    22 *
    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.
    44 *
    55 * Copyright (C) 2003-2008
     
    3434    checkConcept<BaseDigraphComponent, BaseDigraphComponent >();
    3535
    36     checkConcept<IDableDigraphComponent<>, 
     36    checkConcept<IDableDigraphComponent<>,
    3737      IDableDigraphComponent<> >();
    3838
    39     checkConcept<IterableDigraphComponent<>, 
     39    checkConcept<IterableDigraphComponent<>,
    4040      IterableDigraphComponent<> >();
    4141
    42     checkConcept<MappableDigraphComponent<>, 
     42    checkConcept<MappableDigraphComponent<>,
    4343      MappableDigraphComponent<> >();
    4444  }
  • test/dijkstra_test.cc

    r171 r209  
    1 /* -*- C++ -*-
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
    22 *
    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.
    44 *
    55 * Copyright (C) 2003-2008
     
    2929using namespace lemon;
    3030
    31 void checkDijkstraCompile() 
     31void checkDijkstraCompile()
    3232{
    3333  typedef int VType;
     
    3535  typedef concepts::ReadMap<Digraph::Arc,VType> LengthMap;
    3636  typedef Dijkstra<Digraph, LengthMap> DType;
    37  
     37
    3838  Digraph G;
    3939  Digraph::Node n;
     
    6161}
    6262
    63 void checkDijkstraFunctionCompile() 
     63void checkDijkstraFunctionCompile()
    6464{
    6565  typedef int VType;
     
    6868  typedef Digraph::Node Node;
    6969  typedef concepts::ReadMap<Digraph::Arc,VType> LengthMap;
    70    
     70
    7171  Digraph g;
    7272  dijkstra(g,LengthMap(),Node()).run();
     
    7979
    8080template <class Digraph>
    81 void checkDijkstra() {   
     81void checkDijkstra() {
    8282  TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
    8383  typedef typename Digraph::template ArcMap<int> LengthMap;
     
    8787  LengthMap length(G);
    8888  PetStruct<Digraph> ps = addPetersen(G, 5);
    89    
     89
    9090  for(int i=0;i<5;i++) {
    9191    length[ps.outcir[i]]=4;
     
    9595  s=ps.outer[0];
    9696  t=ps.inner[1];
    97  
    98   Dijkstra<Digraph, LengthMap> 
    99         dijkstra_test(G, length);
     97
     98  Dijkstra<Digraph, LengthMap>
     99        dijkstra_test(G, length);
    100100  dijkstra_test.run(s);
    101  
     101
    102102  check(dijkstra_test.dist(t)==13,"Dijkstra found a wrong path.");
    103103
     
    107107  check(pathSource(G, p) == s,"path() found a wrong path.");
    108108  check(pathTarget(G, p) == t,"path() found a wrong path.");
    109  
     109
    110110  for(ArcIt e(G); e!=INVALID; ++e) {
    111111    Node u=G.source(e);
    112112    Node v=G.target(e);
    113113    check( !dijkstra_test.reached(u) || (dijkstra_test.dist(v) - dijkstra_test.dist(u) <= length[e]),
    114            "dist(target)-dist(source)-arc_length= " << dijkstra_test.dist(v) - dijkstra_test.dist(u) - length[e]);
     114           "dist(target)-dist(source)-arc_length= " << dijkstra_test.dist(v) - dijkstra_test.dist(u) - length[e]);
    115115  }
    116116
     
    122122      check(u==dijkstra_test.predNode(v),"Wrong tree.");
    123123      check(dijkstra_test.dist(v) - dijkstra_test.dist(u) == length[e],
    124             "Wrong distance! Difference: " << std::abs(dijkstra_test.dist(v) - dijkstra_test.dist(u) - length[e]));
     124            "Wrong distance! Difference: " << std::abs(dijkstra_test.dist(v) - dijkstra_test.dist(u) - length[e]));
    125125    }
    126126  }
    127  
     127
    128128  {
    129129    NullMap<Node,Arc> myPredMap;
  • test/dim_test.cc

    r171 r209  
    1 /* -*- C++ -*-
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
    22 *
    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.
    44 *
    55 * Copyright (C) 2003-2008
  • test/error_test.cc

    r171 r209  
    1 /* -*- C++ -*-
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
    22 *
    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.
    44 *
    55 * Copyright (C) 2003-2008
     
    5959
    6060static int cnt = 0;
    61 void my_assert_handler(const char*, int, const char*, 
    62                        const char*, const char*) {
     61void my_assert_handler(const char*, int, const char*,
     62                       const char*, const char*) {
    6363  ++cnt;
    6464}
  • test/graph_copy_test.cc

    r200 r209  
    1 /* -*- C++ -*-
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
    22 *
    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.
    44 *
    55 * Copyright (C) 2003-2008
     
    123123    }
    124124  }
    125  
     125
    126126  ListGraph to;
    127127  ListGraph::NodeMap<int> tnm(to);
     
    161161    check(ecr[er[it]] == it, "Wrong copy.");
    162162    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]), 
    164           "Wrong copy.");
    165     check(nr[from.v(it)] == to.u(er[it]) || nr[from.v(it)] == to.v(er[it]), 
    166           "Wrong copy.");
    167     check((from.u(it) != from.v(it)) == (to.u(er[it]) != to.v(er[it])), 
    168           "Wrong copy.");
     163    check(nr[from.u(it)] == to.u(er[it]) || nr[from.u(it)] == to.v(er[it]),
     164          "Wrong copy.");
     165    check(nr[from.v(it)] == to.u(er[it]) || nr[from.v(it)] == to.v(er[it]),
     166          "Wrong copy.");
     167    check((from.u(it) != from.v(it)) == (to.u(er[it]) != to.v(er[it])),
     168          "Wrong copy.");
    169169  }
    170170
     
    189189  graph_copy_test();
    190190
    191   return 0; 
     191  return 0;
    192192}
  • test/graph_maps_test.h

    r171 r209  
    1 /* -*- C++ -*-
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
    22 *
    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.
    44 *
    55 * Copyright (C) 2003-2008
     
    7272    for (int i = 0; i < num; ++i) {
    7373      for (int j = 0; j < i; ++j) {
    74         arcs.push_back(graph.addArc(nodes[i], nodes[j]));
     74        arcs.push_back(graph.addArc(nodes[i], nodes[j]));
    7575      }
    7676    }
     
    8585    for (int i = 0; i < num; ++i) {
    8686      for (int j = i + 1; j < num; ++j) {
    87         arcs.push_back(graph.addArc(nodes[i], nodes[j]));
    88         map[arcs.back()] = 23;
     87        arcs.push_back(graph.addArc(nodes[i], nodes[j]));
     88        map[arcs.back()] = 23;
    8989        check(map[arcs.back()] == 23, "Wrong operator[].");
    9090      }
     
    114114    for (int i = 0; i < num; ++i) {
    115115      for (int j = 0; j < i; ++j) {
    116         edges.push_back(graph.addEdge(nodes[i], nodes[j]));
     116        edges.push_back(graph.addEdge(nodes[i], nodes[j]));
    117117      }
    118118    }
     
    127127    for (int i = 0; i < num; ++i) {
    128128      for (int j = i + 1; j < num; ++j) {
    129         edges.push_back(graph.addEdge(nodes[i], nodes[j]));
    130         map[edges.back()] = 23;
     129        edges.push_back(graph.addEdge(nodes[i], nodes[j]));
     130        map[edges.back()] = 23;
    131131        check(map[edges.back()] == 23, "Wrong operator[].");
    132132      }
  • test/graph_test.cc

    r171 r209  
    1 /* -*- C++ -*-
    2  *
    3  * This file is a part of LEMON, a generic C++ optimization library
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
     2 *
     3 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    55 * Copyright (C) 2003-2008
     
    3434    checkConcept<BaseGraphComponent, BaseGraphComponent >();
    3535
    36     checkConcept<IDableGraphComponent<>, 
     36    checkConcept<IDableGraphComponent<>,
    3737      IDableGraphComponent<> >();
    3838
    39     checkConcept<IterableGraphComponent<>, 
     39    checkConcept<IterableGraphComponent<>,
    4040      IterableGraphComponent<> >();
    4141
    42     checkConcept<MappableGraphComponent<>, 
     42    checkConcept<MappableGraphComponent<>,
    4343      MappableGraphComponent<> >();
    4444  }
     
    135135//     }
    136136//   }
    137  
     137
    138138//   for (int i = 0; i < w; ++i) {
    139139//     for (int j = 0; j < h - 1; ++j) {
     
    155155//     for (int i = 0; i < w - 1; ++i) {
    156156//       check(g.source(g.right(g(i, j))) == g(i, j), "Wrong right");
    157 //       check(g.target(g.right(g(i, j))) == g(i + 1, j), "Wrong right");     
    158 //     }
    159 //     check(g.right(g(w - 1, j)) == INVALID, "Wrong right");   
     157//       check(g.target(g.right(g(i, j))) == g(i + 1, j), "Wrong right");
     158//     }
     159//     check(g.right(g(w - 1, j)) == INVALID, "Wrong right");
    160160//   }
    161161
     
    163163//     for (int i = 1; i < w; ++i) {
    164164//       check(g.source(g.left(g(i, j))) == g(i, j), "Wrong left");
    165 //       check(g.target(g.left(g(i, j))) == g(i - 1, j), "Wrong left");     
    166 //     }
    167 //     check(g.left(g(0, j)) == INVALID, "Wrong left");   
     165//       check(g.target(g.left(g(i, j))) == g(i - 1, j), "Wrong left");
     166//     }
     167//     check(g.left(g(0, j)) == INVALID, "Wrong left");
    168168//   }
    169169// }
  • test/graph_test.h

    r171 r209  
    1 /* -*- C++ -*-
    2  *
    3  * This file is a part of LEMON, a generic C++ optimization library
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
     2 *
     3 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    55 * Copyright (C) 2003-2008
     
    218218      n.incir.push_back(G.addEdge(n.inner[i],n.inner[(i+2)%num]));
    219219    }
    220    
     220
    221221    return n;
    222222  }
     
    247247    checkBidirPetersen(G, num);
    248248  }
    249  
     249
    250250  template <class Graph>
    251251  void checkGraph() {
  • test/graph_utils_test.cc

    r171 r209  
    1 /* -*- C++ -*-
    2  *
    3  * This file is a part of LEMON, a generic C++ optimization library
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
     2 *
     3 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    55 * Copyright (C) 2003-2008
     
    141141{
    142142  TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
    143  
     143
    144144  const int nodeNum = 10;
    145145  const int arcNum = 100;
     
    156156  }
    157157  for (int i = 0; i < nodeNum; ++i) {
    158     check(inDeg[nodes[i]] == countInArcs(digraph, nodes[i]), 
     158    check(inDeg[nodes[i]] == countInArcs(digraph, nodes[i]),
    159159          "Wrong in degree map");
    160160  }
    161161  for (int i = 0; i < nodeNum; ++i) {
    162     check(outDeg[nodes[i]] == countOutArcs(digraph, nodes[i]), 
     162    check(outDeg[nodes[i]] == countOutArcs(digraph, nodes[i]),
    163163          "Wrong out degree map");
    164164  }
     
    173173  Node n1=g.addNode();
    174174  Node n2=g.addNode();
    175  
     175
    176176  InDegMap<Digraph> ind(g);
    177  
     177
    178178  g.addArc(n1,n2);
    179  
     179
    180180  typename Digraph::Snapshot snap(g);
    181  
     181
    182182  OutDegMap<Digraph> outd(g);
    183  
     183
    184184  check(ind[n1]==0 && ind[n2]==1, "Wrong InDegMap value.");
    185185  check(outd[n1]==1 && outd[n2]==0, "Wrong OutDegMap value.");
  • test/heap_test.cc

    r203 r209  
    1 /* -*- C++ -*-
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
    22 *
    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.
    44 *
    55 * Copyright (C) 2003-2008
     
    4141DIGRAPH_TYPEDEFS(Digraph);
    4242
    43 char test_lgf[] = 
    44   "@nodes\n" 
    45   "label\n"     
    46   "0\n" 
    47   "1\n" 
    48   "2\n" 
    49   "3\n" 
    50   "4\n" 
    51   "5\n" 
    52   "6\n" 
    53   "7\n" 
    54   "8\n" 
    55   "9\n" 
    56   "@arcs\n" 
    57   "             label   capacity\n"     
    58   "0    5       0       94\n"   
    59   "3    9       1       11\n"   
    60   "8    7       2       83\n"   
    61   "1    2       3       94\n"   
    62   "5    7       4       35\n"   
    63   "7    4       5       84\n"   
    64   "9    5       6       38\n"   
    65   "0    4       7       96\n"   
    66   "6    7       8       6\n"   
    67   "3    1       9       27\n"   
    68   "5    2       10      77\n"   
    69   "5    6       11      69\n"   
    70   "6    5       12      41\n"   
    71   "4    6       13      70\n"   
    72   "3    2       14      45\n"   
    73   "7    9       15      93\n"   
    74   "5    9       16      50\n"   
    75   "9    0       17      94\n"   
    76   "9    6       18      67\n"   
    77   "0    9       19      86\n"   
    78   "@attributes\n" 
     43char test_lgf[] =
     44  "@nodes\n"
     45  "label\n"
     46  "0\n"
     47  "1\n"
     48  "2\n"
     49  "3\n"
     50  "4\n"
     51  "5\n"
     52  "6\n"
     53  "7\n"
     54  "8\n"
     55  "9\n"
     56  "@arcs\n"
     57  "                label        capacity\n"
     58  "0        5        0        94\n"
     59  "3        9        1        11\n"
     60  "8        7        2        83\n"
     61  "1        2        3        94\n"
     62  "5        7        4        35\n"
     63  "7        4        5        84\n"
     64  "9        5        6        38\n"
     65  "0        4        7        96\n"
     66  "6        7        8        6\n"
     67  "3        1        9        27\n"
     68  "5        2        10        77\n"
     69  "5        6        11        69\n"
     70  "6        5        12        41\n"
     71  "4        6        13        70\n"
     72  "3        2        14        45\n"
     73  "7        9        15        93\n"
     74  "5        9        16        50\n"
     75  "9        0        17        94\n"
     76  "9        6        18        67\n"
     77  "0        9        19        86\n"
     78  "@attributes\n"
    7979  "source 3\n";
    8080
     
    8989
    9090  Heap heap(map);
    91  
     91
    9292  std::vector<int> v(test_len);
    9393
     
    108108
    109109  Heap heap(map);
    110  
     110
    111111  std::vector<int> v(test_len);
    112112
     
    129129
    130130template <typename Heap>
    131 void dijkstraHeapTest(const Digraph& digraph, const IntArcMap& length, 
    132                       Node source) {
    133  
     131void dijkstraHeapTest(const Digraph& digraph, const IntArcMap& length,
     132                      Node source) {
     133
    134134  typename Dijkstra<Digraph, IntArcMap>::template DefStandardHeap<Heap>::
    135135    Create dijkstra(digraph, length);
     
    138138
    139139  for(ArcIt a(digraph); a != INVALID; ++a) {
    140     Node s = digraph.source(a); 
     140    Node s = digraph.source(a);
    141141    Node t = digraph.target(a);
    142142    if (dijkstra.reached(s)) {
    143143      check( dijkstra.dist(t) - dijkstra.dist(s) <= length[a],
    144              "Error in a shortest path tree!");
     144                   "Error in a shortest path tree!");
    145145    }
    146146  }
     
    151151      Node s = digraph.source(a);
    152152      check( dijkstra.dist(n) - dijkstra.dist(s) == length[a],
    153              "Error in a shortest path tree!");
     153             "Error in a shortest path tree!");
    154154    }
    155155  }
     
    162162  typedef int Prio;
    163163  typedef RangeMap<int> ItemIntMap;
    164  
     164
    165165  Digraph digraph;
    166166  IntArcMap length(digraph);
     
    171171    arcMap("capacity", length).
    172172    node("source", source).
    173     run(); 
    174  
     173    run();
     174
    175175  {
    176176    typedef BinHeap<Prio, ItemIntMap> IntHeap;
     
    178178    heapSortTest<IntHeap>();
    179179    heapIncreaseTest<IntHeap>();
    180    
     180
    181181    typedef BinHeap<Prio, IntNodeMap > NodeHeap;
    182182    checkConcept<Heap<Prio, IntNodeMap >, NodeHeap>();
  • test/kruskal_test.cc

    r171 r209  
    1 /* -*- C++ -*-
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
    22 *
    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.
    44 *
    55 * Copyright (C) 2003-2008
     
    7474  Node v4=G.addNode();
    7575  Node t=G.addNode();
    76  
     76
    7777  Edge e1 = G.addEdge(s, v1);
    7878  Edge e2 = G.addEdge(s, v2);
     
    9191  ECostMap edge_cost_map(G, 2);
    9292  EBoolMap tree_map(G);
    93  
     93
    9494
    9595  //Test with const map.
    9696  check(kruskal(G, ConstMap<ListGraph::Edge,int>(2), tree_map)==10,
    97         "Total cost should be 10");
     97        "Total cost should be 10");
    9898  //Test with an edge map (filled with uniform costs).
    9999  check(kruskal(G, edge_cost_map, tree_map)==10,
    100         "Total cost should be 10");
     100        "Total cost should be 10");
    101101
    102102  edge_cost_map.set(e1, -10);
     
    115115  //Test with a edge map and inserter.
    116116  check(kruskal(G, edge_cost_map,
    117                 tree_edge_vec.begin())
    118         ==-31,
    119         "Total cost should be -31.");
    120  
     117                tree_edge_vec.begin())
     118        ==-31,
     119        "Total cost should be -31.");
     120
    121121  tree_edge_vec.clear();
    122122
    123123  check(kruskal(G, edge_cost_map,
    124                 back_inserter(tree_edge_vec))
    125         ==-31,
    126         "Total cost should be -31.");
    127  
     124                back_inserter(tree_edge_vec))
     125        ==-31,
     126        "Total cost should be -31.");
     127
    128128//   tree_edge_vec.clear();
    129  
     129
    130130//   //The above test could also be coded like this:
    131131//   check(kruskal(G,
    132 //              makeKruskalMapInput(G, edge_cost_map),
    133 //              makeKruskalSequenceOutput(back_inserter(tree_edge_vec)))
    134 //      ==-31,
    135 //      "Total cost should be -31.");
     132//                 makeKruskalMapInput(G, edge_cost_map),
     133//                 makeKruskalSequenceOutput(back_inserter(tree_edge_vec)))
     134//         ==-31,
     135//         "Total cost should be -31.");
    136136
    137137  check(tree_edge_vec.size()==5,"The tree should have 5 edges.");
    138138
    139139  check(tree_edge_vec[0]==e1 &&
    140         tree_edge_vec[1]==e2 &&
    141         tree_edge_vec[2]==e5 &&
    142         tree_edge_vec[3]==e7 &&
    143         tree_edge_vec[4]==e9,
    144         "Wrong tree.");
     140        tree_edge_vec[1]==e2 &&
     141        tree_edge_vec[2]==e5 &&
     142        tree_edge_vec[3]==e7 &&
     143        tree_edge_vec[4]==e9,
     144        "Wrong tree.");
    145145
    146146  return 0;
  • test/maps_test.cc

    r167 r209  
    1 /* -*- C++ -*-
    2  *
    3  * This file is a part of LEMON, a generic C++ optimization library
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
     2 *
     3 * This file is a part of LEMON, a generic C++ optimization library.
    44 *
    55 * Copyright (C) 2003-2008
     
    305305          "Something is wrong with EqualMap");
    306306  }
    307  
     307
    308308  // LoggerBoolMap
    309309  {
     
    321321          v1[0]==20 && v1[1]==50 && v1[2]==60 && v2[0]==20 && v2[1]==50 && v2[2]==60,
    322322          "Something is wrong with LoggerBoolMap");
    323          
     323
    324324    int i = 0;
    325325    for ( LoggerBoolMap<vec::iterator>::Iterator it = map2.begin();
  • test/path_test.cc

    r96 r209  
    1 /* -*- C++ -*-
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
    22 *
    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.
    44 *
    55 * Copyright (C) 2003-2008
     
    4040
    4141int main() {
    42   check_concepts(); 
     42  check_concepts();
    4343  return 0;
    4444}
  • test/random_test.cc

    r171 r209  
    1 /* -*- C++ -*-
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
    22 *
    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.
    44 *
    55 * Copyright (C) 2003-2008
     
    3434
    3535  lemon::rnd.seed(100);
    36   lemon::rnd.seed(seed_array, seed_array + 
    37                   (sizeof(seed_array) / sizeof(seed_array[0])));
     36  lemon::rnd.seed(seed_array, seed_array +
     37                  (sizeof(seed_array) / sizeof(seed_array[0])));
    3838
    3939  return 0;
  • test/test_tools.h

    r184 r209  
    1 /* -*- C++ -*-
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
    22 *
    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.
    44 *
    55 * Copyright (C) 2003-2008
  • test/test_tools_fail.cc

    r39 r209  
    1 /* -*- C++ -*-
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
    22 *
    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.
    44 *
    55 * Copyright (C) 2003-2008
     
    1919#include "test_tools.h"
    2020
    21 int main() 
     21int main()
    2222{
    2323  check(false, "Don't panic. Failing is the right behaviour here.");
  • test/test_tools_pass.cc

    r39 r209  
    1 /* -*- C++ -*-
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
    22 *
    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.
    44 *
    55 * Copyright (C) 2003-2008
     
    1919#include "test_tools.h"
    2020
    21 int main() 
     21int main()
    2222{
    2323  check(true, "It should pass.");
  • test/time_measure_test.cc

    r171 r209  
    1 /* -*- C++ -*-
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
    22 *
    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.
    44 *
    55 * Copyright (C) 2003-2008
     
    2121using namespace lemon;
    2222
    23 void f() 
     23void f()
    2424{
    2525  double d=0;
     
    2828}
    2929
    30 void g() 
     30void g()
    3131{
    3232  static Timer T;
    33  
     33
    3434  for(int i=0;i<1000;i++)
    3535    TimeStamp x(T);
     
    5050  std::cout << t << " (" << n << " tests)\n";
    5151  std::cout << "Total: " << full << "\n";
    52  
     52
    5353  t=runningTimeTest(g,1,&n,&full);
    5454  std::cout << t << " (" << n << " tests)\n";
    5555  std::cout << "Total: " << full << "\n";
    56  
     56
    5757  return 0;
    5858}
  • test/unionfind_test.cc

    r171 r209  
    1 /* -*- C++ -*-
     1/* -*- mode: C++; indent-tabs-mode: nil; -*-
    22 *
    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.
    44 *
    55 * Copyright (C) 2003-2008
     
    3232  UFE U(base);
    3333  vector<ListGraph::Node> n;
    34  
     34
    3535  for(int i=0;i<20;i++) n.push_back(g.addNode());
    3636
Note: See TracChangeset for help on using the changeset viewer.