Revert 74623/74624 to fix build.
[mcs.git] / tests / test-45.cs
blob0cd4bf49be413f7efce3d3cc17382b8cf3260201
1 using System;
3 public class Blah {
5 private static int[] array = {0, 1, 2, 3};
7 private static int [,] bar = { {0,1}, {4,5}, {10,20} };
9 static string [] names = {
10 "Miguel", "Paolo", "Dietmar", "Dick", "Ravi"
13 public static int Main ()
15 int [] i = new int [4] { 0, 1, 2, 3 };
17 short [,] j = new short [4,2] { {0,1}, {2,3}, {4,5}, {6,7} };
19 ushort [] a = { 4, 5, 6, 7 };
21 long [,,] m = new long [2,3,2] {{{0,1}, {2,3}, {4,5}}, {{6,7}, {8,9}, {10,11}}};
23 int foo = 1;
24 int [] k = new int [] { foo, foo+1, foo+4 };
26 int [,] boo = new int [,] {{foo, foo+10}, {foo+3, foo+10}};
28 float [] f_array = new float [] { 1.23F, 4.5F, 6.24F };
30 double [] double_arr = new double [] { 34.4567, 90.1226, 54.9823 };
32 char [] c_arr = { 'A', 'B', 'C', 'M', 'R' };
34 byte [] b_arr = { 0, 3, 8, 10, 21 };
36 sbyte [] s_arr = { 10, 15, 30, 123 };
38 if (a [2] != 6)
39 return 1;
41 if (s_arr [3] != 123)
42 return 2;
44 if (i [2] != 2)
45 return 1;
47 if (j [1,1] != 3)
48 return 1;
50 for (int t = 0; t < 4; ++t) {
51 if (array [t] != t)
52 return 1;
54 if (a [t] != (t + 4))
55 return 1;
58 if (bar [2,1] != 20)
59 return 1;
61 if (k [2] != 5)
62 return 1;
64 if (m [1,1,1] != 9)
65 return 1;
67 if (boo [0,1] != 11)
68 return 1;
70 if (f_array [0] != 1.23F)
71 return 1;
73 if (double_arr [1] != 90.1226)
74 return 1;
76 foreach (string s in names)
77 Console.WriteLine ("Hello, " + s);
79 if (names [0] != "Miguel")
80 return 1;
82 if (c_arr [4] != 'R')
83 return 2;
85 int count = 10;
87 int [] x = new int [count];
89 for (int idx = 0; idx < count; idx++)
90 x [idx] = idx + 1;
92 for (int idx = count; idx > 0; ){
93 idx--;
94 if (x [idx] != idx + 1)
95 return 12;
98 IntPtr [] arr = { new System.IntPtr (1) };
99 if (arr [0] != (IntPtr) 1)
100 return 13;
102 IntPtr [] arr_i = { System.IntPtr.Zero };
104 if (arr_i [0] != System.IntPtr.Zero)
105 return 14;
107 Console.WriteLine ("Array initialization test okay.");
109 return 0;