2010-05-13 Rodrigo Kumpera <rkumpera@novell.com>
[mono-project.git] / mcs / tests / test-173.cs
blob0484578d1dc219c7f989f0fb5ad2ad207f04f8bc
1 using System;
3 class Base
5 int value;
7 public int Value {
8 get { return value; }
11 protected Base (int value)
13 this.value = value;
17 class A : Base
19 public A (int value)
20 : base (1)
22 Console.WriteLine ("Int");
25 public A (uint value)
26 : base (2)
28 Console.WriteLine ("UInt");
32 class B : Base
34 public B (long value)
35 : base (3)
37 Console.WriteLine ("Long");
40 public B (ulong value)
41 : base (4)
43 Console.WriteLine ("ULong");
47 class C : Base
49 public C (short value)
50 : base (5)
52 Console.WriteLine ("Short");
55 public C (ushort value)
56 : base (6)
58 Console.WriteLine ("UShort");
62 class D : Base
64 public D (sbyte value)
65 : base (7)
67 Console.WriteLine ("SByte");
70 public D (byte value)
71 : base (8)
73 Console.WriteLine ("Byte");
77 class E : Base
79 public E (long value)
80 : base (9)
82 Console.WriteLine ("Long");
85 public E (E e)
86 : base (10)
88 Console.WriteLine ("E");
91 public static implicit operator E (long value)
93 return (new E (value));
97 class F : Base
99 public F (int value)
100 : base (11)
102 Console.WriteLine ("Int");
105 public F (F f)
106 : base (12)
108 Console.WriteLine ("F");
111 public static implicit operator F (int value)
113 return (new F (value));
117 class X
119 static int Test ()
122 A a = new A (4);
123 if (a.Value != 1)
124 return 1;
126 B b = new B (4);
127 if (b.Value != 3)
128 return 2;
130 C c = new C (4);
131 if (c.Value != 5)
132 return 3;
134 D d = new D (4);
135 if (d.Value != 7)
136 return 4;
140 A a = new A (4u);
141 if (a.Value != 2)
142 return 5;
144 B b = new B (4u);
145 if (b.Value != 3)
146 return 6;
148 C c = new C (4);
149 if (c.Value != 5)
150 return 7;
152 D d = new D (4);
153 if (d.Value != 7)
154 return 8;
158 E e = new E (4);
159 if (e.Value != 9)
160 return 9;
162 F f = new F (4);
163 if (f.Value != 11)
164 return 10;
167 return 0;
170 static int Main ()
172 int result = Test ();
173 Console.WriteLine ("RESULT: {0}", result);
174 return result;