[netcore] Disable a flaky test on interpreter (#18904)
[mono-project.git] / mono / tests / reflection-enum.cs
blob10f9050dc8c27edb598cc265de684cb93e92781f
1 using System.Reflection;
2 using System;
4 namespace Test {
5 public class T {
6 public static int Main(string[] args) {
7 string defaultn = "System.Reflection.ParameterAttributes";
8 string name = defaultn;
9 int verbose = 0;
10 foreach (string arg in args) {
11 if (arg == "-v")
12 verbose = 1;
13 else
14 name = arg;
16 Type t = Type.GetType (name);
17 Array values = Enum.GetValues (t);
18 string[] names = Enum.GetNames (t);
19 int i;
21 if (verbose != 0) {
22 Console.WriteLine ("Enum "+t.Name);
23 for (i = 0; i < names.Length; ++i) {
24 Console.WriteLine ("{0} = {1} (ToString: {2})", names [i], ((int)values.GetValue(i)).ToString(), values.GetValue(i));
27 if (name == defaultn) {
28 string[] truenames = {"None", "In", "Out", "Lcid", "Retval",
29 "Optional", "HasDefault", "HasFieldMarshal",
30 "Reserved3", "Reserved4", "ReservedMask"};
31 int[] truevalues = {0, 1, 2, 4, 8, 16, 4096, 8192,
32 16384, 32768, 61440};
34 for (i = 0; i < names.Length; ++i) {
35 if (names [i] != truenames [i])
36 return 1 + i;
37 if ((int)values.GetValue (i) != truevalues [i])
38 return 1 + names.Length + i;
41 return 0;