mirror of https://github.com/apache/lucene.git
LUCENE-8402: Remove invalid identityHashCode assertions in TestPriorityQueue.
This commit is contained in:
parent
f6e9d00b90
commit
a19bc5ecb6
|
@ -32,13 +32,6 @@ public class TestPriorityQueue extends LuceneTestCase {
|
|||
|
||||
@Override
|
||||
protected boolean lessThan(Integer a, Integer b) {
|
||||
if (a.equals(b)) {
|
||||
assert (a != b);
|
||||
int hashA = System.identityHashCode(a);
|
||||
int hashB = System.identityHashCode(b);
|
||||
assert (hashA != hashB);
|
||||
return hashA < hashB;
|
||||
}
|
||||
return (a < b);
|
||||
}
|
||||
|
||||
|
@ -47,12 +40,12 @@ public class TestPriorityQueue extends LuceneTestCase {
|
|||
for (int i = 1; i <= size(); i++) {
|
||||
int parent = i >>> 1;
|
||||
if (parent > 1) {
|
||||
assertTrue(lessThan((Integer) heapArray[parent],
|
||||
(Integer) heapArray[i]));
|
||||
if (lessThan((Integer) heapArray[parent], (Integer) heapArray[i]) == false) {
|
||||
assertEquals(heapArray[parent], heapArray[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void testPQ() throws Exception {
|
||||
|
@ -63,8 +56,7 @@ public class TestPriorityQueue extends LuceneTestCase {
|
|||
PriorityQueue<Integer> pq = new IntegerQueue(count);
|
||||
int sum = 0, sum2 = 0;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
for (int i = 0; i < count; i++) {
|
||||
int next = gen.nextInt();
|
||||
sum += next;
|
||||
pq.add(next);
|
||||
|
@ -78,8 +70,7 @@ public class TestPriorityQueue extends LuceneTestCase {
|
|||
// start = new Date();
|
||||
|
||||
int last = Integer.MIN_VALUE;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
for (int i = 0; i < count; i++) {
|
||||
Integer next = pq.pop();
|
||||
assertTrue(next.intValue() >= last);
|
||||
last = next.intValue();
|
||||
|
@ -230,7 +221,6 @@ public class TestPriorityQueue extends LuceneTestCase {
|
|||
});
|
||||
}
|
||||
|
||||
@AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/LUCENE-8402")
|
||||
public void testIteratorRandom() {
|
||||
final int maxSize = TestUtil.nextInt(random(), 1, 20);
|
||||
IntegerQueue queue = new IntegerQueue(maxSize);
|
||||
|
|
Loading…
Reference in New Issue