Less warnings. Changed a priority queue test to check if updating an element and removing it works.

This commit is contained in:
Didier Le Botlan
2025-03-28 09:28:14 +01:00
parent 443539a6ba
commit 375e783c42
5 changed files with 15 additions and 2 deletions

View File

@@ -83,6 +83,8 @@ public abstract class PriorityQueueTest {
public final E[] data;
public final int[] deleteOrder;
// data contains values
// deleteOrder contains indexes in data[]
public TestParameters(E[] data, int[] deleteOrder) {
this.data = data;
this.deleteOrder = deleteOrder;
@@ -309,9 +311,10 @@ public abstract class PriorityQueueTest {
Assume.assumeFalse(queue.isEmpty());
int min = Collections.min(Arrays.asList(parameters.data)).get();
for (MutableInteger mi : parameters.data) {
// Update value before removing it. This is what happens when updating a Dijkstra label before updating it.
mi.set(--min);
queue.remove(mi);
assertEquals(parameters.data.length - 1, queue.size());
mi.set(--min);
queue.insert(mi);
assertEquals(parameters.data.length, queue.size());
assertEquals(min, queue.findMin().get());