2 using System.Reflection;
5 * Regression tests for the mono JIT.
7 * Each test needs to be of the form:
9 * static int test_<result>_<name> ();
11 * where <result> is an integer (the value that needs to be returned by
12 * the method to make it pass.
13 * <name> is a user-displayed name used to identify the test.
15 * The tests can be driven in two ways:
16 * *) running the program directly: Main() uses reflection to find and invoke
17 * the test methods (this is useful mostly to check that the tests are correct)
18 * *) with the --regression switch of the jit (this is the preferred way since
19 * all the tests will be run with optimizations on and off)
21 * The reflection logic could be moved to a .dll since we need at least another
22 * regression test file written in IL code to have better control on how
29 return TestDriver.RunTests (typeof (Tests));
32 public static int test_10_create () {
33 int[] a = new int [10];
37 public static int test_0_unset_value () {
38 int[] a = new int [10];
42 public static int test_3_set_value () {
43 int[] a = new int [10];
48 public static int test_0_char_array_1 () {
50 char[] tmp = new char [20];
51 char[] digitLowerTable = new char[16];
52 tmp[0] = digitLowerTable[-(value % 10)];
56 public static int test_0_char_array_2 () {
58 char[] tmp = new char [20];
59 char[] digitLowerTable = new char[16];
60 tmp[0] = digitLowerTable[value % 10];
64 public static int test_0_char_array_3 () {
66 char[] tmp = new char [20];
67 char[] digitLowerTable = new char[16];
68 tmp [0] = digitLowerTable[value & 15];
72 public unsafe static int test_0_byte_array () {
73 byte [] src = new byte [8];
75 byte *dst = (byte *)&ret;
78 dst[0] = src[4 + start];
83 public static int test_0_set_after_shift () {
84 int [] n = new int [1];
87 n [0] = 100 + (1 << (16 - b));
95 /* Regression test for #30073 */
96 public static int test_0_newarr_emulation () {
99 double [] arr = new double [(int)d];
104 private Int32[] m_array = new int [10];
106 void setBit (int bitIndex, bool value) {
107 int index = bitIndex/32;
108 int shift = bitIndex%32;
110 Int32 theBit = 1 << shift;
112 m_array[index] |= theBit;
114 m_array[index] &= ~theBit;
117 bool getBit (int bitIndex) {
118 int index = bitIndex/32;
119 int shift = bitIndex%32;
121 Int32 theBit = m_array[index] & (1 << shift);
122 return (theBit == 0) ? false : true;
126 public static int test_1_bit_index () {
127 Tests t = new Tests ();
141 int [] ma = new int [56];
142 const int MBIG = int.MaxValue;
145 for (int k = 1; k < 5; k++) {
146 for (int i = 1; i < 56; i++) {
147 ma [i] -= ma [1 + (i + 30) % 55];
155 public static int test_2_regalloc () {
156 helper1 h = new helper1 ();
160 public static int test_0_stelemref_1 () {
161 object [] o = new object [1];
167 public static int test_0_stelemref_2 () {
168 object [] o = new object [1];
175 class Face : IFace {}
177 public static int test_0_stelemref_3 () {
178 object [] o = new IFace [1];
184 public static int test_0_stelemref_4 () {
185 object [][] o = new object [5] [];
186 o [0] = new object [5];
191 public static int test_0_bug_71454 () {
192 int[,] a = new int[4,4];
193 int[,] b = new int[4,4];
194 for(int i = 0; i < 4; ++i) {
200 public static int test_0_interface_array_cast () {
202 object [] a = new ICloneable [2];
203 ICloneable [] b = (ICloneable [])a;
211 public static Foo[][] foo;
214 public static int test_0_regress_74549 () {
219 public static int test_0_regress_75832 () {
220 int[] table = new int[] { 0, 0 };