X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fbasic-math.cs;h=d2fa1ede9bc9317e245a730a233024d36f6bc81c;hb=5a3deb839ed870dc8b7e660662a83f88817e0b73;hp=c470c8f13333b82a2ffa89db2d6091a03a133e76;hpb=c481db3c3a3b5d6ae4fa713cfeed4a7e95b9e580;p=mono.git diff --git a/mono/mini/basic-math.cs b/mono/mini/basic-math.cs index c470c8f1333..d2fa1ede9bc 100644 --- a/mono/mini/basic-math.cs +++ b/mono/mini/basic-math.cs @@ -188,6 +188,60 @@ class Tests { return 0; } + public static int test_0_min_un () { + uint a = (uint)int.MaxValue + 10; + + for (uint b = 7; b <= 10; ++b) { + if (Math.Min (a, b) != b) + return (int)b; + if (Math.Min (b, a) != b) + return (int)b; + } + + if (Math.Min ((ulong)5, (ulong)6) != 5) + return 4; + if (Math.Min ((ulong)6, (ulong)5) != 5) + return 5; + + ulong la = (ulong)long.MaxValue + 10; + + for (ulong b = 7; b <= 10; ++b) { + if (Math.Min (la, b) != b) + return (int)b; + if (Math.Min (b, la) != b) + return (int)b; + } + + return 0; + } + + public static int test_0_max_un () { + uint a = (uint)int.MaxValue + 10; + + for (uint b = 7; b <= 10; ++b) { + if (Math.Max (a, b) != a) + return (int)b; + if (Math.Max (b, a) != a) + return (int)b; + } + + if (Math.Max ((ulong)5, (ulong)6) != 6) + return 4; + if (Math.Max ((ulong)6, (ulong)5) != 6) + return 5; + + ulong la = (ulong)long.MaxValue + 10; + + for (ulong b = 7; b <= 10; ++b) { + if (Math.Max (la, b) != la) + return (int)b; + if (Math.Max (b, la) != la) + return (int)b; + } + + return 0; + } + public static int test_0_abs () { double d = -5.0; @@ -195,4 +249,41 @@ class Tests { return 1; return 0; } + + public static int test_0_round () { + if (Math.Round (5.0) != 5.0) + return 1; + + if (Math.Round (5.000000000000001) != 5.0) + return 2; + + if (Math.Round (5.499999999999999) != 5.0) + return 3; + + if (Math.Round (5.5) != 6.0) + return 4; + + if (Math.Round (5.999999999999999) != 6.0) + return 5; + + if (Math.Round (Double.Epsilon) != 0) + return 6; + + if (!Double.IsNaN (Math.Round (Double.NaN))) + return 7; + + if (!Double.IsPositiveInfinity (Math.Round (Double.PositiveInfinity))) + return 8; + + if (!Double.IsNegativeInfinity (Math.Round (Double.NegativeInfinity))) + return 9; + + if (Math.Round (Double.MinValue) != Double.MinValue) + return 10; + + if (Math.Round (Double.MaxValue) != Double.MaxValue) + return 11; + + return 0; + } }