-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathErrorOperatorAssignments.java
More file actions
60 lines (50 loc) · 1.24 KB
/
ErrorOperatorAssignments.java
File metadata and controls
60 lines (50 loc) · 1.24 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
57
58
59
60
package testSuite;
import liquidjava.specification.Refinement;
@SuppressWarnings("unused")
public class ErrorOperatorAssignments {
@Refinement("_ == 1")
int one() {
return 1;
}
@Refinement("_ == 0 || _ == 1")
int remainder(@Refinement("_ >= 0") int x) {
x %= 2;
return x;
}
@Refinement("_ == 12")
int plusInvocation(@Refinement("_ >= 0") int x) {
int y = 10;
y += remainder(x);
return y; // Refinement Error
}
@Refinement("_ == 10")
int plusUnaryInvocation() {
int y = 10;
y += -one();
return y; // Refinement Error
}
@Refinement("_ == 12")
int plusConditional(@Refinement("_ >= 0") int x) {
int y = 10;
y += x >= 0 ? one() : 2;
return y; // Refinement Error
}
@Refinement("_ == 14")
int plusBinaryExpression() {
int y = 10;
y += one() + 2;
return y; // Refinement Error
}
@Refinement("_ == 10")
int plusArrayRead(int[] values) {
int y = 10;
y += values[0];
return y; // Refinement Error
}
@Refinement("_ == 12")
int plusCast() {
int y = 10;
y += (int) one();
return y; // Refinement Error
}
}