From e9b5d6837f68d406542aa98371b6492a5d0fb257 Mon Sep 17 00:00:00 2001 From: ExtraDev Date: Thu, 7 May 2026 11:28:14 +0200 Subject: [PATCH] A comment to indicate that this test (modify an element then remove) may rightly fail in some cases. Changed also the name of the test to indicate that the value is changed. --- .../insa/graphs/algorithm/utils/PriorityQueueTest.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/be-graphes-algos/src/test/java/org/insa/graphs/algorithm/utils/PriorityQueueTest.java b/be-graphes-algos/src/test/java/org/insa/graphs/algorithm/utils/PriorityQueueTest.java index aca7b79..6804650 100644 --- a/be-graphes-algos/src/test/java/org/insa/graphs/algorithm/utils/PriorityQueueTest.java +++ b/be-graphes-algos/src/test/java/org/insa/graphs/algorithm/utils/PriorityQueueTest.java @@ -314,7 +314,14 @@ public abstract class PriorityQueueTest { } @Test - public void testRemoveThenAdd() { + /** + * This test may fail if your algorithm for remove assumes the heap is well-formed + * (i.e. you assume the element to remove is at its right position). + * + * In that case, you can remove this test, but note that remove must always be invoked on a well-formed heap. + * In particular, in your Dijkstra implementation, do not modify an element that is in the heap. + */ + public void ModifyInPlaceThenRemoveThenAdd() { Assume.assumeFalse(queue.isEmpty()); int min = Collections.min(Arrays.asList(parameters.data)).get(); for (MutableInteger mi : parameters.data) {