Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / mini / basic-math.cs
index 93a1949bb97ac195c12b3434d12a9c62d07f1f90..a5aeb9cc8a9eac5d8e28873b5f53601acff087bd 100644 (file)
@@ -23,11 +23,18 @@ using System.Reflection;
  * the IL code looks.
  */
 
-class Tests {
+#if __MOBILE__
+class MathTests
+#else
+class Tests
+#endif
+{
 
-       public static int Main () {
-               return TestDriver.RunTests (typeof (Tests));
+#if !__MOBILE__
+       public static int Main (string[] args) {
+               return TestDriver.RunTests (typeof (Tests), args);
        }
+#endif
        
        public static int test_0_sin_precision () {
                double d1 = Math.Sin (1);
@@ -249,4 +256,49 @@ class Tests {
                        return 1;
                return 0;
        }
+
+       public static int test_0_float_abs () {
+               float f = -1.0f;
+
+               if (Math.Abs (f) != 1.0f)
+                       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;
+       }
 }