-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathCorrectIfThen.java
More file actions
56 lines (49 loc) · 1.19 KB
/
CorrectIfThen.java
File metadata and controls
56 lines (49 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package testSuite;
import liquidjava.specification.Refinement;
@SuppressWarnings("unused")
public class CorrectIfThen {
public void have2(int a, int b) {
@Refinement("pos > 0")
int pos = 10;
if (a > 0) {
if (a > b) pos = a - b;
}
}
public void have1(int a) {
@Refinement("pos > 0")
int pos = 10;
if (a > 0) {
pos = 5;
pos = 8;
pos = 30;
}
@Refinement("_ == 30 || _ == 10")
int u = pos;
}
public void haveAnd(int a, @Refinement("b > 5")int b) {
@Refinement("pos > 0")
int pos = 10;
if (a > 0 && b > 0) {
if (a > b) pos = a - b;
}
}
public static void main(String[] args) {
@Refinement("_ < 10")
int a = 5;
if (a > 0) {
@Refinement("b > 0")
int b = a;
b++;
if (b > 10) {
@Refinement("_ > 0")
int c = a;
@Refinement("_ > 11")
int d = b + 1;
}
if (a > b) {
@Refinement("_ > b")
int c = a;
}
}
}
}