MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / testGetMinKey

Method testGetMinKey

JSAT/test/jsat/utils/FibHeapTest.java:133–162  ·  view source on GitHub ↗

Test of getMinKey method, of class FibHeap.

()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

sizeMethod · 0.95
insertMethod · 0.95
getMinValueMethod · 0.95
removeMinMethod · 0.95

Tested by

no test coverage detected