Author: zoltan
Date: 2005-12-12 14:14:17 -0500 (Mon, 12 Dec 2005)
New Revision: 54251
Modified:
trunk/mono/mono/mini/ChangeLog
trunk/mono/mono/mini/generics.2.cs
Log:
2005-12-12 Zoltan Varga <[EMAIL PROTECTED]>
* generics.2.cs: Add valuetype tests.
Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog 2005-12-12 17:48:24 UTC (rev 54250)
+++ trunk/mono/mono/mini/ChangeLog 2005-12-12 19:14:17 UTC (rev 54251)
@@ -1,3 +1,7 @@
+2005-12-12 Zoltan Varga <[EMAIL PROTECTED]>
+
+ * generics.2.cs: Add valuetype tests.
+
2005-12-09 Zoltan Varga <[EMAIL PROTECTED]>
* basic-long.cs: Add i4->u8 test.
Modified: trunk/mono/mono/mini/generics.2.cs
===================================================================
--- trunk/mono/mono/mini/generics.2.cs 2005-12-12 17:48:24 UTC (rev 54250)
+++ trunk/mono/mono/mini/generics.2.cs 2005-12-12 19:14:17 UTC (rev 54251)
@@ -2,6 +2,14 @@
class Tests {
+ struct TestStruct {
+ public int i;
+
+ public TestStruct (int i) {
+ this.i = i;
+ }
+ }
+
static int Main ()
{
return TestDriver.RunTests (typeof (Tests));
@@ -32,7 +40,33 @@
object o = 1;
return (o is int?) ? 1 : 0;
}
+
+ public static int test_1_nullable_unbox_vtype ()
+ {
+ return Unbox<TestStruct?> (new TestStruct (1)).Value.i;
+ }
+ public static int test_1_nullable_unbox_null_vtype ()
+ {
+ return Unbox<int?> (null).HasValue ? 0 : 1;
+ }
+
+ public static int test_1_nullable_box_vtype ()
+ {
+ return ((TestStruct)(Box<TestStruct?> (new TestStruct (1)))).i;
+ }
+
+ public static int test_1_nullable_box_null_vtype ()
+ {
+ return Box<TestStruct?> (null) == null ? 1 : 0;
+ }
+
+ public static int test_1_isinst_nullable_vtype ()
+ {
+ object o = new TestStruct (1);
+ return (o is TestStruct?) ? 1 : 0;
+ }
+
static object Box<T> (T t)
{
return t;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches