2008-08-22 Zoltan Varga <vargaz@gmail.com>
[mono.git] / mono / mini / arrays.cs
index 012bdfdf7565646297e52a6a20b6c9c2bb4d51db..3775332690c554f0d8daf82b2b783535fdde48bc 100644 (file)
@@ -476,6 +476,75 @@ class Tests {
 
                return y;
        }
+
+       public static int test_0_stelem_ref_null_opt () {
+               object[] arr = new Tests [1];
+
+               arr [0] = new Tests ();
+               arr [0] = null;
+
+               return arr [0] == null ? 0 : 1;
+       }
+
+       public static int test_0_invalid_new_array_size () {
+               int size;
+               object res = null;
+               size = -1;
+               try {
+                       res = new float [size];
+               } catch (OverflowException e) {
+
+               } catch (Exception) {
+                       return 1;
+               }
+               if (res != null)
+                       return 2;
+
+               size = -2147483648;
+               try {
+                       res = new float [size];
+               } catch (OverflowException e) {
+
+               } catch (Exception) {
+                       return 3;
+               }
+
+               if (res != null)
+                       return 4;
+
+               return 0;
+       }
+
+
+       public static int test_0_invalid_new_multi_dym_array_size () {
+               int dym_size = 1;
+               int size;
+               object res = null;
+               size = -1;
+               try {
+                       res = new float [dym_size, size];
+               } catch (OverflowException e) {
+
+               } catch (Exception) {
+                       return 1;
+               }
+               if (res != null)
+                       return 2;
+
+               size = -2147483648;
+               try {
+                       res = new float [size, dym_size];
+               } catch (OverflowException e) {
+
+               } catch (Exception) {
+                       return 3;
+               }
+
+               if (res != null)
+                       return 4;
+
+               return 0;
+       }
 }