test/heap_test.cc
changeset 209 765619b7cbb2
parent 203 215bfc30b14f
child 212 1ae84dea7d09
     1.1 --- a/test/heap_test.cc	Sun Jul 13 16:46:56 2008 +0100
     1.2 +++ b/test/heap_test.cc	Sun Jul 13 19:51:02 2008 +0100
     1.3 @@ -1,6 +1,6 @@
     1.4 -/* -*- C++ -*-
     1.5 +/* -*- mode: C++; indent-tabs-mode: nil; -*-
     1.6   *
     1.7 - * This file is a part of LEMON, a generic C++ optimization library
     1.8 + * This file is a part of LEMON, a generic C++ optimization library.
     1.9   *
    1.10   * Copyright (C) 2003-2008
    1.11   * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.12 @@ -40,42 +40,42 @@
    1.13  typedef ListDigraph Digraph;
    1.14  DIGRAPH_TYPEDEFS(Digraph);
    1.15  
    1.16 -char test_lgf[] = 
    1.17 -  "@nodes\n" 
    1.18 -  "label\n"	
    1.19 -  "0\n"	
    1.20 -  "1\n"	
    1.21 -  "2\n"	
    1.22 -  "3\n"	
    1.23 -  "4\n"	
    1.24 -  "5\n"	
    1.25 -  "6\n"	
    1.26 -  "7\n"	
    1.27 -  "8\n"	
    1.28 -  "9\n"	
    1.29 -  "@arcs\n" 
    1.30 -  "		label	capacity\n"	
    1.31 -  "0	5	0	94\n"	
    1.32 -  "3	9	1	11\n"	
    1.33 -  "8	7	2	83\n"	
    1.34 -  "1	2	3	94\n"	
    1.35 -  "5	7	4	35\n"	
    1.36 -  "7	4	5	84\n"	
    1.37 -  "9	5	6	38\n"	
    1.38 -  "0	4	7	96\n"	
    1.39 -  "6	7	8	6\n"	
    1.40 -  "3	1	9	27\n"	
    1.41 -  "5	2	10	77\n"	
    1.42 -  "5	6	11	69\n"	
    1.43 -  "6	5	12	41\n"	
    1.44 -  "4	6	13	70\n"	
    1.45 -  "3	2	14	45\n"	
    1.46 -  "7	9	15	93\n"	
    1.47 -  "5	9	16	50\n"	
    1.48 -  "9	0	17	94\n"	
    1.49 -  "9	6	18	67\n"	
    1.50 -  "0	9	19	86\n"	
    1.51 -  "@attributes\n" 
    1.52 +char test_lgf[] =
    1.53 +  "@nodes\n"
    1.54 +  "label\n"
    1.55 +  "0\n"
    1.56 +  "1\n"
    1.57 +  "2\n"
    1.58 +  "3\n"
    1.59 +  "4\n"
    1.60 +  "5\n"
    1.61 +  "6\n"
    1.62 +  "7\n"
    1.63 +  "8\n"
    1.64 +  "9\n"
    1.65 +  "@arcs\n"
    1.66 +  "                label        capacity\n"
    1.67 +  "0        5        0        94\n"
    1.68 +  "3        9        1        11\n"
    1.69 +  "8        7        2        83\n"
    1.70 +  "1        2        3        94\n"
    1.71 +  "5        7        4        35\n"
    1.72 +  "7        4        5        84\n"
    1.73 +  "9        5        6        38\n"
    1.74 +  "0        4        7        96\n"
    1.75 +  "6        7        8        6\n"
    1.76 +  "3        1        9        27\n"
    1.77 +  "5        2        10        77\n"
    1.78 +  "5        6        11        69\n"
    1.79 +  "6        5        12        41\n"
    1.80 +  "4        6        13        70\n"
    1.81 +  "3        2        14        45\n"
    1.82 +  "7        9        15        93\n"
    1.83 +  "5        9        16        50\n"
    1.84 +  "9        0        17        94\n"
    1.85 +  "9        6        18        67\n"
    1.86 +  "0        9        19        86\n"
    1.87 +  "@attributes\n"
    1.88    "source 3\n";
    1.89  
    1.90  int test_seq[] = { 2, 28, 19, 27, 33, 25, 13, 41, 10, 26,  1,  9,  4, 34};
    1.91 @@ -88,7 +88,7 @@
    1.92    RangeMap<int> map(test_len, -1);
    1.93  
    1.94    Heap heap(map);
    1.95 -  
    1.96 +
    1.97    std::vector<int> v(test_len);
    1.98  
    1.99    for (int i = 0; i < test_len; ++i) {
   1.100 @@ -107,7 +107,7 @@
   1.101    RangeMap<int> map(test_len, -1);
   1.102  
   1.103    Heap heap(map);
   1.104 -  
   1.105 +
   1.106    std::vector<int> v(test_len);
   1.107  
   1.108    for (int i = 0; i < test_len; ++i) {
   1.109 @@ -128,20 +128,20 @@
   1.110  
   1.111  
   1.112  template <typename Heap>
   1.113 -void dijkstraHeapTest(const Digraph& digraph, const IntArcMap& length, 
   1.114 -		      Node source) {
   1.115 -  
   1.116 +void dijkstraHeapTest(const Digraph& digraph, const IntArcMap& length,
   1.117 +                      Node source) {
   1.118 +
   1.119    typename Dijkstra<Digraph, IntArcMap>::template DefStandardHeap<Heap>::
   1.120      Create dijkstra(digraph, length);
   1.121  
   1.122    dijkstra.run(source);
   1.123  
   1.124    for(ArcIt a(digraph); a != INVALID; ++a) {
   1.125 -    Node s = digraph.source(a); 
   1.126 +    Node s = digraph.source(a);
   1.127      Node t = digraph.target(a);
   1.128      if (dijkstra.reached(s)) {
   1.129        check( dijkstra.dist(t) - dijkstra.dist(s) <= length[a],
   1.130 -      	     "Error in a shortest path tree!");
   1.131 +                   "Error in a shortest path tree!");
   1.132      }
   1.133    }
   1.134  
   1.135 @@ -150,7 +150,7 @@
   1.136        Arc a = dijkstra.predArc(n);
   1.137        Node s = digraph.source(a);
   1.138        check( dijkstra.dist(n) - dijkstra.dist(s) == length[a],
   1.139 -	     "Error in a shortest path tree!");
   1.140 +             "Error in a shortest path tree!");
   1.141      }
   1.142    }
   1.143  
   1.144 @@ -161,7 +161,7 @@
   1.145    typedef int Item;
   1.146    typedef int Prio;
   1.147    typedef RangeMap<int> ItemIntMap;
   1.148 -  
   1.149 +
   1.150    Digraph digraph;
   1.151    IntArcMap length(digraph);
   1.152    Node source;
   1.153 @@ -170,14 +170,14 @@
   1.154    digraphReader(input, digraph).
   1.155      arcMap("capacity", length).
   1.156      node("source", source).
   1.157 -    run();  
   1.158 - 
   1.159 +    run();
   1.160 +
   1.161    {
   1.162      typedef BinHeap<Prio, ItemIntMap> IntHeap;
   1.163      checkConcept<Heap<Prio, ItemIntMap>, IntHeap>();
   1.164      heapSortTest<IntHeap>();
   1.165      heapIncreaseTest<IntHeap>();
   1.166 -    
   1.167 +
   1.168      typedef BinHeap<Prio, IntNodeMap > NodeHeap;
   1.169      checkConcept<Heap<Prio, IntNodeMap >, NodeHeap>();
   1.170      dijkstraHeapTest<NodeHeap>(digraph, length, source);