forked from diffblue/cbmc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add regression tests for initialization of Java main args
- Loading branch information
1 parent
7348c74
commit b726dd1
Showing
47 changed files
with
295 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
11 changes: 11 additions & 0 deletions
11
jbmc/regression/jbmc/main-args-elements-non-null1/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
public class Main | ||
{ | ||
public static void main(String[] args) | ||
{ | ||
if(args.length>1) | ||
{ | ||
assert(args[0] != null); // must hold | ||
assert(args[1] != null); // must hold | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
Main.class | ||
|
||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
public class Main | ||
{ | ||
public static void main(String[] args) | ||
{ | ||
if(args.length>0) { | ||
assert(args[0] != null); // must not fail | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
Main.class | ||
|
||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
7 changes: 7 additions & 0 deletions
7
jbmc/regression/jbmc/main-args-non-null-with-function1/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
public class Main | ||
{ | ||
public static void main(String[] args) | ||
{ | ||
assert(args != null); // must hold | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
jbmc/regression/jbmc/main-args-non-null-with-function1/test.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
Main.class | ||
--function Main.main | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
public class Main | ||
{ | ||
public static void main(String[] args) | ||
{ | ||
assert(args != null); // must hold | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
Main.class | ||
|
||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
8 changes: 8 additions & 0 deletions
8
jbmc/regression/jbmc/no-main-args-elements-maybe-null1/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
public class Main | ||
{ | ||
static void main(String[] args) // not public! | ||
{ | ||
if(args != null && args.length>0) | ||
assert(args[0] != null); // allowed to fail | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
jbmc/regression/jbmc/no-main-args-elements-maybe-null1/test.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
Main.class | ||
--function Main.main | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
9 changes: 9 additions & 0 deletions
9
jbmc/regression/jbmc/no-main-args-elements-maybe-null2/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
public class Main | ||
{ | ||
static void main(String[] args) // not public! | ||
{ | ||
if(args != null && args.length>0) { | ||
assert(args[0] == null); // allowed to fail | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
jbmc/regression/jbmc/no-main-args-elements-maybe-null2/test.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
Main.class | ||
--function Main.main | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
public class Main | ||
{ | ||
public void main(String[] args) // not static! | ||
{ | ||
assert(args != null); // allowed to fail | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
Main.class | ||
--function Main.main | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
public class Main | ||
{ | ||
public void main(String[] args) // not static! | ||
{ | ||
assert(args == null); // allowed to fail | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
Main.class | ||
--function Main.main | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
Binary file not shown.
16 changes: 16 additions & 0 deletions
16
jbmc/regression/jbmc/no-main-int-array-maybe-null1/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
public class Main | ||
{ | ||
public static void main(int[] args) | ||
{ | ||
assert(args == null); // allowed to fail | ||
assert(args != null); // allowed to fail | ||
if(args != null && args.length > 0) { | ||
try { | ||
int i = args[0]; | ||
} | ||
catch(Exception e) { | ||
assert false; // must hold | ||
} | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
jbmc/regression/jbmc/no-main-int-array-maybe-null1/test.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
CORE | ||
Main.class | ||
--function Main.main --java-throw-runtime-exceptions | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
assertion at file Main\.java line 5 function .* bytecode-index 6: FAILURE | ||
assertion at file Main\.java line 6 function .* bytecode-index 14: FAILURE | ||
assertion at file Main\.java line 12 function .* bytecode-index 31: SUCCESS | ||
\*\* 2 of .* failed | ||
-- | ||
^warning: ignoring |
Binary file not shown.
11 changes: 11 additions & 0 deletions
11
jbmc/regression/jbmc/no-main-multi-array-maybe-null1/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
public class Main | ||
{ | ||
public static void main(String[][] args) | ||
{ | ||
assert(args == null || | ||
args.length == 0 || | ||
args[0] == null || | ||
args[0].length == 0 || | ||
args[0][0] != null); // allowed to fail | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
jbmc/regression/jbmc/no-main-multi-array-maybe-null1/test.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CORE | ||
Main.class | ||
--function Main.main | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
assertion at file Main\.java line 5 function .* bytecode-index 24: FAILURE | ||
\*\* 1 of .* failed | ||
-- | ||
^warning: ignoring |
Binary file not shown.
11 changes: 11 additions & 0 deletions
11
jbmc/regression/jbmc/no-main-multi-array-maybe-null2/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
public class Main | ||
{ | ||
public static void main(String[][] args) | ||
{ | ||
assert(args == null || | ||
args.length == 0 || | ||
args[0] == null || | ||
args[0].length == 0 || | ||
args[0][0] == null); // allowed to fail | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
jbmc/regression/jbmc/no-main-multi-array-maybe-null2/test.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CORE | ||
Main.class | ||
--function Main.main | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
assertion at file Main\.java line 5 function .* bytecode-index 24: FAILURE | ||
\*\* 1 of .* failed | ||
-- | ||
^warning: ignoring |
Binary file added
BIN
+521 Bytes
jbmc/regression/jbmc/no-main-object-array-elements-maybe-null1/Main.class
Binary file not shown.
9 changes: 9 additions & 0 deletions
9
jbmc/regression/jbmc/no-main-object-array-elements-maybe-null1/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
public class Main | ||
{ | ||
public static void main(Main[] args) | ||
{ | ||
if(args != null && args.length > 0) { | ||
assert(args[0] == null); // allowed to fail | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
jbmc/regression/jbmc/no-main-object-array-elements-maybe-null1/test.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CORE | ||
Main.class | ||
--function Main.main | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
assertion at file Main\.java line 12 function .* bytecode-index 15: FAILURE | ||
\*\* 1 of .* failed | ||
-- | ||
^warning: ignoring |
Binary file added
BIN
+521 Bytes
jbmc/regression/jbmc/no-main-object-array-elements-maybe-null2/Main.class
Binary file not shown.
9 changes: 9 additions & 0 deletions
9
jbmc/regression/jbmc/no-main-object-array-elements-maybe-null2/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
public class Main | ||
{ | ||
public static void main(Main[] args) | ||
{ | ||
if(args != null && args.length > 0) { | ||
assert(args[0] != null); // allowed to fail | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
jbmc/regression/jbmc/no-main-object-array-elements-maybe-null2/test.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CORE | ||
Main.class | ||
--function Main.main | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
assertion at file Main\.java line 12 function .* bytecode-index 15: FAILURE | ||
\*\* 1 of .* failed | ||
-- | ||
^warning: ignoring |
Binary file not shown.
Binary file not shown.
18 changes: 18 additions & 0 deletions
18
jbmc/regression/jbmc/no-main-object-array-maybe-null1/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
public class Main | ||
{ | ||
public static class A { | ||
int x; | ||
} | ||
public A a; | ||
|
||
public static void main(Main[] args) | ||
{ | ||
assert(args != null); // allowed to fail | ||
if(args != null && args.length > 0) { | ||
Main m = args[0]; | ||
if(m != null) { | ||
assert(m.a == null); // allowed to fail | ||
} | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
jbmc/regression/jbmc/no-main-object-array-maybe-null1/test.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CORE | ||
Main.class | ||
--function Main.main | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
assertion at file Main\.java line 10 function .* bytecode-index 6: FAILURE | ||
assertion at file Main\.java line 14 function .* bytecode-index 26: FAILURE | ||
\*\* 2 of .* failed | ||
-- | ||
^warning: ignoring |
Binary file not shown.
Binary file not shown.
18 changes: 18 additions & 0 deletions
18
jbmc/regression/jbmc/no-main-object-array-maybe-null2/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
public class Main | ||
{ | ||
public static class A { | ||
int x; | ||
} | ||
public A a; | ||
|
||
public static void main(Main[] args) | ||
{ | ||
assert(args != null); // allowed to fail | ||
if(args != null && args.length > 0) { | ||
Main m = args[0]; | ||
if(m != null) { | ||
assert(m.a != null); // allowed to fail | ||
} | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
jbmc/regression/jbmc/no-main-object-array-maybe-null2/test.desc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
CORE | ||
Main.class | ||
--function Main.main | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
assertion at file Main\.java line 10 function .* bytecode-index 6: FAILURE | ||
assertion at file Main\.java line 14 function .* bytecode-index 26: FAILURE | ||
\*\* 2 of .* failed | ||
-- | ||
^warning: ignoring |