2009-01-24 Zoltan Varga <vargaz@gmail.com>
[mcs.git] / tests / test-147.cs
blob8d7866cfd262899b89ee36e707c1b18655c2be15
1 using System;
3 public class X
5 public long Value = 5;
6 public static long StaticValue = 6;
8 public static X Foo ()
10 return new X ();
13 public static X Bar ()
15 return Foo ();
18 public X Baz ()
20 return Bar ();
23 public uint Property {
24 get {
25 return 3;
29 public static uint StaticProperty {
30 get {
31 return 20;
35 public int this [int index] {
36 get {
37 return 1;
42 public class Y : X
44 new public long Value = 8;
45 new public static long StaticValue = 9;
47 public static new Y Foo ()
49 return new Y ();
52 public static new Y Bar ()
54 return Foo ();
57 public new Y Baz ()
59 return Bar ();
62 public new uint Property {
63 get {
64 return 4;
68 public new static uint StaticProperty {
69 get {
70 return 21;
74 public new int this [int index] {
75 get {
76 return 2;
81 public class Z : Y
83 public int Test () {
84 if (Property != 4)
85 return 20;
87 if (StaticProperty != 21)
88 return 21;
90 if (((X) this).Property != 3)
91 return 22;
93 if (X.StaticProperty != 20)
94 return 23;
96 if (this [5] != 2)
97 return 24;
99 if (((X) this) [6] != 1)
100 return 25;
102 return 0;
106 public class Test
108 public static int Main ()
110 Y y = new Y ();
111 X a,b,c,d;
113 a = Y.Bar ();
114 if (!(a is Y))
115 return 1;
117 b = y.Baz ();
118 if (!(b is Y))
119 return 2;
121 c = X.Bar ();
122 if (c is Y)
123 return 3;
125 d = ((X) y).Baz ();
126 if (d is Y)
127 return 4;
129 if (y.Value != 8)
130 return 5;
132 if (((X) y).Value != 5)
133 return 6;
135 if (Y.StaticValue != 9)
136 return 7;
138 if (X.StaticValue != 6)
139 return 8;
141 if (y.Property != 4)
142 return 9;
144 if (((X) y).Property != 3)
145 return 10;
147 if (y [5] != 2)
148 return 11;
150 if (((X) y) [7] != 1)
151 return 10;
153 if (X.StaticProperty != 20)
154 return 11;
156 if (Y.StaticProperty != 21)
157 return 12;
159 Z z = new Z ();
161 return z.Test ();