-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests showing the effect on string-max-length
These tests show how the result of the solver can depend on the string-max-input-length and string-max-length parameters.
- Loading branch information
1 parent
5315a10
commit 4f023cd
Showing
6 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
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,37 @@ | ||
public class Test { | ||
|
||
static void checkMaxInputLength(String arg1, String arg2) { | ||
// Filter | ||
if (arg1 == null || arg2 == null) | ||
return; | ||
|
||
// The validity of this depends on string-max-input-length | ||
assert arg1.length() + arg2.length() < 1_000_000; | ||
} | ||
|
||
static void checkMaxLength(String arg1, String arg2) { | ||
// Filter | ||
if (arg1 == null || arg2 == null) | ||
return; | ||
|
||
if(arg1.length() + arg2.length() < 4_001) | ||
return; | ||
|
||
// Act | ||
String s = arg1.concat(arg2); | ||
|
||
// When string-max-length is smaller than 4_000 this will | ||
// always be the case | ||
assert org.cprover.CProverString.charAt(s, 4_000) == '?'; | ||
} | ||
|
||
static void main(String argv[]) { | ||
// Filter | ||
if (argv.length < 2) | ||
return; | ||
|
||
// Act | ||
checkMaxInputLength(argv[0], argv[1]); | ||
checkMaxLength(argv[0], argv[1]); | ||
} | ||
} |
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,6 @@ | ||
CORE | ||
Test.class | ||
--refine-strings --verbosity 10 --string-max-input-length 499999 --function Test.checkMaxInputLength | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
assertion.* line 9 function java::Test.checkMaxInputLength.* bytecode-index 16: SUCCESS |
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,6 @@ | ||
CORE | ||
Test.class | ||
--refine-strings --verbosity 10 --string-max-input-length 500000 --function Test.checkMaxInputLength | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
assertion.* line 9 function java::Test.checkMaxInputLength.* bytecode-index 16: FAILURE |
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,6 @@ | ||
CORE | ||
Test.class | ||
--refine-strings --verbosity 10 --string-max-length 4001 --function Test.checkMaxLength | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
assertion.* line 25 function java::Test.checkMaxLength.* bytecode-index 26: FAILURE |
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 | ||
Test.class | ||
--refine-strings --verbosity 10 --string-max-length 4000 --function Test.checkMaxLength | ||
^SIGNAL=0$ | ||
-- | ||
^EXIT=0$ | ||
assertion.* line 25 function java::Test.checkMaxLength.* bytecode-index 26: SUCCESS | ||
-- | ||
The solver may give an ERROR because the value of string-max-length is too | ||
small to give an answer about the assertion. | ||
So we just check that the answer is not success. |