New Tests & BugFixes

-Added: Tests for the Copying of Collections.
-Fixed: PriorityQueues didn't have hashCode/equals/toString implemented
This commit is contained in:
2021-10-06 20:23:40 +02:00
parent 0c4ef7f6c4
commit 54c9660145
14 changed files with 86 additions and 5 deletions
@@ -135,6 +135,16 @@ public abstract class BaseInt2IntMapTest
Assert.assertTrue(map.remove(PUT_VALUE_ARRAY[51], PUT_ARRAY[51]));
}
@Test
public void testSort()
{
if(!getValidMapTests().contains(MapTests.COPY)) return;
Int2IntMap map = createMap(TEST_ARRAY, TEST_ARRAY);
Int2IntMap copy = map.copy();
Assert.assertFalse(map == copy);
Assert.assertEquals(map, copy);
}
public static class Strategy implements IntStrategy
{
@Override
@@ -178,4 +178,13 @@ public abstract class BaseIntCollectionTest extends BaseIntIterableTest
Assert.assertEquals(base, IntCollections.synchronize(collection).toString());
Assert.assertEquals(base, IntCollections.unmodifiable(collection).toString());
}
@Test
public void testCopy() {
if(!getValidCollectionTests().contains(CollectionTest.COPY)) return;
IntCollection collection = create(BULK_ADD_ARRAY);
IntCollection copy = collection.copy();
Assert.assertFalse(collection == copy);
Assert.assertEquals(collection, copy);
}
}
@@ -120,4 +120,13 @@ public abstract class BaseIntPriorityQueueTest extends BaseIntIterableTest
}
}
}
@Test
public void testCopy() {
if(!getValidPriorityQueueTests().contains(PriorityQueueTest.COPY)) return;
IntPriorityQueue queue = create(TEST_ARRAY);
IntPriorityQueue copy = queue.copy();
Assert.assertFalse(queue == copy);
Assert.assertEquals(queue, copy);
}
}
@@ -15,5 +15,6 @@ public enum CollectionTest
TO_ARRAY,
CLEAR,
WRAPPER,
TO_STRING;
TO_STRING,
COPY;
}
@@ -11,5 +11,6 @@ public enum MapTests
MERGE,
GET,
ITERATORS,
REMOVE;
REMOVE,
COPY;
}
@@ -7,4 +7,5 @@ public enum PriorityQueueTest
PEEK,
REMOVE,
TO_ARRAY,
COPY;
}