Skip to content

Commit 3365054

Browse files
author
Matthias Güdemann
committed
Add regression test
1 parent 2b6dc8b commit 3365054

16 files changed

+103
-0
lines changed
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
public abstract class AbstractList<E>
2+
implements List<E>
3+
{
4+
public Iterator<E> iterator() {
5+
return new Itr();
6+
}
7+
8+
public ListIterator<E> listIterator() {
9+
return listIterator(0);
10+
}
11+
12+
public boolean equals(Object o) {
13+
if (o == this)
14+
return true;
15+
if (!(o instanceof List))
16+
return false;
17+
18+
ListIterator<E> e1 = listIterator();
19+
ListIterator<?> e2 = ((List<?>) o).listIterator();
20+
while (e1.hasNext() && e2.hasNext()) {
21+
E o1 = e1.next();
22+
Object o2 = e2.next();
23+
if (!(o1==null ? o2==null : o1.equals(o2)))
24+
return false;
25+
}
26+
return !(e1.hasNext() || e2.hasNext());
27+
}
28+
29+
private class Itr implements Iterator<E> {
30+
Itr() {
31+
}
32+
33+
public boolean hasNext() {
34+
return false;
35+
}
36+
37+
public E next() {
38+
return null;
39+
}
40+
41+
}
42+
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
public class ArrayList<E> extends AbstractList<E>
2+
implements List<E>
3+
{
4+
public ListIterator<E> listIterator() {
5+
return new ListItr(0);
6+
}
7+
public ListIterator<E> listIterator(int index) {
8+
return new ListItr(index);
9+
}
10+
private class ListItr extends Itr implements ListIterator<E> {
11+
ListItr(int index) {
12+
super();
13+
}
14+
15+
public boolean hasPrevious() {
16+
return false;
17+
}
18+
}
19+
20+
private class Itr implements Iterator<E> {
21+
Itr() {
22+
}
23+
24+
public boolean hasNext() {
25+
return false;
26+
}
27+
public E next() {
28+
return null;
29+
}
30+
}
31+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
public class ArrayListEquals {
2+
3+
public int check2(ArrayList<Integer> l1) {
4+
ArrayList<Integer> al = new ArrayList<Integer>();
5+
if(l1.equals(al))
6+
return 1;
7+
else
8+
return 0;
9+
}
10+
11+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
public interface Iterator<E> {
2+
boolean hasNext();
3+
E next();
4+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
public interface List<E> {
2+
ListIterator<E> listIterator();
3+
ListIterator<E> listIterator(int index);
4+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
public interface ListIterator<E> extends Iterator<E> {
2+
boolean hasNext();
3+
boolean hasPrevious();
4+
E next();
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
ArrayListEquals.class
3+
--lazy-methods --java-max-vla-length 48 --unwind 8 --java-unwind-enum-static --trace --cover location --function ArrayListEquals.check2 --show-goto-functions
4+
e2 . ArrayList\$Itr.hasNext:\(\)Z\(\);
5+
--
6+
e2 . ListIterator.hasNext:\(\)Z\(\);

0 commit comments

Comments
 (0)