Test of getMinKey method, of class FibHeap.
()
| 131 | * Test of getMinKey method, of class FibHeap. |
| 132 | */ |
| 133 | @Test |
| 134 | public void testGetMinKey() |
| 135 | { |
| 136 | System.out.println("getMinKey"); |
| 137 | FibHeap<String> heap = new FibHeap<String>(); |
| 138 | |
| 139 | FibHeap.FibNode<String> min; |
| 140 | |
| 141 | assertEquals(0, heap.size()); |
| 142 | heap.insert("A", 1.0); |
| 143 | heap.insert("B", 0.5); |
| 144 | heap.insert("C", 2.0); |
| 145 | assertEquals(3, heap.size()); |
| 146 | assertEquals("B", heap.getMinValue()); |
| 147 | |
| 148 | min = heap.removeMin(); |
| 149 | assertEquals("B", min.value); |
| 150 | assertEquals(2, heap.size()); |
| 151 | assertEquals("A", heap.getMinValue()); |
| 152 | |
| 153 | min = heap.removeMin(); |
| 154 | assertEquals("A", min.value); |
| 155 | assertEquals(1, heap.size()); |
| 156 | assertEquals("C", heap.getMinValue()); |
| 157 | |
| 158 | min = heap.removeMin(); |
| 159 | assertEquals("C", min.value); |
| 160 | assertEquals(0, heap.size()); |
| 161 | |
| 162 | } |
| 163 | |
| 164 | |
| 165 | @Test |
nothing calls this directly
no test coverage detected