-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathErrorFunctionInvocation.java
More file actions
51 lines (42 loc) · 1.15 KB
/
Copy pathErrorFunctionInvocation.java
File metadata and controls
51 lines (42 loc) · 1.15 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
package testSuite;
import liquidjava.specification.Refinement;
@SuppressWarnings("unused")
public class ErrorFunctionInvocation {
@Refinement(" _ >= a")
public static int posMult(@Refinement("a == 10") int a, @Refinement("_ < a && _ > 0") int b) {
@Refinement("y > 30")
int y = 50;
return y - 10;
}
@Refinement("_ == 2")
private static int getTwo() {
return 1 + 1;
}
@Refinement(" _ == 0")
private static int getZero() {
return 0;
}
@Refinement("_ == 1")
private static int getOne() {
@Refinement("_ == 0")
int a = getZero();
return a + 1;
}
public static void invocation1() {
@Refinement("_ > 10")
int p = 10; // Expect: Refinement Error
p = posMult(10, 4);
}
public static void invocation2() {
@Refinement("_ < 1")
int b = getZero();
@Refinement("_ > 0")
int c = getOne();
c = getZero(); // Expect: Refinement Error
}
public static void invocationWParams() {
@Refinement("_ >= 0")
int p = 10;
p = posMult(10, 12); // Expect: Refinement Error
}
}