Take stars out of types where they make more sense.
[mono-project.git] / mcs / tests / test-99.cs
blob036850e34bbd396b89818a143a148ddff87b2ffd
1 //
2 // Tests the resulting value of operator + (U x, E y)
3 // as well as implicit conversions in the above operator.
4 //
5 using System;
6 class X {
7 enum A : int {
8 a = 1, b, c
11 enum Test : short {
12 A = 1,
16 public static int Main ()
18 int v = 1;
19 object foo = (v + A.a);
20 object foo2 = (1 + A.a);
22 if (foo.GetType ().ToString () != "X+A"){
23 Console.WriteLine ("Expression evaluator bug in E operator + (U x, E y)");
24 return 1;
27 if (foo2.GetType ().ToString () != "X+A"){
28 Console.WriteLine ("Constant folder bug in E operator + (U x, E y)");
29 return 2;
32 // Now try the implicit conversions for underlying types in enum operators
33 byte b = 1;
34 short s = (short) (Test.A + b);
36 const int e = A.b + 1 - A.a;
39 // Make sure that other operators still work
40 if (Test.A != Test.A)
41 return 3;
42 if (Test.A == Test.B)
43 return 4;
45 const A e2 = 3 - A.b;
46 if (e2 != A.a)
47 return 5;
49 return 0;