Improve test
[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         enum Compute { two = AA.b + BB.y }
31         
32         public static int Main ()
33         {
34                 byte b = (byte) MyEnum.Foo;
35                 
36                 Console.WriteLine ("Foo has a value of " + b);
37
38                 if (b != 254)
39                         return 1;
40                 
41                 int i = (int) A.a;
42                 int j = (int) B.x;
43                 int k = (int) A.c;
44                 int l = (int) AA.b + 1;
45
46                 if (Compute.two != 2)
47                         return 10;
48                 if (i != j)
49                         return 1;
50
51                 if (k != l)
52                         return 1;
53
54                 A var = A.b;
55
56                 i = (int) Bar.a;
57
58                 if (i != 254)
59                         return 1;
60
61                 i = (int) Bar.b;
62
63                 if (i != 2)
64                         return 1;
65
66                 j = (int) Bar.c;
67
68                 if (j != 1)
69                         return 1;
70
71                 j = (int) Bar.d;
72
73                 if (j != 30)
74                         return 1;
75
76                 Console.WriteLine ("Enum emission test okay");
77                 return 0;
78         }
79 }