add test for hashcode/equals with sorted and unsorted lists
This commit is contained in:
@@ -516,6 +516,7 @@ public class IntListTest {
|
||||
Assert.assertTrue(list.isSorted());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unlikely-arg-type")
|
||||
@Test
|
||||
public void testHashCodeEquals() {
|
||||
final IntList a = new IntList();
|
||||
@@ -537,8 +538,6 @@ public class IntListTest {
|
||||
Assert.assertTrue(a.equals(b));
|
||||
Assert.assertEquals(a.hashCode(), b.hashCode());
|
||||
|
||||
// TODO sorted and unsorted lists with same length
|
||||
|
||||
// change one value
|
||||
a.remove(2, 3);
|
||||
a.insert(2, 99);
|
||||
@@ -558,6 +557,12 @@ public class IntListTest {
|
||||
|
||||
// equals with a different class
|
||||
Assert.assertFalse(a.equals("not an IntList"));
|
||||
|
||||
// sorted and unsorted lists with same length
|
||||
final IntList sorted = IntList.of(1, 2, 3, 4);
|
||||
final IntList unsorted = IntList.of(4, 3, 2, 1);
|
||||
Assert.assertFalse(sorted.equals(unsorted));
|
||||
Assert.assertNotEquals(sorted.hashCode(), unsorted.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user