2007-05-25 Jonathan Chambers <joncham@gmail.com>
[mcs.git] / tests / test-99.cs
blob79c5d7d7cbf52781dba3c35d9b6ec3cd90e20707
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 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);
37 // Make sure that other operators still work
38 if (Test.A != Test.A)
39 return 3;
40 if (Test.A == Test.B)
41 return 4;
43 return 0;