src/test/heap_test.cc
changeset 1330 52ef02524468
parent 1325 916ec8699dc3
     1.1 --- a/src/test/heap_test.cc	Fri Apr 08 15:46:12 2005 +0000
     1.2 +++ b/src/test/heap_test.cc	Sat Apr 09 19:27:48 2005 +0000
     1.3 @@ -6,6 +6,7 @@
     1.4  #include <vector>
     1.5  
     1.6  #include <lemon/concept_check.h>
     1.7 +#include <lemon/concept/heap.h>
     1.8  
     1.9  #include <lemon/smart_graph.h>
    1.10  
    1.11 @@ -21,58 +22,8 @@
    1.12  
    1.13  
    1.14  using namespace lemon;
    1.15 +using namespace lemon::concept;
    1.16  
    1.17 -template <typename Item, typename Prio, typename ItemIntMap>
    1.18 -class HeapConcept {
    1.19 -public:  
    1.20 -
    1.21 -  template <typename _Heap>
    1.22 -  struct Constraints {
    1.23 -  public:
    1.24 -    
    1.25 -    void constraints() {
    1.26 -      Item item;
    1.27 -      Prio prio;
    1.28 -
    1.29 -      ignore_unused_variable_warning(item);
    1.30 -      ignore_unused_variable_warning(prio);
    1.31 -
    1.32 -      typedef typename _Heap::state_enum state_enum;
    1.33 -      state_enum state;
    1.34 -
    1.35 -      ignore_unused_variable_warning(state);
    1.36 -      
    1.37 -      _Heap heap1 = _Heap(map);
    1.38 -
    1.39 -      ignore_unused_variable_warning(heap1);
    1.40 -      
    1.41 -      heap.push(item, prio);
    1.42 -
    1.43 -      prio = heap.prio();
    1.44 -      item = heap.top();
    1.45 -
    1.46 -      heap.pop();
    1.47 -
    1.48 -      heap.set(item, prio);
    1.49 -      heap.decrease(item, prio);
    1.50 -      heap.increase(item, prio);
    1.51 -      prio = heap[item];
    1.52 -
    1.53 -      heap.erase(item);
    1.54 -
    1.55 -      state = heap.state(item);
    1.56 -
    1.57 -      state = _Heap::PRE_HEAP;
    1.58 -      state = _Heap::IN_HEAP;
    1.59 -      state = _Heap::POST_HEAP;
    1.60 -    }
    1.61 -    
    1.62 -    _Heap& heap;
    1.63 -    ItemIntMap& map;
    1.64 -
    1.65 -    Constraints() : heap(0), map(0) {}
    1.66 -  };
    1.67 -};
    1.68  
    1.69  int main() {
    1.70  
    1.71 @@ -108,36 +59,36 @@
    1.72      std::cerr << "Checking Bin Heap" << std::endl;
    1.73  
    1.74      typedef BinHeap<Item, Prio, ItemIntMap> IntHeap;
    1.75 -    checkConcept<HeapConcept<Item, Prio, ItemIntMap>, IntHeap>();
    1.76 +    checkConcept<Heap<Item, Prio, ItemIntMap>, IntHeap>();
    1.77      heapSortTest<IntHeap>(100);
    1.78      heapIncreaseTest<IntHeap>(100);
    1.79      
    1.80      typedef FibHeap<Node, Prio, Graph::NodeMap<int> > NodeHeap;
    1.81 -    checkConcept<HeapConcept<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();
    1.82 +    checkConcept<Heap<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();
    1.83      dijkstraHeapTest<Graph, LengthMap, NodeHeap>(graph, length, start);
    1.84    }
    1.85    {
    1.86      std::cerr << "Checking Fib Heap" << std::endl;
    1.87  
    1.88      typedef FibHeap<Item, Prio, ItemIntMap> IntHeap;
    1.89 -    checkConcept<HeapConcept<Item, Prio, ItemIntMap>, IntHeap>();
    1.90 +    checkConcept<Heap<Item, Prio, ItemIntMap>, IntHeap>();
    1.91      heapSortTest<IntHeap>(100);
    1.92      heapIncreaseTest<IntHeap>(100);
    1.93  
    1.94      typedef FibHeap<Node, Prio, Graph::NodeMap<int> > NodeHeap;
    1.95 -    checkConcept<HeapConcept<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();
    1.96 +    checkConcept<Heap<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();
    1.97      dijkstraHeapTest<Graph, LengthMap, NodeHeap>(graph, length, start);
    1.98    }
    1.99    {
   1.100      std::cerr << "Checking Radix Heap" << std::endl;
   1.101  
   1.102      typedef RadixHeap<Item, ItemIntMap> IntHeap;
   1.103 -    checkConcept<HeapConcept<Item, Prio, ItemIntMap>, IntHeap>();
   1.104 +    checkConcept<Heap<Item, Prio, ItemIntMap>, IntHeap>();
   1.105      heapSortTest<IntHeap>(100);
   1.106      heapIncreaseTest<IntHeap>(100);
   1.107  
   1.108      typedef RadixHeap<Node, Graph::NodeMap<int> > NodeHeap;
   1.109 -    checkConcept<HeapConcept<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();
   1.110 +    checkConcept<Heap<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();
   1.111      dijkstraHeapTest<Graph, LengthMap, NodeHeap>(graph, length, start);
   1.112    }
   1.113