Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mcs / tests / test-25.cs
1 //
2 // Test the various iteration constructs, breaks and continues
3 //
4 // FIXME: Add foreach and more tests.
5 //
6 using System;
7
8 class X {
9
10         public static int Main ()
11         {
12                 int i, j, t, k;
13                 
14                 for (i = 0; i < 10; i++){
15                         if (i == 5)
16                                 break;
17                 }
18
19                 if (i != 5)
20                         return 1;
21
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++;
29
30                                 if (j >= 1)
31                                         continue;
32
33                                 k++;
34                         }
35                 }
36
37                 if (t != 40)
38                         return 2;
39                 if (k != 10)
40                         return 3;
41
42
43                 t = 0;
44                 do {
45                         if (k == 5)
46                                 continue;
47                         t++;
48                 } while (--k > 0);
49
50                 if (t != 9)
51                         return 4;
52
53                 t = 0;
54                 do {
55                         t++;
56                         if (t == 5)
57                                 break;
58                 } while (k++ < 10);
59
60                 if (t != 5)
61                         return 5;
62
63                 return 0;
64         }
65 }