2010-06-21 Rodrigo Kumpera <rkumpera@novell.com>
[mono.git] / mono / tests / exception6.cs
blobb2e09b9296b7214a4b6e03cf8978678a4e41b0d0
1 using System;
3 public class Ex {
5 public static int test () {
6 int ocount = 0;
8 checked {
10 ocount = 0;
11 try {
12 ulong a = UInt64.MaxValue - 1;
13 ulong t = a++;
14 } catch {
15 ocount++;
17 if (ocount != 0)
18 return 1;
20 ocount = 0;
21 try {
22 ulong a = UInt64.MaxValue;
23 ulong t = a++;
24 } catch {
25 ocount++;
27 if (ocount != 1)
28 return 2;
30 ocount = 0;
31 try {
32 long a = Int64.MaxValue - 1;
33 long t = a++;
34 } catch {
35 ocount++;
37 if (ocount != 0)
38 return 3;
40 try {
41 long a = Int64.MaxValue;
42 long t = a++;
43 } catch {
44 ocount++;
46 if (ocount != 1)
47 return 4;
49 ocount = 0;
50 try {
51 ulong a = UInt64.MaxValue - 1;
52 ulong t = a++;
53 } catch {
54 ocount++;
56 if (ocount != 0)
57 return 5;
59 try {
60 ulong a = UInt64.MaxValue;
61 ulong t = a++;
62 } catch {
63 ocount++;
65 if (ocount != 1)
66 return 6;
68 ocount = 0;
69 try {
70 long a = Int64.MinValue + 1;
71 long t = a--;
72 } catch {
73 ocount++;
75 if (ocount != 0)
76 return 7;
78 ocount = 0;
79 try {
80 long a = Int64.MinValue;
81 long t = a--;
82 } catch {
83 ocount++;
85 if (ocount != 1)
86 return 8;
88 ocount = 0;
89 try {
90 ulong a = UInt64.MinValue + 1;
91 ulong t = a--;
92 } catch {
93 ocount++;
95 if (ocount != 0)
96 return 9;
98 ocount = 0;
99 try {
100 ulong a = UInt64.MinValue;
101 ulong t = a--;
102 } catch {
103 ocount++;
105 if (ocount != 1)
106 return 10;
108 ocount = 0;
109 try {
110 int a = Int32.MinValue + 1;
111 int t = a--;
112 } catch {
113 ocount++;
115 if (ocount != 0)
116 return 11;
118 ocount = 0;
119 try {
120 int a = Int32.MinValue;
121 int t = a--;
122 } catch {
123 ocount++;
125 if (ocount != 1)
126 return 12;
128 ocount = 0;
129 try {
130 uint a = 1;
131 uint t = a--;
132 } catch {
133 ocount++;
135 if (ocount != 0)
136 return 13;
138 ocount = 0;
139 try {
140 uint a = 0;
141 uint t = a--;
142 } catch {
143 ocount++;
145 if (ocount != 1)
146 return 14;
148 ocount = 0;
149 try {
150 sbyte a = 126;
151 sbyte t = a++;
152 } catch {
153 ocount++;
155 if (ocount != 0)
156 return 15;
158 ocount = 0;
159 try {
160 sbyte a = 127;
161 sbyte t = a++;
162 } catch {
163 ocount++;
165 if (ocount != 1)
166 return 16;
168 ocount = 0;
169 try {
170 } catch {
171 ocount++;
173 if (ocount != 0)
174 return 17;
176 ocount = 0;
177 try {
178 int a = 1 << 29;
179 int t = a*2;
180 } catch {
181 ocount++;
183 if (ocount != 0)
184 return 18;
186 ocount = 0;
187 try {
188 int a = 1 << 30;
189 int t = a*2;
190 } catch {
191 ocount++;
193 if (ocount != 1)
194 return 19;
196 ocount = 0;
197 try {
198 ulong a = 0xffffffffff;
199 ulong t = a*0x0ffffff;
200 } catch {
201 ocount++;
203 if (ocount != 0)
204 return 20;
206 ocount = 0;
207 try {
208 ulong a = 0xffffffffff;
209 ulong t = a*0x0fffffff;
210 } catch {
211 ocount++;
213 if (ocount != 1)
214 return 21;
217 return 0;
219 public static int Main () {
220 return test();