Skip to content

Commit 90286a8

Browse files
author
thk123
committed
Adding regression tests showing the modified gen code works
The nondet generation code has been modified to select a concrete subtype when given an abstract type. These tests verify these cases are correctly generated.
1 parent e4ac6e2 commit 90286a8

File tree

36 files changed

+282
-0
lines changed

36 files changed

+282
-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,44 @@
1+
interface I
2+
{
3+
int getANumber();
4+
}
5+
6+
class A implements I {
7+
public int a;
8+
9+
public int getANumber() { return a; }
10+
}
11+
12+
class B implements I {
13+
public int b;
14+
public int getANumber() { return b; }
15+
}
16+
17+
class TestClass
18+
{
19+
public I someObject;
20+
21+
public boolean foo() {
22+
if(someObject!=null)
23+
{
24+
int result = someObject.getANumber();
25+
if(result == 42) {
26+
return true;
27+
} else {
28+
return false;
29+
}
30+
}
31+
else
32+
{
33+
return false;
34+
}
35+
}
36+
37+
public static void main(String[] args)
38+
{
39+
// ensure that A, B are referenced explicitly
40+
// in order to get them converted into GOTO
41+
A a = new A();
42+
B b = new B();
43+
}
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
TestClass.class
3+
--cover location --function TestClass.foo --show-goto-functions
4+
5+
\.someObject = \(struct I \*\)\w+
6+
@class_identifier = "java::A";
Binary file not shown.
Binary file not shown.
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,61 @@
1+
interface I
2+
{
3+
int getANumber();
4+
}
5+
6+
class A implements I {
7+
public int a;
8+
9+
public int getANumber() { return a; }
10+
}
11+
12+
class B implements I {
13+
public int b;
14+
public int getANumber() { return b; }
15+
}
16+
17+
interface J
18+
{
19+
int getANumber();
20+
}
21+
22+
class C implements J {
23+
public int c;
24+
public int getANumber() { return c; }
25+
}
26+
27+
class D implements J {
28+
public int d;
29+
public int getANumber() { return d; }
30+
}
31+
32+
class TestClass
33+
{
34+
public I someObject1;
35+
public J someObject2;
36+
37+
public boolean foo() {
38+
if(someObject1 != null && someObject2 != null)
39+
{
40+
if(someObject1.getANumber() == someObject2.getANumber()) {
41+
return true;
42+
} else {
43+
return false;
44+
}
45+
}
46+
else
47+
{
48+
return false;
49+
}
50+
}
51+
52+
public static void main(String[] args)
53+
{
54+
// ensure that A, B, C, D are referenced explicitly
55+
// in order to get them converted into GOTO
56+
A a = new A();
57+
B b = new B();
58+
C c = new C();
59+
D d = new D();
60+
}
61+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
TestClass.class
3+
--cover location --function TestClass.foo --show-goto-functions
4+
5+
@class_identifier = "java::A";
6+
@class_identifier = "java::C";
7+
.someObject1 = \(struct I \*\)
8+
.someObject2 = \(struct J \*\)
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,42 @@
1+
interface I
2+
{
3+
int getANumber();
4+
}
5+
6+
class A implements I {
7+
public int a;
8+
9+
public int getANumber() { return a; }
10+
}
11+
12+
class B implements I {
13+
public int b;
14+
public int getANumber() { return b; }
15+
}
16+
17+
class TestClass
18+
{
19+
public static boolean foo(I someObject) {
20+
if(someObject!=null)
21+
{
22+
int result = someObject.getANumber();
23+
if(result == 42) {
24+
return true;
25+
} else {
26+
return false;
27+
}
28+
}
29+
else
30+
{
31+
return false;
32+
}
33+
}
34+
35+
public static void main(String[] args)
36+
{
37+
// ensure that A, B are referenced explicitly
38+
// in order to get them converted into GOTO
39+
A a = new A();
40+
B b = new B();
41+
}
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
TestClass.class
3+
--cover location --function TestClass.foo --show-goto-functions
4+
5+
@class_identifier = "java::A";
6+
= \(struct I \*\)
7+
tmp_object_factory\$\d+ = null;
Binary file not shown.
Binary file not shown.
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,57 @@
1+
interface I
2+
{
3+
int getANumber();
4+
}
5+
6+
class A implements I {
7+
public int a;
8+
public int getANumber() { return a; }
9+
}
10+
11+
class B implements I {
12+
public int b;
13+
public int getANumber() { return b; }
14+
}
15+
16+
interface J
17+
{
18+
int getANumber();
19+
}
20+
21+
class C implements J {
22+
public int c;
23+
public int getANumber() { return c; }
24+
}
25+
26+
class D implements J {
27+
public int d;
28+
public int getANumber() { return d; }
29+
}
30+
31+
class TestClass
32+
{
33+
public static boolean foo(I someObject1, J someObject2) {
34+
if(someObject1 != null && someObject2 != null)
35+
{
36+
if(someObject1.getANumber() == someObject2.getANumber()) {
37+
return true;
38+
} else {
39+
return false;
40+
}
41+
}
42+
else
43+
{
44+
return false;
45+
}
46+
}
47+
48+
public static void main(String[] args)
49+
{
50+
// ensure that A, B, C, D are referenced explicitly
51+
// in order to get them converted into GOTO
52+
A a = new A();
53+
B b = new B();
54+
C c = new C();
55+
D d = new D();
56+
}
57+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
TestClass.class
3+
--cover location --function TestClass.foo --show-goto-functions
4+
5+
@class_identifier = "java::A";
6+
= \(struct I \*\)
7+
@class_identifier = "java::C";
8+
= \(struct J \*\)
9+
tmp_object_factory\$\d+ = null;
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,41 @@
1+
interface I
2+
{
3+
int getANumber();
4+
}
5+
6+
class A implements I {
7+
public int a;
8+
9+
public int getANumber() { return a; }
10+
}
11+
12+
class B implements I {
13+
public int b;
14+
public int getANumber() { return b; }
15+
}
16+
17+
class TestClass
18+
{
19+
public static boolean foo(I someObject1, I someObject2) {
20+
if(someObject1 != null && someObject2 != null)
21+
{
22+
if(someObject1.getANumber() == someObject2.getANumber()) {
23+
return true;
24+
} else {
25+
return false;
26+
}
27+
}
28+
else
29+
{
30+
return false;
31+
}
32+
}
33+
34+
public static void main(String[] args)
35+
{
36+
// ensure that A, B are referenced explicitly
37+
// in order to get them converted into GOTO
38+
A a = new A();
39+
B b = new B();
40+
}
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
TestClass.class
3+
--cover location --function TestClass.foo --show-goto-functions
4+
5+
@class_identifier = "java::A";
6+
= \(struct I \*\)
7+
tmp_object_factory\$\d+ = null;

0 commit comments

Comments
 (0)