forked from diffblue/cbmc
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request diffblue#1603 from romainbrenguier/feature/cprover…
…Validate#TG1313 Add call to cproverValidate in nondet initialization TG-1313
- Loading branch information
Showing
6 changed files
with
70 additions
and
1 deletion.
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,31 @@ | ||
import org.cprover.CProver; | ||
|
||
class Test { | ||
int size; | ||
int[] data1; | ||
int[] data2; | ||
|
||
void cproverNondetInitialize() { | ||
// This specifies invariants about object of this class. | ||
// This avoids finding spurious bugs. | ||
CProver.assume(data1 != null && data2 != null && size == data1.length + data2.length); | ||
} | ||
|
||
int check(int x) { | ||
int i; | ||
if(x >= size || x < 0) | ||
return -1; | ||
|
||
assert(data1 != null || data2 == null); | ||
|
||
if (x >= data1.length) { | ||
i = x - data1.length; | ||
assert(i < data2.length); | ||
return data2[i]; | ||
} else { | ||
assert(x < data1.length); | ||
return data1[x]; | ||
} | ||
|
||
} | ||
} |
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,5 @@ | ||
CORE | ||
Test.class | ||
--function Test.check | ||
^VERIFICATION SUCCESSFUL$ | ||
-- |
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,5 @@ | ||
CORE | ||
Test.class | ||
--function Test.check --lazy-methods | ||
^VERIFICATION SUCCESSFUL$ | ||
-- |
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
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