Newer
Older
ISWB Prasetya
committed
// Javac will refuse to compile this file because some usage of break and continue causes
// some code to be unreachable. To compile, preceed them with e.g. if(true) break ;
// I don't do this on purpose to keep the generated wlp simple, so make it easier when
// using these programs for debugging wlp.
//
ISWB Prasetya
committed
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
public static void While(int N){
int i=0 ;
while (i<N) { i++ ; }
i = i+9 ;
}
public static void WhileBreak(int N){
int i=0 ;
int x = 0 ;
int y = 0 ;
while (i<N) { x=1 ; break ; y=1 ; i++ ; }
i = i+9 ;
x = x+10 ;
y = y+11 ;
}
public static void WhileContinue(int N){
int i=0 ;
int x = 0 ;
int y = 0 ;
while (i<N) { x=1 ; i++ ; continue ; y=1 ; }
i = i+9 ;
x = x+10 ;
y = y+11 ;
}
public static void WhileNestedContinue(int N){
int i=0 ;
int x = 0 ;
int y = 0 ;
while (i<N) { i++ ; while(x<N) { x++ ; continue ; y=2 ; } continue ; y=1 ; }
i = i+9 ;
x = x+10 ;
y = y+11 ;
}
public static void WhileWhile(int N){
int i=0 ;
while (i<N) { if (i==1) i = i+2 ; i++ ; }
int j=0 ;
while (j<N) { i++ ; j++ ; }
i = i+9 ;
}
public static void WhileWhileWhile(int N){
int i=0 ;
while (i<N) { if (i==1) i = i+2 ;
int k=0 ;
while (k<N) { if (k==1) i = i+2 ; i++ ; k++ ;}
i++ ;
}
int j=0 ;
while (j<N) { i++ ; j++ ; }
i = i+9 ;
}
ISWB Prasetya
committed
public static void For(int N){
int i ;
int x ;
for (i=0; i<N; i++ ) { x = x+2 ; }
}
public static void ForNested() {
ISWB Prasetya
committed
for(i = 0; i < 6; i++) {
for(int j = 0; j < 6; j++) {
if(true) assert j == 1;