Changes in / [708:5d313b76f323:700:6f7c1052d260] in lemon-main
- Files:
-
- 4 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/Makefile.am
r708 r700 61 61 lemon/bfs.h \ 62 62 lemon/bin_heap.h \ 63 lemon/binom_heap.h \64 63 lemon/bucket_heap.h \ 65 64 lemon/cbc.h \ … … 81 80 lemon/euler.h \ 82 81 lemon/fib_heap.h \ 83 lemon/fourary_heap.h \84 82 lemon/full_graph.h \ 85 83 lemon/glpk.h \ … … 88 86 lemon/grid_graph.h \ 89 87 lemon/hypercube_graph.h \ 90 lemon/kary_heap.h \91 88 lemon/kruskal.h \ 92 89 lemon/hao_orlin.h \ … … 103 100 lemon/nauty_reader.h \ 104 101 lemon/network_simplex.h \ 105 lemon/pairing_heap.h \106 102 lemon/path.h \ 107 103 lemon/preflow.h \ -
test/heap_test.cc
r702 r681 26 26 27 27 #include <lemon/smart_graph.h> 28 28 29 #include <lemon/lgf_reader.h> 29 30 #include <lemon/dijkstra.h> … … 31 32 32 33 #include <lemon/bin_heap.h> 33 #include <lemon/fourary_heap.h>34 #include <lemon/kary_heap.h>35 34 #include <lemon/fib_heap.h> 36 #include <lemon/pairing_heap.h>37 35 #include <lemon/radix_heap.h> 38 #include <lemon/binom_heap.h>39 36 #include <lemon/bucket_heap.h> 40 37 … … 93 90 void heapSortTest() { 94 91 RangeMap<int> map(test_len, -1); 92 95 93 Heap heap(map); 96 94 97 95 std::vector<int> v(test_len); 96 98 97 for (int i = 0; i < test_len; ++i) { 99 98 v[i] = test_seq[i]; … … 102 101 std::sort(v.begin(), v.end()); 103 102 for (int i = 0; i < test_len; ++i) { 104 check(v[i] == heap.prio() ,"Wrong order in heap sort.");103 check(v[i] == heap.prio() ,"Wrong order in heap sort."); 105 104 heap.pop(); 106 105 } … … 114 113 115 114 std::vector<int> v(test_len); 115 116 116 for (int i = 0; i < test_len; ++i) { 117 117 v[i] = test_seq[i]; … … 124 124 std::sort(v.begin(), v.end()); 125 125 for (int i = 0; i < test_len; ++i) { 126 check(v[i] == heap.prio() ,"Wrong order in heap increase test.");126 check(v[i] == heap.prio() ,"Wrong order in heap increase test."); 127 127 heap.pop(); 128 128 } 129 129 } 130 131 130 132 131 133 template <typename Heap> … … 143 145 if (dijkstra.reached(s)) { 144 146 check( dijkstra.dist(t) - dijkstra.dist(s) <= length[a], 145 "Error in shortest path tree.");147 "Error in a shortest path tree!"); 146 148 } 147 149 } … … 152 154 Node s = digraph.source(a); 153 155 check( dijkstra.dist(n) - dijkstra.dist(s) == length[a], 154 "Error in shortest path tree.");156 "Error in a shortest path tree!"); 155 157 } 156 158 } … … 174 176 run(); 175 177 176 // BinHeap177 178 { 178 179 typedef BinHeap<Prio, ItemIntMap> IntHeap; … … 186 187 } 187 188 188 // FouraryHeap189 {190 typedef FouraryHeap<Prio, ItemIntMap> IntHeap;191 checkConcept<Heap<Prio, ItemIntMap>, IntHeap>();192 heapSortTest<IntHeap>();193 heapIncreaseTest<IntHeap>();194 195 typedef FouraryHeap<Prio, IntNodeMap > NodeHeap;196 checkConcept<Heap<Prio, IntNodeMap >, NodeHeap>();197 dijkstraHeapTest<NodeHeap>(digraph, length, source);198 }199 200 // KaryHeap201 {202 typedef KaryHeap<Prio, ItemIntMap> IntHeap;203 checkConcept<Heap<Prio, ItemIntMap>, IntHeap>();204 heapSortTest<IntHeap>();205 heapIncreaseTest<IntHeap>();206 207 typedef KaryHeap<Prio, IntNodeMap > NodeHeap;208 checkConcept<Heap<Prio, IntNodeMap >, NodeHeap>();209 dijkstraHeapTest<NodeHeap>(digraph, length, source);210 }211 212 // FibHeap213 189 { 214 190 typedef FibHeap<Prio, ItemIntMap> IntHeap; … … 222 198 } 223 199 224 // PairingHeap225 {226 typedef PairingHeap<Prio, ItemIntMap> IntHeap;227 checkConcept<Heap<Prio, ItemIntMap>, IntHeap>();228 heapSortTest<IntHeap>();229 heapIncreaseTest<IntHeap>();230 231 typedef PairingHeap<Prio, IntNodeMap > NodeHeap;232 checkConcept<Heap<Prio, IntNodeMap >, NodeHeap>();233 dijkstraHeapTest<NodeHeap>(digraph, length, source);234 }235 236 // RadixHeap237 200 { 238 201 typedef RadixHeap<ItemIntMap> IntHeap; … … 246 209 } 247 210 248 // BinomHeap249 {250 typedef BinomHeap<Prio, ItemIntMap> IntHeap;251 checkConcept<Heap<Prio, ItemIntMap>, IntHeap>();252 heapSortTest<IntHeap>();253 heapIncreaseTest<IntHeap>();254 255 typedef BinomHeap<Prio, IntNodeMap > NodeHeap;256 checkConcept<Heap<Prio, IntNodeMap >, NodeHeap>();257 dijkstraHeapTest<NodeHeap>(digraph, length, source);258 }259 260 // BucketHeap, SimpleBucketHeap261 211 { 262 212 typedef BucketHeap<ItemIntMap> IntHeap; … … 268 218 checkConcept<Heap<Prio, IntNodeMap >, NodeHeap>(); 269 219 dijkstraHeapTest<NodeHeap>(digraph, length, source); 270 271 typedef SimpleBucketHeap<ItemIntMap> SimpleIntHeap; 272 heapSortTest<SimpleIntHeap>(); 273 } 220 } 221 274 222 275 223 return 0;
Note: See TracChangeset
for help on using the changeset viewer.