Skip to content

Commit b0ed1bd

Browse files
Add tests for boolean constant propagation in java
Check that symex can resolve what value a boolean takes after a condition which means that it can only take one value
1 parent fc57d6f commit b0ed1bd

12 files changed

+181
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
class Test {
2+
static public void noComparison(boolean my_boolean)
3+
{
4+
if(my_boolean)
5+
assert(my_boolean == true);
6+
}
7+
8+
static public void notNoComparison(boolean my_boolean)
9+
{
10+
if(!my_boolean)
11+
assert(my_boolean == false);
12+
}
13+
14+
static public void equalsTrue(boolean my_boolean)
15+
{
16+
if(my_boolean == true)
17+
assert(my_boolean == true);
18+
}
19+
20+
static public void equalsFalse(boolean my_boolean)
21+
{
22+
if(my_boolean == false)
23+
assert(my_boolean == false);
24+
}
25+
26+
static public void notEqualsTrue(boolean my_boolean)
27+
{
28+
if(!(my_boolean == true))
29+
assert(my_boolean == false);
30+
}
31+
32+
static public void notEqualsFalse(boolean my_boolean)
33+
{
34+
if(!(my_boolean == false))
35+
assert(my_boolean == true);
36+
}
37+
38+
static public void disequalsTrue(boolean my_boolean)
39+
{
40+
if(my_boolean != true)
41+
assert(my_boolean == false);
42+
}
43+
44+
static public void disequalsFalse(boolean my_boolean)
45+
{
46+
if(my_boolean != false)
47+
assert(my_boolean == true);
48+
}
49+
50+
static public void notDisequalsTrue(boolean my_boolean)
51+
{
52+
if(!(my_boolean != true))
53+
assert(my_boolean == true);
54+
}
55+
56+
static public void notDisequalsFalse(boolean my_boolean)
57+
{
58+
if(!(my_boolean != false))
59+
assert(my_boolean == false);
60+
}
61+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
Test.class
3+
--function Test.disequalsFalse
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
0 remaining after simplification$
8+
--
9+
^warning: ignoring
10+
--
11+
Assumption and GOTO condition propagation means this test should be
12+
entirely decided by symex.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
Test.class
3+
--function Test.disequalsTrue
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
0 remaining after simplification$
8+
--
9+
^warning: ignoring
10+
--
11+
Assumption and GOTO condition propagation means this test should be
12+
entirely decided by symex.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
Test.class
3+
--function Test.equalsFalse
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
0 remaining after simplification$
8+
--
9+
^warning: ignoring
10+
--
11+
Assumption and GOTO condition propagation means this test should be
12+
entirely decided by symex.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
Test.class
3+
--function Test.equalsTrue
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
0 remaining after simplification$
8+
--
9+
^warning: ignoring
10+
--
11+
Assumption and GOTO condition propagation means this test should be
12+
entirely decided by symex.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
Test.class
3+
--function Test.noComparison
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
0 remaining after simplification$
8+
--
9+
^warning: ignoring
10+
--
11+
Assumption and GOTO condition propagation means this test should be
12+
entirely decided by symex.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
Test.class
3+
--function Test.notDisequalsFalse
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
0 remaining after simplification$
8+
--
9+
^warning: ignoring
10+
--
11+
Assumption and GOTO condition propagation means this test should be
12+
entirely decided by symex.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
Test.class
3+
--function Test.notDisequalsFalse
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
0 remaining after simplification$
8+
--
9+
^warning: ignoring
10+
--
11+
Assumption and GOTO condition propagation means this test should be
12+
entirely decided by symex.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
Test.class
3+
--function Test.notEqualsFalse
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
0 remaining after simplification$
8+
--
9+
^warning: ignoring
10+
--
11+
Assumption and GOTO condition propagation means this test should be
12+
entirely decided by symex.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
Test.class
3+
--function Test.notEqualsTrue
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
0 remaining after simplification$
8+
--
9+
^warning: ignoring
10+
--
11+
Assumption and GOTO condition propagation means this test should be
12+
entirely decided by symex.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
Test.class
3+
--function Test.notNoComparison
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
0 remaining after simplification$
8+
--
9+
^warning: ignoring
10+
--
11+
Assumption and GOTO condition propagation means this test should be
12+
entirely decided by symex.

0 commit comments

Comments
 (0)