Skip to content

Commit ad2ead5

Browse files
Merge pull request #5711 from peterschrammel/jbmc-book-examples
Add ASV book JBMC examples
2 parents 45f02be + b1d8257 commit ad2ead5

23 files changed

+151
-0
lines changed
Binary file not shown.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
public class BinarySearch {
2+
public static int binarySearch(int[] array, int value) {
3+
int lowerBound = 0;
4+
int upperBound = array.length;
5+
int i = array.length / 2;
6+
while(array[i] != value && upperBound > lowerBound + 1) {
7+
if(array[i] > value) upperBound = i; else lowerBound = i;
8+
i = (upperBound + lowerBound) / 2;
9+
}
10+
return i;
11+
}
12+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CORE
2+
BinarySearch.binarySearch
3+
--throw-runtime-exceptions --unwind 2
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class IdLocator implements Locator {
2+
IdLocator(String s) {
3+
}
4+
}
Binary file not shown.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
public interface Locator {
2+
}
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)