X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Ftests%2Fdtest-033.cs;h=f64fdc0b53c2afa1e247eaee8f0739dd7615ab60;hb=100bd760a46811121b4b47ebba941d4fb98486ab;hp=fc2d9aa5d8b3074a43dcf3fb9a1e95ce0cd1ae00;hpb=76368b52590d0f61794a0f5e5d824e7c9488d7a3;p=mono.git diff --git a/mcs/tests/dtest-033.cs b/mcs/tests/dtest-033.cs index fc2d9aa5d8b..f64fdc0b53c 100644 --- a/mcs/tests/dtest-033.cs +++ b/mcs/tests/dtest-033.cs @@ -11,6 +11,11 @@ public class Test get { return 2; } set { } } + + byte Byte = 200; + static dynamic V; + dynamic DynamicByte; + byte[] ByteArray = { 1, 100 }; public static int Main () { @@ -33,7 +38,57 @@ public class Test byte b = 4; a.Prop *= b; a[4] ^= b; + + dynamic d = 1; + b = byte.MaxValue; + try { + checked { + b += d; + return 3; + } + } catch (OverflowException) { + } + + b += d; + + try { + checked { + a.Byte += 100; + return 4; + } + } catch (OverflowException) { + } + + a.Byte += 100; + + checked { + d = byte.MaxValue; + d += 100; + } + + checked { + V = byte.MaxValue; + V -= 300; + } + + var t = new Test (); + t.DynamicByte = byte.MaxValue; + d = t; + checked { + d.DynamicByte -= 500; + } + + if (t.DynamicByte != -245) + return 5; + + try { + checked { + d.ByteArray[1] += 200; + return 6; + } + } catch (OverflowException) { + } return 0; } -} \ No newline at end of file +}