Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
public class Main {

public void constantIndexOf() {
String s1 = "abcabc";
String s2 = "bc";
assert s1.indexOf(s2) == 1;
assert s1.indexOf(s2, -10) == 1;
assert s1.indexOf("") == 0;
assert s1.indexOf(s2, 3) == 4;
assert s1.indexOf("cd") == -1;
assert s1.indexOf(s2, 10) == -1;
assert s1.indexOf("", 10) == -1;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CORE symex-driven-lazy-loading-expected-failure
Main.class
--function Main.constantIndexOf --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar`
^Generated [0-9]+ VCC\(s\), 0 remaining after simplification$
^VERIFICATION SUCCESSFUL$
^EXIT=0$
^SIGNAL=0$
--
--
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
public class Main {

public void constantIndexOf() {
String s1 = "abcabc";
assert s1.indexOf('b') == 1;
assert s1.indexOf('b', -10) == 1;
assert s1.indexOf('b', 3) == 4;
assert s1.indexOf('d') == -1;
assert s1.indexOf('b', 10) == -1;
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
public class Main {

public void constantIndexOf(String arg) {
String s1 = "abcabc";
assert s1.indexOf(arg, 10) == -1;
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
public class Main {

public void constantIndexOf(String s, char c, int i) {

String s1 = "abcabc";
String s2 = "bc";

assert s1.indexOf(c) == 1;
assert s1.indexOf(s) == 1;
assert s1.indexOf(c, 1) == 1;
assert s1.indexOf(s, 1) == 1;

assert s.indexOf('a') == 1;
assert s.indexOf(s1) == 1;
assert s.indexOf('a', 1) == 1;
assert s.indexOf(s1, 1) == 1;

assert s1.indexOf(s, -10) == 1;
assert s1.indexOf(c, -10) == 1;

assert s1.indexOf(s2, i) == 1;
assert s1.indexOf('a', i) == 1;
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
public class Main {

public void constantIndexOf() {
String s1 = "abcabc";
Character b = 'b';
assert s1.indexOf(b) == 1;
assert s1.indexOf(b, -10) == 1;
assert s1.indexOf(b, 3) == 4;
assert s1.indexOf(b, 10) == -1;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CORE symex-driven-lazy-loading-expected-failure
Main.class
--function Main.constantIndexOf --cp `../../../../scripts/format_classpath.sh . ../../../lib/java-models-library/target/core-models.jar`
^Generated [0-9]+ VCC\(s\), 0 remaining after simplification$
^VERIFICATION SUCCESSFUL$
^EXIT=0$
^SIGNAL=0$
--
--
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
public class Main {

public void constantIndexOf() {
String s1 = "abcabc";
assert s1.indexOf("") == -1;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CORE symex-driven-lazy-loading-expected-failure
Main.class
--function Main.constantIndexOf --property "java::Main.constantIndexOf:()V.assertion.1"
^Generated [0-9]+ VCC\(s\), 1 remaining after simplification$
^VERIFICATION FAILED$
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should specify which assertion you want to fail. It's probably good to use the --property option too, as you don't want to analyse the assertions that you expect to be successful.
Look at the tests in https://github.com/diffblue/cbmc/tree/develop/jbmc/regression/jbmc-strings/CompareToConstantEvaluation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes ... it was pointed out by @danpoe when he explained to me about regression tests. I was just being lazy 😅 property added.

^EXIT=10$
^SIGNAL=0$
--
--
13 changes: 0 additions & 13 deletions jbmc/regression/jbmc-strings/IndexOfConstantEvaluation1/Main.java

This file was deleted.

10 changes: 0 additions & 10 deletions jbmc/regression/jbmc-strings/IndexOfConstantEvaluation2/Main.java

This file was deleted.

This file was deleted.

23 changes: 0 additions & 23 deletions jbmc/regression/jbmc-strings/IndexOfConstantEvaluation4/Main.java

This file was deleted.