[w32file] Move MonoIO.Find{First,Next,Close} to managed
[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                 e = myconstant | 0x1fff
11         }
12         
13         public enum MyEnum : byte {
14                 Foo = 254,
15                 Bar = (byte) B.y
16         }
17
18         enum A {
19                 a, b, c
20         }
21         
22         enum B {
23                 x, y, z
24         }
25         
26         enum AA : byte { a, b }
27         enum BB : ulong { x = ulong.MaxValue - 1, y }
28
29         const int myconstant = 30;
30
31         enum Compute : ulong { 
32                 two = AA.b + B.y,
33                 three = AA.b - B.y,
34                 four = A.a * BB.x,
35                 five = AA.b >> B.y,
36         }
37         
38         internal enum WindowAttributes : uint {
39                 kWindowNoAttributes = 0,
40                 kWindowCloseBoxAttribute = (1u << 0),
41                 kWindowHorizontalZoomAttribute = (1u << 1),
42                 kWindowVerticalZoomAttribute = (1u << 2),
43                 kWindowCollapseBoxAttribute = (1u << 3),
44                 kWindowNoConstrainAttribute = (1u << 31),
45                 kWindowStandardFloatingAttributes = (kWindowCloseBoxAttribute | kWindowCollapseBoxAttribute)
46         }
47         
48         // The constant assignment follows a different path             
49         const Bar bar_assignment = 0;
50         
51         public static int Main ()
52         {
53                 byte b = (byte) MyEnum.Foo;
54                 
55                 Console.WriteLine ("Foo has a value of " + b);
56
57                 if (b != 254)
58                         return 1;
59                 
60                 int i = (int) A.a;
61                 int j = (int) B.x;
62                 int k = (int) A.c;
63                 int l = (int) AA.b + 1;
64
65                 if ((int) Compute.two != 2)
66                         return 10;
67                 if (i != j)
68                         return 1;
69
70                 if (k != l)
71                         return 1;
72
73                 A var = A.b;
74
75                 i = (int) Bar.a;
76
77                 if (i != 254)
78                         return 1;
79
80                 i = (int) Bar.b;
81
82                 if (i != 2)
83                         return 1;
84
85                 j = (int) Bar.c;
86
87                 if (j != 1)
88                         return 1;
89
90                 j = (int) Bar.d;
91
92                 if (j != 30)
93                         return 1;
94
95                 Enum e = Bar.d;
96                 if (e.ToString () != "d")
97                         return 15;
98
99                 //
100                 // Test "U operator (E x, E x)"
101                 //
102                 // Notice that the Microsoft C# compiler wont compile the following
103                 // code, that is a bug in their compiler, see section 14.7.5 of the
104                 // spec.
105
106                 if ((A.c - A.a) != 2)
107                         return 16;
108
109                 if ((A.c - 1) != A.b)
110                         return 17;
111                 
112                 Console.WriteLine ("Value: " + e.ToString ());
113                 Console.WriteLine ("Enum emission test okay");
114                 return 0;
115         }
116 }