Skip to content

Commit 94c2ccd

Browse files
Regression test for remove_virtual_functions
This test shows that coverage issue with virtual functions is fixed (TG-1404).
1 parent 0df054c commit 94c2ccd

10 files changed

+80
-0
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import java.io.PrintStream;
2+
3+
public class MyHashMap {
4+
5+
private Integer[] table;
6+
private int size;
7+
8+
public MyHashMap() {
9+
table = new Integer[8];
10+
size = 0;
11+
}
12+
13+
public void put(Integer key) {
14+
table[size++] = key;
15+
}
16+
17+
public MySet entrySet() {
18+
return new EntrySet();
19+
}
20+
21+
class EntrySet implements MySet {
22+
public final MyIterator iterator() {
23+
return new UselessIterator();
24+
}
25+
}
26+
27+
class UselessIterator implements MyIterator {
28+
boolean b;
29+
UselessIterator() {
30+
b = true;
31+
}
32+
public boolean someBoolean() {
33+
return b;
34+
}
35+
public void next() {
36+
b = false;
37+
}
38+
}
39+
40+
public MySet keySet() {
41+
return new KeySet();
42+
}
43+
44+
class KeySet implements MySet {
45+
public final MyIterator iterator() {
46+
return new UselessIterator();
47+
}
48+
}
49+
50+
public static boolean test() {
51+
MyHashMap hm = new MyHashMap();
52+
MySet es = hm.entrySet();
53+
MyIterator it = es.iterator();
54+
while (it.someBoolean()) {
55+
it.next();
56+
}
57+
return true;
58+
}
59+
60+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
public interface MyIterator {
2+
3+
boolean someBoolean();
4+
5+
void next();
6+
7+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
public interface MySet {
2+
3+
public MyIterator iterator();
4+
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
MyHashMap.class
3+
--function MyHashMap.test --unwind 5 --cover location
4+
java::MyHashMap.test.*coverage.*SATISFIED
5+
--
6+
java::MyHashMap.test.*coverage.*FAILED
7+
--
8+
Checks that TG-1404 is fixed

0 commit comments

Comments
 (0)