X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Ftests%2Fruntime-invoke.cs;h=624feae80cd7822e0dfaddd6ae60013655f43385;hb=309e3348d30ffb2cd02d2eb503e9b72e97877268;hp=89c728a9e2ae8c1b53c43844115f97bdf4d78640;hpb=1c94cd384979e8cd606937b9e98dc1d3361ad58e;p=mono.git diff --git a/mono/tests/runtime-invoke.cs b/mono/tests/runtime-invoke.cs index 89c728a9e2a..624feae80cd 100644 --- a/mono/tests/runtime-invoke.cs +++ b/mono/tests/runtime-invoke.cs @@ -197,4 +197,56 @@ class Tests var res = typeof (Tests).GetMethod ("pack_i2").Invoke (null, new object [] { (short)-1 }); return (bool)res ? 0 : 1; } + + public static bool pack_bool (bool b) { + return true; + } + + public static bool pack_i1 (sbyte value) { + int c = 0; + // Force 'value' to be register allocated + for (int i = 0; i < value; ++i) + c += value; + return value < -1; + } + + public static int test_0_i1_bool () { + typeof (Tests).GetMethod ("pack_bool").Invoke (null, new object [] { true }); + var res = typeof (Tests).GetMethod ("pack_i1").Invoke (null, new object [] { (sbyte)-0x40 }); + return (bool)res ? 0 : 1; + } + + struct Point { + public int x, y; + } + + struct Foo2 { + public Point Location { + get { + return new Point () { x = 10, y = 20 }; + } + } + } + + public static int test_0_vtype_method_vtype_ret () { + var f = new Foo2 (); + var p = (Point)typeof (Foo2).GetMethod ("get_Location").Invoke (f, null); + if (p.x != 10 || p.y != 20) + return 1; + return 0; + } + + public static int test_0_array_get_set () { + int[,,] arr = new int [10, 10, 10]; + arr [0, 1, 2] = 42; + var gm = arr.GetType ().GetMethod ("Get"); + int i = (int) gm.Invoke (arr, new object [] { 0, 1, 2 }); + if (i != 42) + return 1; + var sm = arr.GetType ().GetMethod ("Set"); + sm.Invoke (arr, new object [] { 0, 1, 2, 33 }); + if (arr [0, 1, 2] != 33) + return 2; + return 0; + } }