blob: 08ac21c8b65b82a265a9239db2013adce082b25f (
plain)
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
61
62
63
64
65
|
//
// Test the various iteration constructs, breaks and continues
//
// FIXME: Add foreach and more tests.
//
using System;
class X {
public static int Main ()
{
int i, j, t, k;
for (i = 0; i < 10; i++){
if (i == 5)
break;
}
if (i != 5)
return 1;
t = 0;
k = 0;
for (i = 0; i < 10; i++){
for (j = 0; j < 10; j++){
if (j > 3)
break;
t++;
if (j >= 1)
continue;
k++;
}
}
if (t != 40)
return 2;
if (k != 10)
return 3;
t = 0;
do {
if (k == 5)
continue;
t++;
} while (--k > 0);
if (t != 9)
return 4;
t = 0;
do {
t++;
if (t == 5)
break;
} while (k++ < 10);
if (t != 5)
return 5;
return 0;
}
}
|