Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,10 @@ public boolean equals(@Nullable Object o){
if (o instanceof SubList){
SubList otherList = (SubList) o;

return base.equals(otherList.base) && offset == otherList.offset && length == otherList.length;
if (base.equals(otherList.base) && offset == otherList.offset && length == otherList.length) {
return true;
}
// else we still not need check, because sublists can be equal at different positions
}

if (o instanceof IList) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.Random;
import java.util.Set;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ArgumentsSource;

Expand Down Expand Up @@ -277,6 +278,12 @@ public void testSubList(IValueFactory vf) {
bSubList = bList.sublist(15, 5);
oSubList = oList.sublist(15, 5);
checkSubListEquality(fSubList, bSubList, oSubList);

// issue #333
var myList = vf.list(
vf.integer(1), vf.integer(2), vf.integer(3), vf.integer(4), vf.integer(5),
vf.integer(1), vf.integer(2), vf.integer(3), vf.integer(4), vf.integer(5));
Assertions.assertEquals(myList.sublist(0, 4), myList.sublist(5, 4));
}

private static void checkSubListEquality(IList fList, IList bList, IList oList) {
Expand Down
Loading