Add test-43
[mono.git] / mcs / tests / test-43.cs
1 //
2 // This test is used for testing the foreach array support
3 //
4
5 class X {
6
7         static int test_single (int [] a)
8         {
9                 int total = 0;
10
11                 foreach (int i in a)
12                         total += i;
13
14                 return total;
15         }
16
17         static int Main ()
18         {
19                 int [] a = new int [10];
20                 int [] b = new int [2];
21
22                 for (int i = 0; i < 10; i++)
23                         a [i] = 10 + i;
24
25                 for (int j = 0; j < 2; j++)
26                         b [j] = 50 + j;
27
28                 if (test_single (a) != 145)
29                         return 1;
30
31                 if (test_single (b) != 101)
32                         return 2;
33
34                 return 0;
35         }
36 }
37