Changeset 1330:52ef02524468 in lemon-0.x for src/test
- Timestamp:
- 04/09/05 21:27:48 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1769
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/test/heap_test.cc
r1325 r1330 7 7 8 8 #include <lemon/concept_check.h> 9 #include <lemon/concept/heap.h> 9 10 10 11 #include <lemon/smart_graph.h> … … 22 23 23 24 using namespace lemon; 25 using namespace lemon::concept; 24 26 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 };76 27 77 28 int main() { … … 109 60 110 61 typedef BinHeap<Item, Prio, ItemIntMap> IntHeap; 111 checkConcept<Heap Concept<Item, Prio, ItemIntMap>, IntHeap>();62 checkConcept<Heap<Item, Prio, ItemIntMap>, IntHeap>(); 112 63 heapSortTest<IntHeap>(100); 113 64 heapIncreaseTest<IntHeap>(100); 114 65 115 66 typedef FibHeap<Node, Prio, Graph::NodeMap<int> > NodeHeap; 116 checkConcept<Heap Concept<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();67 checkConcept<Heap<Node, Prio, Graph::NodeMap<int> >, NodeHeap>(); 117 68 dijkstraHeapTest<Graph, LengthMap, NodeHeap>(graph, length, start); 118 69 } … … 121 72 122 73 typedef FibHeap<Item, Prio, ItemIntMap> IntHeap; 123 checkConcept<Heap Concept<Item, Prio, ItemIntMap>, IntHeap>();74 checkConcept<Heap<Item, Prio, ItemIntMap>, IntHeap>(); 124 75 heapSortTest<IntHeap>(100); 125 76 heapIncreaseTest<IntHeap>(100); 126 77 127 78 typedef FibHeap<Node, Prio, Graph::NodeMap<int> > NodeHeap; 128 checkConcept<Heap Concept<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();79 checkConcept<Heap<Node, Prio, Graph::NodeMap<int> >, NodeHeap>(); 129 80 dijkstraHeapTest<Graph, LengthMap, NodeHeap>(graph, length, start); 130 81 } … … 133 84 134 85 typedef RadixHeap<Item, ItemIntMap> IntHeap; 135 checkConcept<Heap Concept<Item, Prio, ItemIntMap>, IntHeap>();86 checkConcept<Heap<Item, Prio, ItemIntMap>, IntHeap>(); 136 87 heapSortTest<IntHeap>(100); 137 88 heapIncreaseTest<IntHeap>(100); 138 89 139 90 typedef RadixHeap<Node, Graph::NodeMap<int> > NodeHeap; 140 checkConcept<Heap Concept<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();91 checkConcept<Heap<Node, Prio, Graph::NodeMap<int> >, NodeHeap>(); 141 92 dijkstraHeapTest<Graph, LengthMap, NodeHeap>(graph, length, start); 142 93 }
Note: See TracChangeset
for help on using the changeset viewer.