[configure] Add new target.
[mono-project.git] / mcs / tests / test-10.cs
blob27857a922c6f1224a4ddf847c02c426ced6de8b8
1 /*
2 * Test explicit numeric conversions.
3 */
5 using System;
7 class X {
9 void asbyte (byte a, ushort b, uint c, ulong d, char e)
13 void bsbyte ()
15 sbyte s = 0;
17 asbyte ((byte) s, (ushort) s, (uint) s, (ulong) s, (char) s);
18 asbyte (checked ((byte) s), checked ((ushort) s), checked ((uint) s), checked ((ulong) s), checked ((char) s));
21 void abyte (sbyte a, char b)
25 void bbyte ()
27 byte b = 0;
29 abyte ((sbyte) b, (char) b);
30 abyte (checked ((sbyte) b), checked ((char) b));
33 void ashort (sbyte a, byte b, ushort c, uint d, ulong e, char f)
37 void bshort ()
39 short a = 1;
41 ashort ((sbyte) a, (byte) a, (ushort) a, (uint) a, (ulong) a, (char) a);
42 ashort (checked ((sbyte) a), checked ((byte) a), checked ((ushort) a), checked ((uint) a), checked ((ulong) a), checked ((char) a));
45 void aushort (sbyte a, byte b, short c, char d)
49 void bushort ()
51 ushort a = 1;
52 aushort ((sbyte) a, (byte) a, (short) a, (char) a);
53 aushort (checked ((sbyte) a), checked ((byte) a), checked ((short) a), checked ((char) a));
56 void aint (sbyte a, byte b, short c, ushort d, uint e, ulong f, char g)
60 void bint ()
62 int a = 1;
64 aint ((sbyte) a, (byte) a, (short) a, (ushort) a, (uint) a, (ulong) a, (char) a);
65 aint (checked ((sbyte) a), checked ((byte) a), checked ((short) a), checked ((ushort) a), checked ((uint) a), checked ((ulong) a), checked ((char) a));
68 void auint (sbyte a, byte b, short c, ushort d, int e, char f)
72 void buint ()
74 uint a = 1;
76 auint ((sbyte) a, (byte) a, (short) a, (ushort) a, (int) a, (char) a);
77 auint (checked ((sbyte) a), checked ((byte) a), checked ((short) a), checked ((ushort) a), checked ((int) a), checked ((char) a));
80 void along (sbyte a, byte b, short c, ushort d, int e, uint f, ulong g, char h)
84 void blong ()
86 long a = 1;
88 along ((sbyte) a, (byte) a, (short) a, (ushort) a, (int) a, (uint) a, (ulong) a, (char) a);
89 along (checked ((sbyte) a), checked ((byte) a), checked ((short) a), checked ((ushort) a), checked ((int) a), checked ((uint) a), checked ((ulong) a), checked ((char) a));
92 void aulong (sbyte a, byte b, short c, ushort d, int e, uint f, long g, char h)
96 void bulong ()
98 ulong a = 1;
100 aulong ((sbyte) a, (byte) a, (short) a, (ushort) a, (int) a, (uint) a, (long) a, (char) a);
101 aulong (checked ((sbyte) a), checked ((byte) a), checked ((short) a), checked ((ushort) a), checked ((int) a), checked ((uint) a), checked ((long) a), checked ((char) a));
104 void achar (sbyte a, byte b, short c)
109 void bchar ()
111 char a = (char) 1;
113 achar ((sbyte) a, (byte) a, (short) a);
114 achar (checked ((sbyte) a), checked ((byte) a), checked ((short) a));
117 void afloat (sbyte a, byte b, short c, ushort d, int e, uint f, long ll, ulong g, char h, decimal dd)
121 void bfloat ()
123 float a = 1;
125 afloat ((sbyte) a, (byte) a, (short) a, (ushort) a, (int) a, (uint) a, (long) a,
126 (ulong) a, (char) a, (decimal) a);
127 afloat (checked ((sbyte) a), checked ((byte) a), checked ((short) a), checked ((ushort) a), checked ((int) a), checked ((uint) a), checked ((long) a),
128 checked ( (ulong) a), checked ((char) a), checked ((decimal) a));
131 void adouble (sbyte a, byte b, short c, ushort d, int e, uint f, long ll, ulong g, char h,
132 float ff, decimal dd)
136 void bdouble ()
138 double a = 1;
140 adouble ((sbyte) a, (byte) a, (short) a, (ushort) a, (int) a, (uint) a, (long) a,
141 (ulong) a, (char) a, (float) a, (decimal) a);
142 adouble (checked ((sbyte) a), checked ((byte) a), checked ((short) a), checked ((ushort) a), checked ((int) a), checked ((uint) a), checked ((long) a),
143 checked ( (ulong) a), checked ((char) a), checked ((float) a), (decimal) a);
146 void TestDecimal (decimal d)
148 double dec = (double)d;
149 decimal dec2 = (decimal)dec;
152 public static void Main ()
158 enum E:byte {
159 Min = 9
162 class Test2 {
163 void ExtraTst ()
165 E error = E.Min - 9;
166 string s = (string)null;
167 const decimal d = -10.1m;
168 const long l = (long)d;
169 char ch = (char)E.Min;
170 bool b = (DBNull) null == null;