Skip to content

Commit dd0caeb

Browse files
author
Joel Allred
committed
fixup Rename test classes
1 parent 7905eed commit dd0caeb

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

doc/cprover-manual/jbmc-user-manual.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ features of JBMC, and explore the most useful features.
2222

2323
\subsection jbmc-manual-auto-assert Automatic assertions
2424

25-
Consider the following simplistic `Example1.java` file which we have compiled
26-
into `Example1.class` and which contains a utility method to query a given
25+
Consider the following simplistic `ExampleArray.java` file which we have compiled
26+
into `ExampleArray.class` and which contains a utility method to query a given
2727
array at a given index:
2828
```
2929
package tutorial;
3030
31-
public class Example1 {
31+
public class ExampleArray {
3232
3333
public static int query(int[] array, int index) {
3434
return array[index];
@@ -39,15 +39,15 @@ public class Example1 {
3939
Now let's run the following command to let JBMC tell us about potential errors
4040
in our `query` method.
4141

42-
jbmc Example1.class --function tutorial.Example1.query
42+
jbmc ExampleArray.class --function tutorial.ExampleArray.query
4343

4444

4545
The output contains the following:
4646

47-
[java::tutorial.Example1.query:([II)I.null-pointer-exception.1] line 6 Null pointer check: FAILURE
48-
[java::tutorial.Example1.query:([II)I.array-index-out-of-bounds-low.1] line 6 Array index should be >= 0: FAILURE
49-
[java::tutorial.Example1.query:([II)I.array-index-out-of-bounds-high.1] line 6 Array index should be < length: FAILURE
50-
[java::tutorial.Example1.query:([II)I.1] line 6 no uncaught exception: SUCCESS
47+
[java::tutorial.ExampleArray.query:([II)I.null-pointer-exception.1] line 6 Null pointer check: FAILURE
48+
[java::tutorial.ExampleArray.query:([II)I.array-index-out-of-bounds-low.1] line 6 Array index should be >= 0: FAILURE
49+
[java::tutorial.ExampleArray.query:([II)I.array-index-out-of-bounds-high.1] line 6 Array index should be < length: FAILURE
50+
[java::tutorial.ExampleArray.query:([II)I.1] line 6 no uncaught exception: SUCCESS
5151

5252
Three reported failures spring up:
5353
1. there is no null pointer check on the array passed as argument
@@ -59,7 +59,7 @@ safe as follows:
5959
```
6060
package tutorial;
6161
62-
public class Example2 {
62+
public class ExampleArraySafe {
6363
public static int query(int[] array, int index) {
6464
if (array == null) {
6565
return -1;
@@ -75,11 +75,11 @@ public class Example2 {
7575
then the JBMC automatic assertions become valid, meaning that there is no
7676
possible inputs (argument values) for which they can be violated:
7777

78-
[java::tutorial.Example2.query:([II)I.1] line 6 no uncaught exception: SUCCESS
79-
[java::tutorial.Example2.query:([II)I.null-pointer-exception.1] line 9 Null pointer check: SUCCESS
80-
[java::tutorial.Example2.query:([II)I.null-pointer-exception.2] line 12 Null pointer check: SUCCESS
81-
[java::tutorial.Example2.query:([II)I.array-index-out-of-bounds-low.1] line 12 Array index should be >= 0: SUCCESS
82-
[java::tutorial.Example2.query:([II)I.array-index-out-of-bounds-high.1] line 12 Array index should be < length: SUCCESS
78+
[java::tutorial.ExampleArraySafe.query:([II)I.1] line 6 no uncaught exception: SUCCESS
79+
[java::tutorial.ExampleArraySafe.query:([II)I.null-pointer-exception.1] line 9 Null pointer check: SUCCESS
80+
[java::tutorial.ExampleArraySafe.query:([II)I.null-pointer-exception.2] line 12 Null pointer check: SUCCESS
81+
[java::tutorial.ExampleArraySafe.query:([II)I.array-index-out-of-bounds-low.1] line 12 Array index should be >= 0: SUCCESS
82+
[java::tutorial.ExampleArraySafe.query:([II)I.array-index-out-of-bounds-high.1] line 12 Array index should be < length: SUCCESS
8383

8484

8585
\subsection jbmc-manual-unwind Loop unwinding
@@ -93,7 +93,7 @@ depends on an input):
9393
```
9494
package tutorial;
9595
96-
public class Example3 {
96+
public class ExampleUnwind {
9797
9898
public static void doSomething(int inputVal) {
9999
if (inputVal > 1 && inputVal % 2 == 1) {
@@ -116,7 +116,7 @@ public class Example3 {
116116
To limit the number of times the for-loop is unwound, we use the `--unwind N`
117117
options, in which case the following call to JBMC:
118118

119-
jbmc Example3.class --function tutorial.Example3.isPrime --unwind 10
119+
jbmc ExampleUnwind.class --function tutorial.ExampleUnwind.isPrime --unwind 10
120120

121121
will terminate (with `VERIFICATION SUCCESSFUL`).
122122

@@ -128,12 +128,12 @@ JBMC will try do refute. On line 7, we check the assertion that all odd
128128
numbers greater than 1 are prime. To be sure that this always holds, we run
129129
JBMC on the example, with a reasonable `unwind` value:
130130

131-
jbmc Example3.class --function tutorial.Example3.doSomething --unwind 10
131+
jbmc ExampleUnwind.class --function tutorial.ExampleUnwind.doSomething --unwind 10
132132

133133
Unsurprisingly JBMC doesn't agree, and prints an assertion failure
134134
(truncated here for readability):
135135

136-
[...doSomething:(I)V.assertion.1] line 7 assertion at file tutorial/Example3.java: FAILURE
136+
[...doSomething:(I)V.assertion.1] line 7 assertion at file tutorial/ExampleUnwind.java: FAILURE
137137

138138

139139
Rerunning the analysis with the `--trace` option, the following line appears
@@ -165,7 +165,7 @@ from `java.lang.String`, e.g.
165165
```
166166
package tutorial;
167167
168-
public class Example4 {
168+
public class ExampleModels {
169169
170170
public static void stringOp() {
171171
StringBuilder sb = new StringBuilder("abcd");
@@ -178,11 +178,11 @@ public class Example4 {
178178
The following command line (note that the current directory is also added to
179179
the classpath):
180180

181-
jbmc Example4.class --function tutorial.Example4.stringOp --cp <path_to_cbmc>/jbmc/src/java_bytecode/library/core-models.jar:.
181+
jbmc ExampleModels.class --function tutorial.ExampleModels.stringOp --cp <path_to_cbmc>/jbmc/src/java_bytecode/library/core-models.jar:.
182182

183183
will flag this violation (truncated):
184184

185-
[java::tutorial.Example4.stringOp:()V.assertion.1] line 8 assertion: FAILURE
185+
[java::tutorial.ExampleModels.stringOp:()V.assertion.1] line 8 assertion: FAILURE
186186

187187
Again, the trace shows the string violating the condition in the assertion:
188188

@@ -202,7 +202,7 @@ line 11 will be considered as unreachable, and hence the assertion to be valid.
202202
```
203203
package tutorial;
204204
205-
public class Example5 {
205+
public class ExampleExceptions {
206206
207207
public static int exceptionHandling(String str) {
208208
int retval = 0;

0 commit comments

Comments
 (0)