Fix problems with overlong directory names: phase #1
[mono.git] / mono / mini / basic.cs
index eed1fe55ac33caa2ad870635b72da4b9268c0f96..9ef9afef1369a754ae0ffb7e87c81e6a1f7f3795 100644 (file)
@@ -307,6 +307,90 @@ class Tests {
                return number == n ? 0 : 1;
        }
 
+       public static int test_0_sub_ovf () {
+               int i, j, k;
+
+               checked {
+                       i = System.Int32.MinValue;
+                       j = 0;
+                       k = i - j;
+               }
+
+               if (k != System.Int32.MinValue)
+                       return 1;
+
+               checked {
+                       i = System.Int32.MaxValue;
+                       j = 0;
+                       k = i - j;
+               }
+
+               if (k != System.Int32.MaxValue)
+                       return 2;
+
+               checked {
+                       i = System.Int32.MinValue;
+                       j = System.Int32.MinValue + 1234;
+                       k = i - j;
+               }
+
+               if (k != -1234)
+                       return 3;
+
+               checked {
+                       i = System.Int32.MaxValue;
+                       j = 1234;
+                       k = i - j;
+               }
+
+               if (k != System.Int32.MaxValue - 1234)
+                       return 4;
+
+               checked {
+                       i = System.Int32.MaxValue - 1234;
+                       j = -1234;
+                       k = i - j;
+               }
+
+               if (k != System.Int32.MaxValue)
+                       return 5;
+
+               checked {
+                       i = System.Int32.MinValue + 1234;
+                       j = 1234;
+                       k = i - j;
+               }
+
+               if (k != System.Int32.MinValue)
+                       return 6;
+
+               return 0;
+       }
+
+       public static int test_0_sub_ovf_un () {
+               uint i, j, k;
+
+               checked {
+                       i = System.UInt32.MaxValue;
+                       j = 0;
+                       k = i - j;
+               }
+
+               if (k != System.UInt32.MaxValue)
+                       return 1;
+
+               checked {
+                       i = System.UInt32.MaxValue;
+                       j = System.UInt32.MaxValue;
+                       k = i - j;
+               }
+
+               if (k != 0)
+                       return 2;
+
+               return 0;
+       }
+
        public static int test_3_or () {
                int b = 2;
                int a = 3;
@@ -955,6 +1039,68 @@ class Tests {
 
                return 0;
        }
+
+       public static int test_0_mul_imm_opt ()
+       {
+               int i;
+
+               i = 1;
+               if ((i * 2) != 2)
+                       return 1;
+               i = -1;
+               if ((i * 2) != -2)
+                       return 2;
+               i = 1;
+               if ((i * 3) != 3)
+                       return 3;
+               i = -1;
+               if ((i * 3) != -3)
+                       return 4;
+               i = 1;
+               if ((i * 5) != 5)
+                       return 5;
+               i = -1;
+               if ((i * 5) != -5)
+                       return 6;
+               i = 1;
+               if ((i * 6) != 6)
+                       return 7;
+               i = -1;
+               if ((i * 6) != -6)
+                       return 8;
+               i = 1;
+               if ((i * 9) != 9)
+                       return 9;
+               i = -1;
+               if ((i * 9) != -9)
+                       return 10;
+               i = 1;
+               if ((i * 10) != 10)
+                       return 11;
+               i = -1;
+               if ((i * 10) != -10)
+                       return 12;
+               i = 1;
+               if ((i * 12) != 12)
+                       return 13;
+               i = -1;
+               if ((i * 12) != -12)
+                       return 14;
+               i = 1;
+               if ((i * 25) != 25)
+                       return 15;
+               i = -1;
+               if ((i * 25) != -25)
+                       return 16;
+               i = 1;
+               if ((i * 100) != 100)
+                       return 17;
+               i = -1;
+               if ((i * 100) != -100)
+                       return 18;
+               
+               return 0;
+       }
        
        public static int test_0_cne ()
        {
@@ -971,22 +1117,7 @@ class Tests {
                
                return 0;
        }
-       
-       static byte b;
-       public static int test_0_byte_compares ()
-       {
-               b = 0xff;
-               if (b == -1)
-                       return 1;
-               b = 0;
-               if (!(b < System.Byte.MaxValue))
-                       return 2;
-               
-               if (!(b <= System.Byte.MaxValue))
-                       return 3;
-               
-               return 0;
-       }
+
        public static int test_0_cmp_regvar_zero ()
        {
                int n = 10;
@@ -999,4 +1130,19 @@ class Tests {
                return 0;
        }
 
+       public static int test_5_div_un_cfold ()
+       {
+               uint i = 10;
+               uint j = 2;
+
+               return (int)(i / j);
+       }
+
+       public static int test_1_rem_un_cfold ()
+       {
+               uint i = 11;
+               uint j = 2;
+
+               return (int)(i % j);
+       }
 }