2006-04-20 Geoff Norton <gnorton@customerdna.com>
[mono.git] / mono / mini / objects.cs
index 8d5886fd7e37d6e82c63f95c70408abc255eb27b..ef3585213b5cdd525cb2761929933dab7f561d1a 100644 (file)
@@ -1,6 +1,7 @@
 using System;
 using System.Reflection;
 using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
 
 /*
  * Regression tests for the mono JIT.
@@ -926,5 +927,72 @@ ncells ) {
                return (int)position;
        }
 
+       struct FooStruct {
+
+               public FooStruct (long l) {
+               }
+       }
+
+       static int test_0_calls_opcode_emulation () {
+               // Test that emulated opcodes do not clobber arguments already in
+               // out registers
+               checked {
+                       long val = 10000;
+                       new FooStruct (val * 10000);
+               }
+               return 0;
+       }
+
+       static int test_0_intrins_string_length () {
+               string s = "ABC";
+
+               return (s.Length == 3) ? 0 : 1;
+       }
+
+       static int test_0_intrins_string_chars () {
+               string s = "ABC";
+
+               return (s [0] == 'A' && s [1] == 'B' && s [2] == 'C') ? 0 : 1;
+       }
+
+       static int test_0_intrins_object_gettype () {
+               object o = 1;
+
+               return (o.GetType () == typeof (int)) ? 0 : 1;
+       }
+
+       static int test_0_intrins_object_gethashcode () {
+               object o = new Object ();
+
+               return (o.GetHashCode () == o.GetHashCode ()) ? 0 : 1;
+       }
+
+       class FooClass {
+       }
+
+       static int test_0_intrins_object_ctor () {
+               object o = new FooClass ();
+
+               return (o != null) ? 0 : 1;
+       }
+
+       static int test_0_intrins_array_rank () {
+               int[,] a = new int [10, 10];
+
+               return (a.Rank == 2) ? 0 : 1;
+       }
+
+       static int test_0_intrins_array_length () {
+               int[,] a = new int [10, 10];
+               Array a2 = a;
+
+               return (a2.Length == 100) ? 0 : 1;
+       }
+
+       static int test_0_intrins_runtimehelpers_offset_to_string_data () {
+               int i = RuntimeHelpers.OffsetToStringData;
+               
+               return i - i;
+       }
 }