dlr bug
[mcs.git] / tests / test-232.cs
blobcf3a426fa33a822afe3443a2aa15e82d3a7679ad
1 using System;
2 using System.Reflection;
4 public class CtorInfoTest
6 enum E
8 A = 0,
9 B = 1
12 public static void Main(string[] args)
15 // uses static initialization
16 int[] iarray = // int array, int constants
27 object[] oarray = // int array, int constants
30 E.A,
31 null,
32 "A",
33 new int (),
34 1.1,
35 -2m,
38 object[] ooarray =
40 null,
41 new int[] { 0, 0 },
43 new object[0],
46 // mcs used to throw with 7 or more elements in the array initializer
47 ConstructorInfo[] ciarray = // ref array, null constants
49 null,
50 null,
51 null,
52 null,
53 null,
54 null,
55 null,
58 string[] scarray = // string array, string constants
60 "a",
61 "b",
62 "c",
63 "d",
64 "e",
65 "f",
66 "g",
69 string[] snarray = // string array, null constants
71 null,
72 null,
73 null,
74 null,
75 null,
76 null,
77 null,
80 decimal[] darray = // decimal constants
82 0M,
83 1M,
84 2M,
85 3M,
86 4M,
87 5M,
88 6M,
89 7M,
92 IConvertible[] lcarray = // boxed integer constants
105 System.Enum[] eatarray = // boxed enum constants
107 AttributeTargets.Assembly,
108 AttributeTargets.Module,
109 AttributeTargets.Class,
110 AttributeTargets.Struct,
111 AttributeTargets.Enum,
112 AttributeTargets.Constructor,
113 AttributeTargets.Method,
114 AttributeTargets.Property,
115 AttributeTargets.Field,
116 AttributeTargets.Event,
117 AttributeTargets.Interface,
118 AttributeTargets.Parameter,
119 AttributeTargets.Delegate,
120 AttributeTargets.ReturnValue,
121 AttributeTargets.All,
124 E[] atarray = // enum constants
126 E.A,
131 string[] smarray = // string array, mixture
133 null,
137 for (int i = 0; i < iarray.Length; ++i)
138 Assert (i, iarray [i]);
140 for (int i = 0; i < ciarray.Length; ++i)
141 Assert (null, ciarray [i]);
143 Assert ("a", scarray [0]);
145 for (int i = 0; i < snarray.Length; ++i)
146 Assert (null, snarray [i]);
148 for (decimal i = 0; i < darray.Length; ++i)
149 Assert (i, darray [(int)i]);
151 for (int i = 0; i < lcarray.Length; ++i)
152 Assert (i, lcarray [i]);
154 Assert (E.A, atarray [0]);
155 Assert (E.B, atarray [1]);
157 Assert (AttributeTargets.Assembly, eatarray [0]);
158 Assert (AttributeTargets.Class, eatarray [2]);
160 Assert (null, smarray [0]);
161 Assert ("a", smarray [1]);
165 static void Assert (object expected, object value)
167 if (expected == null && value == null)
168 return;
170 if (!expected.Equals (value))
171 Console.WriteLine ("ERROR {0} != {1}", expected, value);