Skip to content
Closed
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
60 changes: 60 additions & 0 deletions regression/jbmc-cover/remove-virtual-functions/MyHashMap.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import java.io.PrintStream;

public class MyHashMap {

private Integer[] table;
private int size;

public MyHashMap() {
table = new Integer[8];
size = 0;
}

public void put(Integer key) {
table[size++] = key;
}

public MySet entrySet() {
return new EntrySet();
}

class EntrySet implements MySet {
public final MyIterator iterator() {
return new UselessIterator();
}
}

class UselessIterator implements MyIterator {
boolean b;
UselessIterator() {
b = true;
}
public boolean someBoolean() {
return b;
}
public void next() {
b = false;
}
}

public MySet keySet() {
return new KeySet();
}

class KeySet implements MySet {
public final MyIterator iterator() {
return new UselessIterator();
}
}

public static boolean test() {
MyHashMap hm = new MyHashMap();
MySet es = hm.entrySet();
MyIterator it = es.iterator();
while (it.someBoolean()) {
it.next();
}
return true;
}

}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
public interface MyIterator {

boolean someBoolean();

void next();

}
Binary file not shown.
5 changes: 5 additions & 0 deletions regression/jbmc-cover/remove-virtual-functions/MySet.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
public interface MySet {

public MyIterator iterator();

}
8 changes: 8 additions & 0 deletions regression/jbmc-cover/remove-virtual-functions/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
MyHashMap.class
--function MyHashMap.test --unwind 5 --cover location
java::MyHashMap.test.*coverage.*SATISFIED
--
java::MyHashMap.test.*coverage.*FAILED
--
Checks that TG-1404 is fixed