* the IL code looks.
*/
-class Tests {
-
- static int Main () {
- return TestDriver.RunTests (typeof (Tests));
- }
+#if MOBILE
+class ArrayTests
+#else
+class Tests
+#endif
+{
+
+#if !MOBILE
+ public static int Main (string[] args) {
+ return TestDriver.RunTests (typeof (Tests), args);
+ }
+#endif
public static int test_10_create () {
int[] a = new int [10];
return 0;
}
- private Int32[] m_array = new int [10];
-
- void setBit (int bitIndex, bool value) {
- int index = bitIndex/32;
- int shift = bitIndex%32;
+ class BitClass {
+ private Int32[] m_array = new int [10];
- Int32 theBit = 1 << shift;
- if (value)
- m_array[index] |= theBit;
- else
- m_array[index] &= ~theBit;
- }
-
- bool getBit (int bitIndex) {
- int index = bitIndex/32;
- int shift = bitIndex%32;
+ public void setBit (int bitIndex, bool value) {
+ int index = bitIndex/32;
+ int shift = bitIndex%32;
- Int32 theBit = m_array[index] & (1 << shift);
- return (theBit == 0) ? false : true;
+ Int32 theBit = 1 << shift;
+ if (value)
+ m_array[index] |= theBit;
+ else
+ m_array[index] &= ~theBit;
+ }
+
+ public bool getBit (int bitIndex) {
+ int index = bitIndex/32;
+ int shift = bitIndex%32;
+ Int32 theBit = m_array[index] & (1 << shift);
+ return (theBit == 0) ? false : true;
+ }
}
public static int test_1_bit_index () {
- Tests t = new Tests ();
+ var t = new BitClass ();
t.setBit (0, true);
t.setBit (3, true);
if (t.getBit (1))
if (sum != 1800)
return 12;
+ /* Null check */
+ object[,] a13 = null;
+ try {
+ a13 [0, 0] = new Object ();
+ return 13;
+ } catch (NullReferenceException) {
+ }
+
return 0;
}
return test [1, 1, 1];
}
+ public static int test_100_4_dimensional_arrays () {
+ int[,,,] test = new int[10, 10, 10, 10];
+
+ test [1, 1, 1, 1] = 100;
+ return test [1, 1, 1, 1];
+ }
+
public static int test_0_bug_71454 () {
int[,] a = new int[4,4];
int[,] b = new int[4,4];
return y;
}
+ class RefClass {
+ }
+
public static int test_0_stelem_ref_null_opt () {
- object[] arr = new Tests [1];
+ object[] arr = new RefClass [1];
- arr [0] = new Tests ();
+ arr [0] = new RefClass ();
arr [0] = null;
return arr [0] == null ? 0 : 1;
return 0;
}
- public static int long_indices () {
+ public static int test_0_long_indices () {
int[] arr = new int [10];
int[,] arr2 = new int [10, 10];
long index = 1;
return 2;
return 0;
}
+
+ // #7438
+ public static int test_0_ldelema_2_64bit () {
+ bool[,] test = new bool[201,201];
+ int x,y;
+ for(x=-100;x<100;x++) for(y=-100;y<100;y++){
+ test[x+100,y+100] = true;
+ }
+ return 0;
+ }
+
+ static bool alloc_long (long l) {
+ try {
+ var arr = new byte[l];
+ return false;
+ } catch (Exception e) {
+ return true;
+ }
+ }
+
+ // #13544
+ public static int test_0_newarr_ovf () {
+ if (!alloc_long (5000000000))
+ return 1;
+ if (!alloc_long (4000000000))
+ return 2;
+ if (!alloc_long (-1))
+ return 3;
+ if (!alloc_long (-4000000000))
+ return 4;
+ if (!alloc_long (-6000000000))
+ return 5;
+ return 0;
+ }
}