COIN-OR::LEMON - Graph Library

Changeset 1330:52ef02524468 in lemon-0.x for src/test


Ignore:
Timestamp:
04/09/05 21:27:48 (20 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1769
Message:

Heap concept moved to namespace concept.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/test/heap_test.cc

    r1325 r1330  
    77
    88#include <lemon/concept_check.h>
     9#include <lemon/concept/heap.h>
    910
    1011#include <lemon/smart_graph.h>
     
    2223
    2324using namespace lemon;
     25using namespace lemon::concept;
    2426
    25 template <typename Item, typename Prio, typename ItemIntMap>
    26 class HeapConcept {
    27 public: 
    28 
    29   template <typename _Heap>
    30   struct Constraints {
    31   public:
    32    
    33     void constraints() {
    34       Item item;
    35       Prio prio;
    36 
    37       ignore_unused_variable_warning(item);
    38       ignore_unused_variable_warning(prio);
    39 
    40       typedef typename _Heap::state_enum state_enum;
    41       state_enum state;
    42 
    43       ignore_unused_variable_warning(state);
    44      
    45       _Heap heap1 = _Heap(map);
    46 
    47       ignore_unused_variable_warning(heap1);
    48      
    49       heap.push(item, prio);
    50 
    51       prio = heap.prio();
    52       item = heap.top();
    53 
    54       heap.pop();
    55 
    56       heap.set(item, prio);
    57       heap.decrease(item, prio);
    58       heap.increase(item, prio);
    59       prio = heap[item];
    60 
    61       heap.erase(item);
    62 
    63       state = heap.state(item);
    64 
    65       state = _Heap::PRE_HEAP;
    66       state = _Heap::IN_HEAP;
    67       state = _Heap::POST_HEAP;
    68     }
    69    
    70     _Heap& heap;
    71     ItemIntMap& map;
    72 
    73     Constraints() : heap(0), map(0) {}
    74   };
    75 };
    7627
    7728int main() {
     
    10960
    11061    typedef BinHeap<Item, Prio, ItemIntMap> IntHeap;
    111     checkConcept<HeapConcept<Item, Prio, ItemIntMap>, IntHeap>();
     62    checkConcept<Heap<Item, Prio, ItemIntMap>, IntHeap>();
    11263    heapSortTest<IntHeap>(100);
    11364    heapIncreaseTest<IntHeap>(100);
    11465   
    11566    typedef FibHeap<Node, Prio, Graph::NodeMap<int> > NodeHeap;
    116     checkConcept<HeapConcept<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();
     67    checkConcept<Heap<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();
    11768    dijkstraHeapTest<Graph, LengthMap, NodeHeap>(graph, length, start);
    11869  }
     
    12172
    12273    typedef FibHeap<Item, Prio, ItemIntMap> IntHeap;
    123     checkConcept<HeapConcept<Item, Prio, ItemIntMap>, IntHeap>();
     74    checkConcept<Heap<Item, Prio, ItemIntMap>, IntHeap>();
    12475    heapSortTest<IntHeap>(100);
    12576    heapIncreaseTest<IntHeap>(100);
    12677
    12778    typedef FibHeap<Node, Prio, Graph::NodeMap<int> > NodeHeap;
    128     checkConcept<HeapConcept<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();
     79    checkConcept<Heap<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();
    12980    dijkstraHeapTest<Graph, LengthMap, NodeHeap>(graph, length, start);
    13081  }
     
    13384
    13485    typedef RadixHeap<Item, ItemIntMap> IntHeap;
    135     checkConcept<HeapConcept<Item, Prio, ItemIntMap>, IntHeap>();
     86    checkConcept<Heap<Item, Prio, ItemIntMap>, IntHeap>();
    13687    heapSortTest<IntHeap>(100);
    13788    heapIncreaseTest<IntHeap>(100);
    13889
    13990    typedef RadixHeap<Node, Graph::NodeMap<int> > NodeHeap;
    140     checkConcept<HeapConcept<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();
     91    checkConcept<Heap<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();
    14192    dijkstraHeapTest<Graph, LengthMap, NodeHeap>(graph, length, start);
    14293  }
Note: See TracChangeset for help on using the changeset viewer.