2002-02-25 Ravi Pratap <ravi@ximian.com>
[mono.git] / mcs / tests / test-40.cs
1 using System;
2
3 public class Blah {
4
5         enum Bar {
6                 a = MyEnum.Foo,
7                 b = A.c,
8                 c = MyEnum.Bar,
9                 d = myconstant
10         }
11         
12         public enum MyEnum : byte {
13                 Foo = 254,
14                 Bar = B.y
15         }
16
17         enum A {
18                 a, b, c
19         }
20         
21         enum B {
22                 x, y, z
23         }
24         
25         enum AA : byte { a, b }
26         enum BB : ulong { x, y }
27
28         const int myconstant = 30;
29         
30         public static int Main ()
31         {
32                 byte b = (byte) MyEnum.Foo;
33                 
34                 Console.WriteLine ("Foo has a value of " + b);
35
36                 if (b != 254)
37                         return 1;
38                 
39                 int i = (int) A.a;
40                 int j = (int) B.x;
41                 int k = (int) A.c;
42                 int l = (int) AA.b + 1;
43
44                 if (i != j)
45                         return 1;
46
47                 if (k != l)
48                         return 1;
49
50                 A var = A.b;
51
52                 i = (int) Bar.a;
53
54                 if (i != 254)
55                         return 1;
56
57                 i = (int) Bar.b;
58
59                 if (i != 2)
60                         return 1;
61
62                 j = (int) Bar.c;
63
64                 if (j != 1)
65                         return 1;
66
67                 j = (int) Bar.d;
68
69                 if (j != 30)
70                         return 1;
71
72                 Console.WriteLine ("Enum emission test okay");
73                 return 0;
74         }
75 }