2007-05-25 Jonathan Chambers <joncham@gmail.com>
[mcs.git] / tests / test-25.cs
bloba01a8daa4f1af6420161e71c82e37529a29ccef0
1 //
2 // Test the various iteration constructs, breaks and continues
3 //
4 // FIXME: Add foreach and more tests.
5 //
6 using System;
8 class X {
10 static int Main ()
12 int i, j, t, k;
14 for (i = 0; i < 10; i++){
15 if (i == 5)
16 break;
19 if (i != 5)
20 return 1;
22 t = 0;
23 k = 0;
24 for (i = 0; i < 10; i++){
25 for (j = 0; j < 10; j++){
26 if (j > 3)
27 break;
28 t++;
30 if (j >= 1)
31 continue;
33 k++;
37 if (t != 40)
38 return 2;
39 if (k != 10)
40 return 3;
43 t = 0;
44 do {
45 if (k == 5)
46 continue;
47 t++;
48 } while (--k > 0);
50 if (t != 9)
51 return 4;
53 t = 0;
54 do {
55 t++;
56 if (t == 5)
57 break;
58 } while (k++ < 10);
60 if (t != 5)
61 return 5;
63 return 0;