2002-11-17 Martin Baulig <martin@ximian.com>
[mono.git] / mcs / tests / test-173.cs
1 using System;
2
3 class Base
4 {
5         int value;
6
7         public int Value {
8                 get { return value; }
9         }
10
11         protected Base (int value)
12         {
13                 this.value = value;
14         }
15 }
16
17 class A : Base
18 {
19         public A (int value)
20                 : base (1)
21         {
22                 Console.WriteLine ("Int");
23         }
24
25         public A (uint value)
26                 : base (2)
27         {
28                 Console.WriteLine ("UInt");
29         }
30 }
31
32 class B : Base
33 {
34         public B (long value)
35                 : base (3)
36         {
37                 Console.WriteLine ("Long");
38         }
39
40         public B (ulong value)
41                 : base (4)
42         {
43                 Console.WriteLine ("ULong");
44         }
45 }
46
47 class C : Base
48 {
49         public C (short value)
50                 : base (5)
51         {
52                 Console.WriteLine ("Short");
53         }
54
55         public C (ushort value)
56                 : base (6)
57         {
58                 Console.WriteLine ("UShort");
59         }
60 }
61
62 class D : Base
63 {
64         public D (sbyte value)
65                 : base (7)
66         {
67                 Console.WriteLine ("SByte");
68         }
69
70         public D (byte value)
71                 : base (8)
72         {
73                 Console.WriteLine ("Byte");
74         }
75 }
76
77 class X
78 {
79         static int Test ()
80         {
81                 {
82                         A a = new A (4);
83                         if (a.Value != 1)
84                                 return 1;
85
86                         B b = new B (4);
87                         if (b.Value != 3)
88                                 return 2;
89
90                         C c = new C (4);
91                         if (c.Value != 5)
92                                 return 3;
93
94                         D d = new D (4);
95                         if (d.Value != 7)
96                                 return 4;
97                 }
98
99                 {
100                         A a = new A (4u);
101                         if (a.Value != 2)
102                                 return 5;
103
104                         B b = new B (4u);
105                         if (b.Value != 3)
106                                 return 6;
107
108                         C c = new C (4);
109                         if (c.Value != 5)
110                                 return 7;
111
112                         D d = new D (4);
113                         if (d.Value != 7)
114                                 return 8;
115                 }
116
117                 return 0;
118         }
119
120         static int Main ()
121         {
122                 int result = Test ();
123                 Console.WriteLine ("RESULT: {0}", result);
124                 return result;
125         }
126 }