COIN-OR::LEMON - Graph Library

Changeset 209:765619b7cbb2 in lemon-main for test/heap_test.cc


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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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>();
Note: See TracChangeset for help on using the changeset viewer.