Example #1
0
    public MainApp(MainApp a,
                   Struct1 s1, Struct2 s2, Struct3 s3, Struct4 s4, Struct5 s5, Struct8 s8,
                   Valuesa v, float f, double d, Object o, String s, Enumacek e)
    {
        String values =
            a.ToString() + " " +
            s1.ToString() + " " +
            s2.ToString() + " " +
            s3.ToString() + " " +
            s4.ToString() + " " +
            s5.ToString() + " " +
            s8.ToString() + " " +
            v.ToString() + " " +
            f.ToString() + " " +
            d.ToString() + " " +
            o.ToString() + " " +
            s.ToString() + " " +
            e.ToString() + " " +
            ".";

        if (values != "MainApp 9 104 225 80 57 184 17 160 105 8 65 240" +
            " 153 88 113 64 201 168 161 144 249 248 209 224 -23767 606228808 2874968872843236" +
            "865 -9016159779942285264 360942425 4248 49 -5.193024E+18 -6.58392565490175E+18 M" +
            "ainApp 2212973731230676456 Hali .")
        {
            Console.WriteLine("MainApp(...): unexpected values: " + values);
            Fail(22);
        }
    }
 static int pass_struct4(Struct4 s)
 {
     if (s.i + s.j + s.k + s.l + s.m != 15)
     {
         return(1);
     }
     else
     {
         return(0);
     }
 }
    public static int test_0_struct4_args()
    {
        Struct4 s = new Struct4();

        s.i = 1;
        s.j = 2;
        s.k = 3;
        s.l = 4;
        s.m = 5;

        return(pass_struct4(s));
    }
Example #4
0
        private static HardDiskInfo smethod_1(byte byte_0)
        {
            Struct0 struct2 = new Struct0();
            Struct2 struct3 = new Struct2();
            Struct4 struct4 = new Struct4();
            uint    num     = 0;
            IntPtr  ptr     = CreateFile(@"\\.\Smartvsd", 0, 0, IntPtr.Zero, 1, 0, IntPtr.Zero);

            if (ptr == IntPtr.Zero)
            {
                throw new Exception("Open   smartvsd.vxd   failed.");
            }
            if (DeviceIoControl(ptr, 0x74080, IntPtr.Zero, 0, ref struct2, (uint)Marshal.SizeOf(struct2), ref num, IntPtr.Zero) == 0)
            {
                CloseHandle(ptr);
                throw new Exception("DeviceIoControl   failed:DFP_GET_VERSION");
            }
            if ((struct2.uint_0 & 1) == 0)
            {
                CloseHandle(ptr);
                throw new Exception("Error:   IDE   identify   command   not   supported.");
            }
            if ((byte_0 & 1) != 0)
            {
                struct3.struct1_0.byte_5 = 0xb0;
            }
            else
            {
                struct3.struct1_0.byte_5 = 160;
            }
            if ((struct2.uint_0 & (((int)0x10) >> byte_0)) != 0)
            {
                CloseHandle(ptr);
                throw new Exception($"Drive   {byte_0 + 1}   is   a   ATAPI   device,   we   don't   detect   it");
            }
            struct3.struct1_0.byte_6 = 0xec;
            struct3.byte_0           = byte_0;
            struct3.struct1_0.byte_1 = 1;
            struct3.struct1_0.byte_2 = 1;
            struct3.uint_0           = 0x200;
            if (DeviceIoControl_1(ptr, 0x7c088, ref struct3, (uint)Marshal.SizeOf(struct3), ref struct4, (uint)Marshal.SizeOf(struct4), ref num, IntPtr.Zero) == 0)
            {
                CloseHandle(ptr);
                throw new Exception("DeviceIoControl   failed:   DFP_RECEIVE_DRIVE_DATA");
            }
            CloseHandle(ptr);
            return(smethod_3(struct4.struct5_0));
        }
Example #5
0
        public void NonSerializedNonXmlRpcType()
        {
            Type   parsedType, parsedArrayType;
            string xml = @"<?xml version=""1.0"" ?>
<value>
  <struct>
    <member>
      <name>y</name>
      <value><i4>18</i4></value>
    </member>
  </struct>
</value>";
            object obj = Utils.Parse(xml, typeof(Struct4), MappingAction.Error,
                                     out parsedType, out parsedArrayType);
            Struct4 ret = (Struct4)obj;

            Assert.AreEqual(0, ret.x);
            Assert.AreEqual(18, ret.y);
        }
Example #6
0
    public Struct2 Foo(ref Struct4 r, Struct3 v, short t, ref short tr)
    {
        Struct2 ret = new Struct2();

        String values =
            v.ToString() + " " +
            r.ToString() + " " +
            t.ToString() + " " +
            tr.ToString() + " " +
            ".";

        if (values != "89 161 153 17 160 105 8 -32144 -32144 .")
        {
            Console.WriteLine("Struct2 Foo(...): unexpected values: " + values);
            Fail(12);
        }

        r.Randomize();
        tr += (short)Randomizer();
        ret.Randomize();
        return(ret);
    }
Example #7
0
    public Struct4 Foo(ref Struct8 r, Struct5 v, long t, ref long tr)
    {
        Struct4 ret = new Struct4();

        String values =
            v.ToString() + " " +
            r.ToString() + " " +
            t.ToString() + " " +
            tr.ToString() + " " +
            ".";

        if (values != "146 80 66 32 242 64 201 168 161 144 249 248" +
            " 209 5410867595358339026 5410867595358339026 .")
        {
            Console.WriteLine("Struct4 Foo(...): unexpected values: " + values);
            Fail(14);
        }

        r.Randomize();
        tr += (long)Randomizer();
        ret.Randomize();
        return(ret);
    }
Example #8
0
    public Struct4 Foo(ref Struct8 r, Struct5 v, long t, ref long tr)
    {
        Struct4 ret = new Struct4();

        String values =
            v.ToString() + " " +
            r.ToString() + " " +
            t.ToString() + " " +
            tr.ToString() + " " +
            ".";

        if (values != "218 72 10 152 58 201 168 161 144 249 248" +
            " 209 224 3406623781630010640 3406623781630010640 .")
        {
            Console.WriteLine("Struct4 Foo(...): unexpected values: " + values);
            Fail(14);
        }

        r.Randomize();
        tr += (long)Randomizer();
        ret.Randomize();
        return(ret);
    }
Example #9
0
    public Struct3 Foo(Struct4 v, ref Struct5 r, int t, ref int tr)
    {
        Struct3 ret = new Struct3();

        String values =
            v.ToString() + " " +
            r.ToString() + " " +
            t.ToString() + " " +
            tr.ToString() + " " +
            ".";

        if (values != "201 177 9 113 65 240 153 88 113 -1988419008 " +
            "-1988419008 .")
        {
            Console.WriteLine("Struct3 Foo(...): unexpected values: " + values);
            Fail(13);
        }

        r.Randomize();
        tr += (int)Randomizer();
        ret.Randomize();
        return(ret);
    }
Example #10
0
    static public void RunTests(MainApp This)
    {
        String values;

        Struct1  s1 = new Struct1();
        Struct2  s2 = new Struct2();
        Struct3  s3 = new Struct3();
        Struct4  s4 = new Struct4();
        Struct5  s5 = new Struct5();
        Struct6  s6 = new Struct6();
        Struct8  s8 = new Struct8();
        Valuesa  v  = new Valuesa();
        float    f;
        double   d;
        Object   o;
        String   s;
        Enumacek e;

        sbyte  p1;
        byte   p2;
        short  p3;
        ushort p4;
        int    p5;
        uint   p6;
        long   p7;
        ulong  p8;

        s1.Randomize();
        s2.Randomize();
        s3.Randomize();
        s4.Randomize();
        s5.Randomize();
        s6.Randomize();
        s8.Randomize();
        v.Randomize();

        f = (float)Randomizer();
        d = (float)Randomizer();
        o = This;
        s = Randomizer().ToString();
        e = Enumacek.Hali;

        p1 = (sbyte)Randomizer();
        p2 = (byte)Randomizer();
        p3 = (short)Randomizer();
        p4 = (ushort)Randomizer();
        p5 = (int)Randomizer();
        p6 = (uint)Randomizer();
        p7 = (long)Randomizer();
        p8 = (ulong)Randomizer();

        // set all fields
        This._s1 = s1;
        This._s2 = s2;
        This._s3 = s3;
        This._s4 = s4;
        This._s5 = s5;
        This._s6 = s6;
        This._s8 = s8;
        This._v  = v;
        This._f  = f;
        This._d  = d;
        This._o  = o;
        This._s  = s;
        This._e  = e;
        This._p1 = p1;
        This._p2 = p2;
        This._p3 = p3;
        This._p4 = p4;
        This._p5 = p5;
        This._p6 = p6;
        This._p7 = p7;
        This._p8 = p8;

        values = This.ToString();

        if (values !=
            "9 104 225 80 57 184 17 160 105 8 65 240 153 88 113 931407168" +
            " 201 168 161 144 249 248 209 224 41 20808 639653377 -9016159779942285264" +
            " -7525944817302140071 1480724632 6961 128 -6.583926E+18 2.21297372164627E+18" +
            " MainApp -5893266573950244255 Hali -48 185 -16072 17297 -994209504 2046869481" +
            " 1703311890815005320 1413371402307118785 .")
        {
            Console.WriteLine("SetFields: unexpected values: " + values);
            Fail(101);
        }

        Console.WriteLine("Field setters succeeded");

        // invoke the methods

        p1 = This.Foo(p1);
        p2 = This.Foo(p2);
        p3 = This.Foo(p3);
        p4 = This.Foo(p4);
        p5 = This.Foo(p5);
        p6 = This.Foo(p6);
        p7 = This.Foo(p7);
        p8 = This.Foo(p8);

        // verify the values of all fields
        values =
            p1.ToString() + " " +
            p2.ToString() + " " +
            p3.ToString() + " " +
            p4.ToString() + " " +
            p5.ToString() + " " +
            p6.ToString() + " " +
            p7.ToString() + " " +
            p8.ToString() + " " +
            ".";

        if (values != "-96 114 -32144 34594 -19884190" +
            "08 4093738962 3406623781630010640 2826742804614237570 .")
        {
            Console.WriteLine("Locals after primitive Invoke: unexpected values: " + values);
            Fail(102);
        }

        s1 = This.Foo(s2, ref s3, p1, ref p1);
        s2 = This.Foo(ref s4, s3, p3, ref p3);
        s3 = This.Foo(s4, ref s5, p5, ref p5);
        s4 = This.Foo(ref s8, s5, p7, ref p7);
        s5 = This.Foo(s8, ref v, p2, ref p2);
        s6 = This.Foo(s5, ref v, p2, ref p2);
        s8 = This.Foo(ref f, v, p4, ref p4);
        v  = This.Foo(f, ref d, p6, ref p6);
        f  = This.Foo(ref s1, d, p8, ref p8);
        d  = This.Foo(ref s2, s1, s, ref s);

        // verify the values of all fields
        values =
            This.ToString();

        if (values != "9 104 225 80 57 184 17 160 105 8 65 240 " +
            "153 88 113 931407168 201 168 161 144 249 248 209 224 41 20808 639653377 -9016159" +
            "779942285264 -7525944817302140071 1480724632 6961 128 -6.583926E+18 2.2129737216" +
            "4627E+18 MainApp -5893266573950244255 Hali -48 185 -16072 17297 -994209504 20468" +
            "69481 1703311890815005320 1413371402307118785 .")
        {
            Console.WriteLine("Fields after Invoke: unexpected values: " + values);
            Fail(103);
        }

        // verify the values of all locals
        values =
            s1.ToString() + " " +
            s2.ToString() + " " +
            s3.ToString() + " " +
            s4.ToString() + " " +
            s5.ToString() + " " +
            s6.ToString() + " " +
            s8.ToString() + " " +
            v.ToString() + " " +
            f.ToString() + " " +
            d.ToString() + " " +
            o.GetType().ToString() + " " +
            s.ToString() + " " +
            e.ToString() + " " +
            p1.ToString() + " " +
            p2.ToString() + " " +
            p3.ToString() + " " +
            p4.ToString() + " " +
            p5.ToString() + " " +
            p6.ToString() + " " +
            p7.ToString() + " " +
            p8.ToString() + " " +
            ".";

        if (values != "170 233 145 161 144 249 49 128 137 232 1" +
            "12 25 216 241 192 263746504 217 24 177 0 9 104 225 80 17 7072 -1278944919 567925" +
            "9233286952200 964207834727950401 -272742416 14745 88 -7.848656E+18 3.16790391993" +
            "929E+18 MainApp -5893266573950244255 Hali -16 220 21112 49618 -153164056 1655108" +
            "490 -374121548284004952 17419808404417595330 .")
        {
            Console.WriteLine("Locals after Invoke: unexpected values: " + values);
            Fail(104);
        }

        Console.WriteLine("Method invokes succeeded");

        // get all fields
        s1 = This._s1;
        s2 = This._s2;
        s3 = This._s3;
        s4 = This._s4;
        s5 = This._s5;
        s6 = This._s6;
        s8 = This._s8;
        v  = This._v;
        f  = This._f;
        d  = This._d;
        o  = This._o;
        s  = This._s;
        e  = This._e;
        p1 = This._p1;
        p2 = This._p2;
        p3 = This._p3;
        p4 = This._p4;
        p5 = This._p5;
        p6 = This._p6;
        p7 = This._p7;
        p8 = This._p8;

        // verify the values of all locals
        values =
            s1.ToString() + " " +
            s2.ToString() + " " +
            s3.ToString() + " " +
            s4.ToString() + " " +
            s5.ToString() + " " +
            s6.ToString() + " " +
            s8.ToString() + " " +
            v.ToString() + " " +
            f.ToString() + " " +
            d.ToString() + " " +
            o.GetType().ToString() + " " +
            s.ToString() + " " +
            e.ToString() + " " +
            p1.ToString() + " " +
            p2.ToString() + " " +
            p3.ToString() + " " +
            p4.ToString() + " " +
            p5.ToString() + " " +
            p6.ToString() + " " +
            p7.ToString() + " " +
            p8.ToString() + " " +
            ".";

        if (values != "9 104 225 80 57 184 17 160 105 8 65 240 153 88 113" +
            " 931407168 201 168 161 144 249 248 209 224 41 20808 639653377 -90161597799422852" +
            "64 -7525944817302140071 1480724632 6961 128 -6.583926E+18 2.21297372164627E+18 M" +
            "ainApp -5893266573950244255 Hali -48 185 -16072 17297 -994209504 2046869481 1703" +
            "311890815005320 1413371402307118785 .")
        {
            Console.WriteLine("GetFields: unexpected values: " + values);
            Fail(105);
        }

        Console.WriteLine("Field getters succeeded");

        This.Foo(This, "O", "S",
                 (float)Randomizer(), (double)Randomizer(),
                 (float)Randomizer(), (double)Randomizer(),
                 (float)Randomizer(), (double)Randomizer(),
                 (long)Randomizer(), (long)Randomizer(), (long)Randomizer(), (long)Randomizer(),
                 (long)Randomizer(), (long)Randomizer(),
                 (sbyte)Randomizer(), (byte)Randomizer(), (short)Randomizer(), (ushort)Randomizer(),
                 (int)Randomizer(), (uint)Randomizer(), (long)Randomizer(), (ulong)Randomizer(),
                 (float)Randomizer(), (double)Randomizer(), (float)Randomizer(), (double)Randomizer(),
                 (float)Randomizer(), (double)Randomizer());
    }
Example #11
0
 private static extern int DeviceIoControl_1(IntPtr intptr_0, uint uint_9, ref Struct2 struct2_0, uint uint_10, ref Struct4 struct4_0, uint uint_11, ref uint uint_12, [Out] IntPtr intptr_1);
    public void RunTests() {

        String values;

        Struct1 s1 = new Struct1();
        Struct2 s2 = new Struct2();
        Struct3 s3 = new Struct3();
        Struct4 s4 = new Struct4();
        Struct5 s5 = new Struct5();
        Struct8 s8 = new Struct8();
        Valuesa v = new Valuesa();
        float f;
        double d;
        Object o;
        String s;
        Enumacek e;

        s1.Randomize();
        s2.Randomize();
        s3.Randomize();
        s4.Randomize();
        s5.Randomize();
        s8.Randomize();
        v.Randomize();

        f = (float)Randomizer();
        d = (float)Randomizer();
        o = this;
        s = Randomizer().ToString();
        e = Enumacek.Hali;

        Object s1_ = (Object)s1;
        Object s2_ = (Object)s2;
        Object s3_ = (Object)s3;
        Object s4_ = (Object)s4;
        Object s5_ = (Object)s5;
        Object s8_ = (Object)s8;
        Object v_ = (Object)v;
        Object f_ = (Object)f;
        Object d_ = (Object)d;
        Object o_ = (Object)o;
        Object s_ = (Object)s;
        Object e_ = (Object)e;
        Object p1_ = (sbyte)Randomizer();
        Object p2_ = (byte)Randomizer();
        Object p3_ = (short)Randomizer();
        Object p4_ = (ushort)Randomizer();
        Object p5_ = (int)Randomizer();
        Object p6_ = (uint)Randomizer();
        Object p7_ = (long)Randomizer();
        Object p8_ = (ulong)Randomizer();

        // set all fields
        GetType().InvokeMember("_s1",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
            this, new Object[] { s1_ }, null, null, null);
        GetType().InvokeMember("_s2",
            BindingFlags.Static | BindingFlags.Public | BindingFlags.SetField, null,
            this, new Object[] { s2_ }, null, null, null);
        GetType().InvokeMember("_s3",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
            this, new Object[] { s3_ }, null, null, null);
        GetType().InvokeMember("_s4",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
            this, new Object[] { s4_ }, null, null, null);
        GetType().InvokeMember("_s5",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
            this, new Object[] { s5_ }, null, null, null);
        GetType().InvokeMember("_s8",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
            this, new Object[] { s8_ }, null, null, null);
        GetType().InvokeMember("_v",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
            this, new Object[] { v_ }, null, null, null);
        GetType().InvokeMember("_f",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
            this, new Object[] { f_ }, null, null, null);
        GetType().InvokeMember("_d",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
            this, new Object[] { d_ }, null, null, null);
        GetType().InvokeMember("_o",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
            this, new Object[] { o_ }, null, null, null);
        GetType().InvokeMember("_s",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
            this, new Object[] { s_ }, null, null, null);
        GetType().InvokeMember("_e",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
            this, new Object[] { e_ }, null, null, null);
        GetType().InvokeMember("_p1",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
            this, new Object[] { p1_ }, null, null, null);
        GetType().InvokeMember("_p2",
            BindingFlags.Static | BindingFlags.Public | BindingFlags.SetField, null,
            this, new Object[] { p2_ }, null, null, null);
        GetType().InvokeMember("_p3",
            BindingFlags.Static | BindingFlags.Public | BindingFlags.SetField, null,
            this, new Object[] { p3_ }, null, null, null);
        GetType().InvokeMember("_p4",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
            this, new Object[] { p4_ }, null, null, null);
        GetType().InvokeMember("_p5",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
            this, new Object[] { p5_ }, null, null, null);
        GetType().InvokeMember("_p6",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
            this, new Object[] { p6_ }, null, null, null);
        GetType().InvokeMember("_p7",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
            this, new Object[] { p7_ }, null, null, null);
        GetType().InvokeMember("_p8",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
            this, new Object[] { p8_ }, null, null, null);

        // verify the values of all fields
        values =
            _s1.ToString() + " " +
            _s2.ToString() + " " +
            _s3.ToString() + " " +
            _s4.ToString() + " " +
            _s5.ToString() + " " +
            _s8.ToString() + " " +
            _v.ToString() + " " +
            _f.ToString() + " " +
            _d.ToString() + " " +
            _o.ToString() + " " +
            _s.ToString() + " " +
            _e.ToString() + " " +
            _p1.ToString() + " " +
            _p2.ToString() + " " +
            _p3.ToString() + " " +
            _p4.ToString() + " " +
            _p5.ToString() + " " +
            _p6.ToString() + " " +
            _p7.ToString() + " " +
            _p8.ToString() + " " +
            ".";

        if (values != "9 104 225 80 57 184 17 160 105 8 65 240 153 88 113 64" +
            " 201 168 161 144 249 248 209 224 -23767 606228808 2874968872843236865 -901615977" +
            "9942285264 360942425 4248 49 -5.193024E+18 -6.58392565490175E+18 MainApp 2212973" +
            "731230676456 Hali 97 208 -9799 49464 1739539345 3300757792 -6517938239175606295 " +
            "1703311890815005320 .")
        {
            Console.WriteLine("SetFields: unexpected values: " + values);
            Fail(101);
        }

        Console.WriteLine("Field setters succeeded");

        // invoke the methods

        p1_ = GetType().InvokeMember("Foo",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
            this, new Object[] { p1_ }, null, null, null);
        p2_ = GetType().InvokeMember("Foo",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
            this, new Object[] { p2_ }, null, null, null);
        p3_ = GetType().InvokeMember("Foo",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
            this, new Object[] { p3_ }, null, null, null);
        p4_ = GetType().InvokeMember("Foo",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
            this, new Object[] { p4_ }, null, null, null);
        p5_ = GetType().InvokeMember("Foo",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
            this, new Object[] { p5_ }, null, null, null);
        p6_ = GetType().InvokeMember("Foo",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
            this, new Object[] { p6_ }, null, null, null);
        p7_ = GetType().InvokeMember("Foo",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
            this, new Object[] { p7_ }, null, null, null);
        p8_ = GetType().InvokeMember("Foo",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
            this, new Object[] { p8_ }, null, null, null);

        // verify the values of all fields
        values =
            p1_.ToString() + " " +
            p2_.ToString() + " " +
            p3_.ToString() + " " +
            p4_.ToString() + " " +
            p5_.ToString() + " " +
            p6_.ToString() + " " +
            p7_.ToString() + " " +
            p8_.ToString() + " " +
            ".";

        if (values != "-62 160 -19598 33392 -81588860" +
            "6 2306548288 5410867595358339026 3406623781630010640 .")
        {
            Console.WriteLine("Locals after primitive Invoke: unexpected values: " + values);
            Fail(102);
        }

        Object[] args;
        args = new Object[] { s2_, s3_, p1_, p1_ };
        s1_ = GetType().InvokeMember("Foo",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
            this, args, null, null, null);
        s3_ = args[1]; p1_ = args[3]; 

        args = new Object[] { s4_, s3_, p3_, p3_ };
        s2_ = GetType().InvokeMember("Foo",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
            this, args, null, null, null);
        s4_ = args[0]; p3_ = args[3]; 

        args = new Object[] { s4_, s5_, p5_, p5_ };
        s3_ = GetType().InvokeMember("Foo",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
            this, args, null, null, null);
        s5_ = args[1]; p5_ = args[3]; 

        args = new Object[] { s8_, s5_, p7_, p7_ };
        s4_ = GetType().InvokeMember("Foo",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
            this, args, null, null, null);
        s8_ = args[0]; p7_ = args[3]; 

        args = new Object[] { s8_, v_, p2_, p2_ };
        s5_ = GetType().InvokeMember("Foo",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
            this, args, null, null, null);
        v_ = args[1]; p2_ = args[3]; 

        args = new Object[] { f_, v_, p4_, p4_ };
        s8_ = GetType().InvokeMember("Foo",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
            this, args, null, null, null);
        f_ = args[0]; p4_ = args[3]; 

        args = new Object[] { f_, d_, p6_, p6_ };
        v_ = GetType().InvokeMember("Foo",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
            this, args, null, null, null);
        d_ = args[1]; p6_ = args[3]; 

        args = new Object[] { s1_, d_, p8_, p8_ };
        f_ = GetType().InvokeMember("Foo",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
            this, args, null, null, null);
        s1_ = args[0]; p8_ = args[3]; 

        args = new Object[] { s2_, s1_, s_, s_ };
        d_ = GetType().InvokeMember("Foo",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
            this, args, null, null, null);
        s2_ = args[0]; 

        // verify the values of all fields
        values =
            _s1.ToString() + " " +
            _s2.ToString() + " " +
            _s3.ToString() + " " +
            _s4.ToString() + " " +
            _s5.ToString() + " " +
            _s8.ToString() + " " +
            _v.ToString() + " " +
            _f.ToString() + " " +
            _d.ToString() + " " +
            _o.ToString() + " " +
            _s.ToString() + " " +
            _e.ToString() + " " +
            _p1.ToString() + " " +
            _p2.ToString() + " " +
            _p3.ToString() + " " +
            _p4.ToString() + " " +
            _p5.ToString() + " " +
            _p6.ToString() + " " +
            _p7.ToString() + " " +
            _p8.ToString() + " " +
            ".";

        if (values != "9 104 225 80 57 184 17 160 105 8 65 240 " +
            "153 88 113 64 201 168 161 144 249 248 209 224 -23767 606228808 28749688728432368" +
            "65 -9016159779942285264 360942425 4248 49 -5.193024E+18 -6.58392565490175E+18 Ma" +
            "inApp 2212973731230676456 Hali 97 208 -9799 49464 1739539345 3300757792 -6517938" +
            "239175606295 1703311890815005320 .")
        {
            Console.WriteLine("Fields after Invoke: unexpected values: " + values);
            Fail(103);
        }

        // verify the values of all locals
        values =
            s1_.ToString() + " " +
            s2_.ToString() + " " +
            s3_.ToString() + " " +
            s4_.ToString() + " " +
            s5_.ToString() + " " +
            s8_.ToString() + " " +
            v_.ToString() + " " +
            f_.ToString() + " " +
            d_.ToString() + " " +
            o_.ToString() + " " +
            s_.ToString() + " " +
            e_.ToString() + " " +
            p1_.ToString() + " " +
            p2_.ToString() + " " +
            p3_.ToString() + " " +
            p4_.ToString() + " " +
            p5_.ToString() + " " +
            p6_.ToString() + " " +
            p7_.ToString() + " " +
            p8_.ToString() + " " +
            ".";

        if (values != "226 161 153 217 24 177 105 8 65 240 248 " +
            "209 224 41 72 89 152 49 128 137 232 97 208 145 9760 68383465 -100628058569588952" +
            "8 -1283321389773510207 -27688336 8985 216 -7.769602E+18 -3.84749538525879E+18 Ma" +
            "inApp 2212973731230676456 Hali -102 153 -29822 14240 1493680594 2427897976 59408" +
            "3122152577906 15205575963204995536 .")
        {
            Console.WriteLine("Locals after Invoke: unexpected values: " + values);
            Fail(104);
        }

        Console.WriteLine("Method invokes succeeded");

        // get all fields
        s1_ = GetType().InvokeMember("_s1",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
            this, null, null, null, null);
        s2_ = GetType().InvokeMember("_s2",
            BindingFlags.Static | BindingFlags.Public | BindingFlags.GetField, null,
            this, null, null, null, null);
        s3_ = GetType().InvokeMember("_s3",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
            this, null, null, null, null);
        s4_ = GetType().InvokeMember("_s4",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
            this, null, null, null, null);
        s5_ = GetType().InvokeMember("_s5",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
            this, null, null, null, null);
        s8_ = GetType().InvokeMember("_s8",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
            this, null, null, null, null);
        v_ = GetType().InvokeMember("_v",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
            this, null, null, null, null);
        f_ = GetType().InvokeMember("_f",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
            this, null, null, null, null);
        d_ = GetType().InvokeMember("_d",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
            this, null, null, null, null);
        o_ = GetType().InvokeMember("_o",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
            this, null, null, null, null);
        s_ = GetType().InvokeMember("_s",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
            this, null, null, null, null);
        e_ = GetType().InvokeMember("_e",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
            this, null, null, null, null);
        p1_ = GetType().InvokeMember("_p1",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
            this, null, null, null, null);
        p2_ = GetType().InvokeMember("_p2",
            BindingFlags.Static | BindingFlags.Public | BindingFlags.GetField, null,
            this, null, null, null, null);
        p3_ = GetType().InvokeMember("_p3",
            BindingFlags.Static | BindingFlags.Public | BindingFlags.GetField, null,
            this, null, null, null, null);
        p4_ = GetType().InvokeMember("_p4",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
            this, null, null, null, null);
        p5_ = GetType().InvokeMember("_p5",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
            this, null, null, null, null);
        p6_ = GetType().InvokeMember("_p6",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
            this, null, null, null, null);
        p7_ = GetType().InvokeMember("_p7",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
            this, null, null, null, null);
        p8_ = GetType().InvokeMember("_p8",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
            this, null, null, null, null);

        // verify the values of all locals
        values =
            s1_.ToString() + " " +
            s2_.ToString() + " " +
            s3_.ToString() + " " +
            s4_.ToString() + " " +
            s5_.ToString() + " " +
            s8_.ToString() + " " +
            v_.ToString() + " " +
            f_.ToString() + " " +
            d_.ToString() + " " +
            o_.ToString() + " " +
            s_.ToString() + " " +
            e_.ToString() + " " +
            p1_.ToString() + " " +
            p2_.ToString() + " " +
            p3_.ToString() + " " +
            p4_.ToString() + " " +
            p5_.ToString() + " " +
            p6_.ToString() + " " +
            p7_.ToString() + " " +
            p8_.ToString() + " " +
            ".";

        if (values != "9 104 225 80 57 184 17 160 105 8 65 240 153 88 113" +
            " 64 201 168 161 144 249 248 209 224 -23767 606228808 2874968872843236865 -901615" +
            "9779942285264 360942425 4248 49 -5.193024E+18 -6.58392565490175E+18 MainApp 2212" +
            "973731230676456 Hali 97 208 -9799 49464 1739539345 3300757792 -65179382391756062" +
            "95 1703311890815005320 .")
        {
            Console.WriteLine("GetFields: unexpected values: " + values);
            Fail(105);
        }

        Console.WriteLine("Field getters succeeded");

        // invoke the method with complex signature
        GetType().InvokeMember("Foo",
            BindingFlags.Static | BindingFlags.Public | BindingFlags.InvokeMethod, null,
            null, new Object[] {
                this, "O", "S",
                (float)Randomizer(), (double)Randomizer(), (float)Randomizer(),
                (double)Randomizer(), (float)Randomizer(), (double)Randomizer(),
                (long)Randomizer(), (long)Randomizer(), (long)Randomizer(),
                (long)Randomizer(), (long)Randomizer(), (long)Randomizer(),
                (sbyte)Randomizer(), (byte)Randomizer(), (short)Randomizer(),
                (ushort)Randomizer(), (int)Randomizer(), (uint)Randomizer(),
                (long)Randomizer(), (ulong)Randomizer(),
                (float)Randomizer(), (double)Randomizer(), (float)Randomizer(),
                (double)Randomizer(), (float)Randomizer(), (double)Randomizer()
            }, null, null, null);

        Console.WriteLine("Complex invoke succeeded");

        // invoke the constructor with complex signature
        GetType().InvokeMember("Foo",
            BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance, null,
            null, new Object[] {
                this,
                s1_, s2_, s3_, s4_, s5_, s8_, v_, f_, d_, o_, s_, e_,
            }, null, null, null);
        Console.WriteLine("Constructor invoke succeeded");
    }
    public MainApp(MainApp a,
        Struct1 s1, Struct2 s2, Struct3 s3, Struct4 s4, Struct5 s5, Struct8 s8,
        Valuesa v, float f, double d, Object o, String s, Enumacek e) {

        String values =
            a.ToString() + " " +
            s1.ToString() + " " +
            s2.ToString() + " " +
            s3.ToString() + " " +
            s4.ToString() + " " +
            s5.ToString() + " " +
            s8.ToString() + " " +
            v.ToString() + " " +
            f.ToString() + " " +
            d.ToString() + " " +
            o.ToString() + " " +
            s.ToString() + " " +
            e.ToString() + " " +
            ".";

        if (values != "MainApp 9 104 225 80 57 184 17 160 105 8 65 240" +
            " 153 88 113 64 201 168 161 144 249 248 209 224 -23767 606228808 2874968872843236" +
            "865 -9016159779942285264 360942425 4248 49 -5.193024E+18 -6.58392565490175E+18 M" +
            "ainApp 2212973731230676456 Hali .")
        {
            Console.WriteLine("MainApp(...): unexpected values: " + values);
            Fail(22);
        }
    }
    public Struct4 Foo(ref Struct8 r, Struct5 v, long t, ref long tr) {
        Struct4 ret = new Struct4();

        String values =
            v.ToString() + " " +
            r.ToString() + " " +
            t.ToString() + " " +
            tr.ToString() + " " +
            ".";

        if (values != "146 80 66 32 242 64 201 168 161 144 249 248" +
            " 209 5410867595358339026 5410867595358339026 .")
        {
            Console.WriteLine("Struct4 Foo(...): unexpected values: " + values);
            Fail(14);
        }

        r.Randomize();
        tr += (long)Randomizer();
        ret.Randomize();
        return ret;
    }
    public Struct3 Foo(Struct4 v, ref Struct5 r, int t, ref int tr) {
        Struct3 ret = new Struct3();

        String values =
            v.ToString() + " " +
            r.ToString() + " " +
            t.ToString() + " " +
            tr.ToString() + " " +
            ".";

        if (values != "209 233 145 41 65 240 153 88 113 -815888606" +
            " -815888606 .")
        {
            Console.WriteLine("Struct3 Foo(...): unexpected values: " + values);
            Fail(13);
        }

        r.Randomize();
        tr += (int)Randomizer();
        ret.Randomize();
        return ret;
    }
    public Struct2 Foo(ref Struct4 r, Struct3 v, short t, ref short tr) {
        Struct2 ret = new Struct2();

        String values =
            v.ToString() + " " +
            r.ToString() + " " +
            t.ToString() + " " +
            tr.ToString() + " " +
            ".";

        if (values != "17 169 209 17 160 105 8 -19598 -19598 .")
        {
            Console.WriteLine("Struct2 Foo(...): unexpected values: " + values);
            Fail(12);
        }

        r.Randomize();
        tr += (short)Randomizer();
        ret.Randomize();
        return ret;
    }
 static extern Struct4 StructTest4(Struct4 s, ref Struct4 _s);
Example #18
0
 static extern Struct4 StructTest4(Struct4 s, ref Struct4 _s);
    static public void RunTests(MainApp This) {

        String values;

        Struct1 s1 = new Struct1();
        Struct2 s2 = new Struct2();
        Struct3 s3 = new Struct3();
        Struct4 s4 = new Struct4();
        Struct5 s5 = new Struct5();
        Struct6 s6 = new Struct6();
        Struct8 s8 = new Struct8();
        Valuesa v = new Valuesa();
        float f;
        double d;
        Object o;
        String s;
        Enumacek e;

        sbyte p1;
        byte p2;
        short p3;
        ushort p4;
        int p5;
        uint p6;
        long p7;
        ulong p8;

        s1.Randomize();
        s2.Randomize();
        s3.Randomize();
        s4.Randomize();
        s5.Randomize();
        s6.Randomize();
        s8.Randomize();
        v.Randomize();

        f = (float)Randomizer();
        d = (float)Randomizer();
        o = This;
        s = Randomizer().ToString();
        e = Enumacek.Hali;

        p1 = (sbyte)Randomizer();
        p2 = (byte)Randomizer();
        p3 = (short)Randomizer();
        p4 = (ushort)Randomizer();
        p5 = (int)Randomizer();
        p6 = (uint)Randomizer();
        p7 = (long)Randomizer();
        p8 = (ulong)Randomizer();

        // set all fields
        This._s1 = s1;
        This._s2 = s2;
        This._s3 = s3;
        This._s4 = s4;
        This._s5 = s5;
        This._s6 = s6;
        This._s8 = s8;
        This._v = v;
        This._f = f;
        This._d = d;
        This._o = o;
        This._s = s;
        This._e = e;
        This._p1 = p1;
        This._p2 = p2;
        This._p3 = p3;
        This._p4 = p4;
        This._p5 = p5;
        This._p6 = p6;
        This._p7 = p7;
        This._p8 = p8;

        values = This.ToString();

        if (values != 
            "9 104 225 80 57 184 17 160 105 8 65 240 153 88 113 931407168" +
            " 201 168 161 144 249 248 209 224 41 20808 639653377 -9016159779942285264" +
            " -7525944817302140071 1480724632 6961 128 -6.583926E+18 2.21297372164627E+18" +
            " MainApp -5893266573950244255 Hali -48 185 -16072 17297 -994209504 2046869481" +
            " 1703311890815005320 1413371402307118785 .")
        {
            Console.WriteLine("SetFields: unexpected values: " + values);
            Fail(101);
        }

        Console.WriteLine("Field setters succeeded");

        // invoke the methods

        p1 = This.Foo(p1);
        p2 = This.Foo(p2);
        p3 = This.Foo(p3);
        p4 = This.Foo(p4);
        p5 = This.Foo(p5);
        p6 = This.Foo(p6);
        p7 = This.Foo(p7);
        p8 = This.Foo(p8);

        // verify the values of all fields
        values =
            p1.ToString() + " " +
            p2.ToString() + " " +
            p3.ToString() + " " +
            p4.ToString() + " " +
            p5.ToString() + " " +
            p6.ToString() + " " +
            p7.ToString() + " " +
            p8.ToString() + " " +
            ".";

        if (values != "-96 114 -32144 34594 -19884190" +
            "08 4093738962 3406623781630010640 2826742804614237570 .")
        {
            Console.WriteLine("Locals after primitive Invoke: unexpected values: " + values);
            Fail(102);
        }

        s1 = This.Foo(s2, ref s3, p1, ref p1);
        s2 = This.Foo(ref s4, s3, p3, ref p3);
        s3 = This.Foo(s4, ref s5, p5, ref p5);
        s4 = This.Foo(ref s8, s5, p7, ref p7);
        s5 = This.Foo(s8, ref v, p2, ref p2);
        s6 = This.Foo(s5, ref v, p2, ref p2);
        s8 = This.Foo(ref f, v, p4, ref p4);
        v = This.Foo(f, ref d, p6, ref p6);
        f = This.Foo(ref s1, d, p8, ref p8);
        d = This.Foo(ref s2, s1, s, ref s);

        // verify the values of all fields
        values =
            This.ToString();

        if (values != "9 104 225 80 57 184 17 160 105 8 65 240 " +
            "153 88 113 931407168 201 168 161 144 249 248 209 224 41 20808 639653377 -9016159" +
            "779942285264 -7525944817302140071 1480724632 6961 128 -6.583926E+18 2.2129737216" +
            "4627E+18 MainApp -5893266573950244255 Hali -48 185 -16072 17297 -994209504 20468" +
            "69481 1703311890815005320 1413371402307118785 .")
        {
            Console.WriteLine("Fields after Invoke: unexpected values: " + values);
            Fail(103);
        }

        // verify the values of all locals
        values =
            s1.ToString() + " " +
            s2.ToString() + " " +
            s3.ToString() + " " +
            s4.ToString() + " " +
            s5.ToString() + " " +
            s6.ToString() + " " +
            s8.ToString() + " " +
            v.ToString() + " " +
            f.ToString() + " " +
            d.ToString() + " " +
            o.GetType().ToString() + " " +
            s.ToString() + " " +
            e.ToString() + " " +
            p1.ToString() + " " +
            p2.ToString() + " " +
            p3.ToString() + " " +
            p4.ToString() + " " +
            p5.ToString() + " " +
            p6.ToString() + " " +
            p7.ToString() + " " +
            p8.ToString() + " " +
            ".";

        if (values != "170 233 145 161 144 249 49 128 137 232 1" +
            "12 25 216 241 192 263746504 217 24 177 0 9 104 225 80 17 7072 -1278944919 567925" +
            "9233286952200 964207834727950401 -272742416 14745 88 -7.848656E+18 3.16790391993" +
            "929E+18 MainApp -5893266573950244255 Hali -16 220 21112 49618 -153164056 1655108" +
            "490 -374121548284004952 17419808404417595330 .")
        {
            Console.WriteLine("Locals after Invoke: unexpected values: " + values);
            Fail(104);
        }

        Console.WriteLine("Method invokes succeeded");

        // get all fields
        s1 = This._s1;
        s2 = This._s2;
        s3 = This._s3;
        s4 = This._s4;
        s5 = This._s5;
        s6 = This._s6;
        s8 = This._s8;
        v = This._v;
        f = This._f;
        d = This._d;
        o = This._o;
        s = This._s;
        e = This._e;
        p1 = This._p1;
        p2 = This._p2;
        p3 = This._p3;
        p4 = This._p4;
        p5 = This._p5;
        p6 = This._p6;
        p7 = This._p7;
        p8 = This._p8;

        // verify the values of all locals
        values =
            s1.ToString() + " " +
            s2.ToString() + " " +
            s3.ToString() + " " +
            s4.ToString() + " " +
            s5.ToString() + " " +
            s6.ToString() + " " +
            s8.ToString() + " " +
            v.ToString() + " " +
            f.ToString() + " " +
            d.ToString() + " " +
            o.GetType().ToString() + " " +
            s.ToString() + " " +
            e.ToString() + " " +
            p1.ToString() + " " +
            p2.ToString() + " " +
            p3.ToString() + " " +
            p4.ToString() + " " +
            p5.ToString() + " " +
            p6.ToString() + " " +
            p7.ToString() + " " +
            p8.ToString() + " " +
            ".";

        if (values != "9 104 225 80 57 184 17 160 105 8 65 240 153 88 113" +
            " 931407168 201 168 161 144 249 248 209 224 41 20808 639653377 -90161597799422852" +
            "64 -7525944817302140071 1480724632 6961 128 -6.583926E+18 2.21297372164627E+18 M" +
            "ainApp -5893266573950244255 Hali -48 185 -16072 17297 -994209504 2046869481 1703" +
            "311890815005320 1413371402307118785 .")
        {
            Console.WriteLine("GetFields: unexpected values: " + values);
            Fail(105);
        }

        Console.WriteLine("Field getters succeeded");

        This.Foo(This, "O", "S",
            (float)Randomizer(), (double)Randomizer(), 
            (float)Randomizer(), (double)Randomizer(), 
            (float)Randomizer(), (double)Randomizer(),
            (long)Randomizer(), (long)Randomizer(), (long)Randomizer(), (long)Randomizer(),
            (long)Randomizer(), (long)Randomizer(),
            (sbyte)Randomizer(), (byte)Randomizer(), (short)Randomizer(), (ushort)Randomizer(),
            (int)Randomizer(), (uint)Randomizer(), (long)Randomizer(), (ulong)Randomizer(),
            (float)Randomizer(), (double)Randomizer(),  (float)Randomizer(), (double)Randomizer(), 
            (float)Randomizer(), (double)Randomizer());
    }
Example #20
0
	static int pass_struct4 (Struct4 s) {
		if (s.i + s.j + s.k + s.l + s.m != 15)
			return 1;
		else
			return 0;
	}
Example #21
0
    public void RunTests()
    {
        String values;

        Struct1  s1 = new Struct1();
        Struct2  s2 = new Struct2();
        Struct3  s3 = new Struct3();
        Struct4  s4 = new Struct4();
        Struct5  s5 = new Struct5();
        Struct8  s8 = new Struct8();
        Valuesa  v  = new Valuesa();
        float    f;
        double   d;
        Object   o;
        String   s;
        Enumacek e;

        s1.Randomize();
        s2.Randomize();
        s3.Randomize();
        s4.Randomize();
        s5.Randomize();
        s8.Randomize();
        v.Randomize();

        f = (float)Randomizer();
        d = (float)Randomizer();
        o = this;
        s = Randomizer().ToString();
        e = Enumacek.Hali;

        Object s1_ = (Object)s1;
        Object s2_ = (Object)s2;
        Object s3_ = (Object)s3;
        Object s4_ = (Object)s4;
        Object s5_ = (Object)s5;
        Object s8_ = (Object)s8;
        Object v_  = (Object)v;
        Object f_  = (Object)f;
        Object d_  = (Object)d;
        Object o_  = (Object)o;
        Object s_  = (Object)s;
        Object e_  = (Object)e;
        Object p1_ = (sbyte)Randomizer();
        Object p2_ = (byte)Randomizer();
        Object p3_ = (short)Randomizer();
        Object p4_ = (ushort)Randomizer();
        Object p5_ = (int)Randomizer();
        Object p6_ = (uint)Randomizer();
        Object p7_ = (long)Randomizer();
        Object p8_ = (ulong)Randomizer();

        // set all fields
        GetType().InvokeMember("_s1",
                               BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
                               this, new Object[] { s1_ }, null, null, null);
        GetType().InvokeMember("_s2",
                               BindingFlags.Static | BindingFlags.Public | BindingFlags.SetField, null,
                               this, new Object[] { s2_ }, null, null, null);
        GetType().InvokeMember("_s3",
                               BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
                               this, new Object[] { s3_ }, null, null, null);
        GetType().InvokeMember("_s4",
                               BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
                               this, new Object[] { s4_ }, null, null, null);
        GetType().InvokeMember("_s5",
                               BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
                               this, new Object[] { s5_ }, null, null, null);
        GetType().InvokeMember("_s8",
                               BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
                               this, new Object[] { s8_ }, null, null, null);
        GetType().InvokeMember("_v",
                               BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
                               this, new Object[] { v_ }, null, null, null);
        GetType().InvokeMember("_f",
                               BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
                               this, new Object[] { f_ }, null, null, null);
        GetType().InvokeMember("_d",
                               BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
                               this, new Object[] { d_ }, null, null, null);
        GetType().InvokeMember("_o",
                               BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
                               this, new Object[] { o_ }, null, null, null);
        GetType().InvokeMember("_s",
                               BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
                               this, new Object[] { s_ }, null, null, null);
        GetType().InvokeMember("_e",
                               BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
                               this, new Object[] { e_ }, null, null, null);
        GetType().InvokeMember("_p1",
                               BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
                               this, new Object[] { p1_ }, null, null, null);
        GetType().InvokeMember("_p2",
                               BindingFlags.Static | BindingFlags.Public | BindingFlags.SetField, null,
                               this, new Object[] { p2_ }, null, null, null);
        GetType().InvokeMember("_p3",
                               BindingFlags.Static | BindingFlags.Public | BindingFlags.SetField, null,
                               this, new Object[] { p3_ }, null, null, null);
        GetType().InvokeMember("_p4",
                               BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
                               this, new Object[] { p4_ }, null, null, null);
        GetType().InvokeMember("_p5",
                               BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
                               this, new Object[] { p5_ }, null, null, null);
        GetType().InvokeMember("_p6",
                               BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
                               this, new Object[] { p6_ }, null, null, null);
        GetType().InvokeMember("_p7",
                               BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
                               this, new Object[] { p7_ }, null, null, null);
        GetType().InvokeMember("_p8",
                               BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetField, null,
                               this, new Object[] { p8_ }, null, null, null);

        // verify the values of all fields
        values =
            _s1.ToString() + " " +
            _s2.ToString() + " " +
            _s3.ToString() + " " +
            _s4.ToString() + " " +
            _s5.ToString() + " " +
            _s8.ToString() + " " +
            _v.ToString() + " " +
            _f.ToString() + " " +
            _d.ToString() + " " +
            _o.ToString() + " " +
            _s.ToString() + " " +
            _e.ToString() + " " +
            _p1.ToString() + " " +
            _p2.ToString() + " " +
            _p3.ToString() + " " +
            _p4.ToString() + " " +
            _p5.ToString() + " " +
            _p6.ToString() + " " +
            _p7.ToString() + " " +
            _p8.ToString() + " " +
            ".";

        if (values != "9 104 225 80 57 184 17 160 105 8 65 240 153 88 113 64" +
            " 201 168 161 144 249 248 209 224 -23767 606228808 2874968872843236865 -901615977" +
            "9942285264 360942425 4248 49 -5.193024E+18 -6.58392565490175E+18 MainApp 2212973" +
            "731230676456 Hali 97 208 -9799 49464 1739539345 3300757792 -6517938239175606295 " +
            "1703311890815005320 .")
        {
            Console.WriteLine("SetFields: unexpected values: " + values);
            Fail(101);
        }

        Console.WriteLine("Field setters succeeded");

        // invoke the methods

        p1_ = GetType().InvokeMember("Foo",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
                                     this, new Object[] { p1_ }, null, null, null);
        p2_ = GetType().InvokeMember("Foo",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
                                     this, new Object[] { p2_ }, null, null, null);
        p3_ = GetType().InvokeMember("Foo",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
                                     this, new Object[] { p3_ }, null, null, null);
        p4_ = GetType().InvokeMember("Foo",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
                                     this, new Object[] { p4_ }, null, null, null);
        p5_ = GetType().InvokeMember("Foo",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
                                     this, new Object[] { p5_ }, null, null, null);
        p6_ = GetType().InvokeMember("Foo",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
                                     this, new Object[] { p6_ }, null, null, null);
        p7_ = GetType().InvokeMember("Foo",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
                                     this, new Object[] { p7_ }, null, null, null);
        p8_ = GetType().InvokeMember("Foo",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
                                     this, new Object[] { p8_ }, null, null, null);

        // verify the values of all fields
        values =
            p1_.ToString() + " " +
            p2_.ToString() + " " +
            p3_.ToString() + " " +
            p4_.ToString() + " " +
            p5_.ToString() + " " +
            p6_.ToString() + " " +
            p7_.ToString() + " " +
            p8_.ToString() + " " +
            ".";

        if (values != "-62 160 -19598 33392 -81588860" +
            "6 2306548288 5410867595358339026 3406623781630010640 .")
        {
            Console.WriteLine("Locals after primitive Invoke: unexpected values: " + values);
            Fail(102);
        }

        s1_ = GetType().InvokeMember("Foo",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
                                     this, new Object[] { s2_, s3_, p1_, p1_ }, null, null, null);
        s2_ = GetType().InvokeMember("Foo",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
                                     this, new Object[] { s4_, s3_, p3_, p3_ }, null, null, null);
        s3_ = GetType().InvokeMember("Foo",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
                                     this, new Object[] { s4_, s5_, p5_, p5_ }, null, null, null);
        s4_ = GetType().InvokeMember("Foo",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
                                     this, new Object[] { s8_, s5_, p7_, p7_ }, null, null, null);
        s5_ = GetType().InvokeMember("Foo",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
                                     this, new Object[] { s8_, v_, p2_, p2_ }, null, null, null);
        s8_ = GetType().InvokeMember("Foo",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
                                     this, new Object[] { f_, v_, p4_, p4_ }, null, null, null);
        v_ = GetType().InvokeMember("Foo",
                                    BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
                                    this, new Object[] { f_, d_, p6_, p6_ }, null, null, null);
        f_ = GetType().InvokeMember("Foo",
                                    BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
                                    this, new Object[] { s1_, d_, p8_, p8_ }, null, null, null);
        d_ = GetType().InvokeMember("Foo",
                                    BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null,
                                    this, new Object[] { s2_, s1_, s_, s_ }, null, null, null);

        // verify the values of all fields
        values =
            _s1.ToString() + " " +
            _s2.ToString() + " " +
            _s3.ToString() + " " +
            _s4.ToString() + " " +
            _s5.ToString() + " " +
            _s8.ToString() + " " +
            _v.ToString() + " " +
            _f.ToString() + " " +
            _d.ToString() + " " +
            _o.ToString() + " " +
            _s.ToString() + " " +
            _e.ToString() + " " +
            _p1.ToString() + " " +
            _p2.ToString() + " " +
            _p3.ToString() + " " +
            _p4.ToString() + " " +
            _p5.ToString() + " " +
            _p6.ToString() + " " +
            _p7.ToString() + " " +
            _p8.ToString() + " " +
            ".";

        if (values != "9 104 225 80 57 184 17 160 105 8 65 240 " +
            "153 88 113 64 201 168 161 144 249 248 209 224 -23767 606228808 28749688728432368" +
            "65 -9016159779942285264 360942425 4248 49 -5.193024E+18 -6.58392565490175E+18 Ma" +
            "inApp 2212973731230676456 Hali 97 208 -9799 49464 1739539345 3300757792 -6517938" +
            "239175606295 1703311890815005320 .")
        {
            Console.WriteLine("Fields after Invoke: unexpected values: " + values);
            Fail(103);
        }

        // verify the values of all locals
        values =
            s1_.ToString() + " " +
            s2_.ToString() + " " +
            s3_.ToString() + " " +
            s4_.ToString() + " " +
            s5_.ToString() + " " +
            s8_.ToString() + " " +
            v_.ToString() + " " +
            f_.ToString() + " " +
            d_.ToString() + " " +
            o_.ToString() + " " +
            s_.ToString() + " " +
            e_.ToString() + " " +
            p1_.ToString() + " " +
            p2_.ToString() + " " +
            p3_.ToString() + " " +
            p4_.ToString() + " " +
            p5_.ToString() + " " +
            p6_.ToString() + " " +
            p7_.ToString() + " " +
            p8_.ToString() + " " +
            ".";

        if (values != "226 161 153 217 24 177 105 8 65 240 248 " +
            "209 224 41 72 89 152 49 128 137 232 97 208 145 9760 68383465 -100628058569588952" +
            "8 -1283321389773510207 -27688336 8985 216 -7.769602E+18 -3.84749538525879E+18 Ma" +
            "inApp 2212973731230676456 Hali -102 153 -29822 14240 1493680594 2427897976 59408" +
            "3122152577906 15205575963204995536 .")
        {
            Console.WriteLine("Locals after Invoke: unexpected values: " + values);
            Fail(104);
        }

        Console.WriteLine("Method invokes succeeded");

        // get all fields
        s1_ = GetType().InvokeMember("_s1",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
                                     this, null, null, null, null);
        s2_ = GetType().InvokeMember("_s2",
                                     BindingFlags.Static | BindingFlags.Public | BindingFlags.GetField, null,
                                     this, null, null, null, null);
        s3_ = GetType().InvokeMember("_s3",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
                                     this, null, null, null, null);
        s4_ = GetType().InvokeMember("_s4",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
                                     this, null, null, null, null);
        s5_ = GetType().InvokeMember("_s5",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
                                     this, null, null, null, null);
        s8_ = GetType().InvokeMember("_s8",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
                                     this, null, null, null, null);
        v_ = GetType().InvokeMember("_v",
                                    BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
                                    this, null, null, null, null);
        f_ = GetType().InvokeMember("_f",
                                    BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
                                    this, null, null, null, null);
        d_ = GetType().InvokeMember("_d",
                                    BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
                                    this, null, null, null, null);
        o_ = GetType().InvokeMember("_o",
                                    BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
                                    this, null, null, null, null);
        s_ = GetType().InvokeMember("_s",
                                    BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
                                    this, null, null, null, null);
        e_ = GetType().InvokeMember("_e",
                                    BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
                                    this, null, null, null, null);
        p1_ = GetType().InvokeMember("_p1",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
                                     this, null, null, null, null);
        p2_ = GetType().InvokeMember("_p2",
                                     BindingFlags.Static | BindingFlags.Public | BindingFlags.GetField, null,
                                     this, null, null, null, null);
        p3_ = GetType().InvokeMember("_p3",
                                     BindingFlags.Static | BindingFlags.Public | BindingFlags.GetField, null,
                                     this, null, null, null, null);
        p4_ = GetType().InvokeMember("_p4",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
                                     this, null, null, null, null);
        p5_ = GetType().InvokeMember("_p5",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
                                     this, null, null, null, null);
        p6_ = GetType().InvokeMember("_p6",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
                                     this, null, null, null, null);
        p7_ = GetType().InvokeMember("_p7",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
                                     this, null, null, null, null);
        p8_ = GetType().InvokeMember("_p8",
                                     BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetField, null,
                                     this, null, null, null, null);

        // verify the values of all locals
        values =
            s1_.ToString() + " " +
            s2_.ToString() + " " +
            s3_.ToString() + " " +
            s4_.ToString() + " " +
            s5_.ToString() + " " +
            s8_.ToString() + " " +
            v_.ToString() + " " +
            f_.ToString() + " " +
            d_.ToString() + " " +
            o_.ToString() + " " +
            s_.ToString() + " " +
            e_.ToString() + " " +
            p1_.ToString() + " " +
            p2_.ToString() + " " +
            p3_.ToString() + " " +
            p4_.ToString() + " " +
            p5_.ToString() + " " +
            p6_.ToString() + " " +
            p7_.ToString() + " " +
            p8_.ToString() + " " +
            ".";

        if (values != "9 104 225 80 57 184 17 160 105 8 65 240 153 88 113" +
            " 64 201 168 161 144 249 248 209 224 -23767 606228808 2874968872843236865 -901615" +
            "9779942285264 360942425 4248 49 -5.193024E+18 -6.58392565490175E+18 MainApp 2212" +
            "973731230676456 Hali 97 208 -9799 49464 1739539345 3300757792 -65179382391756062" +
            "95 1703311890815005320 .")
        {
            Console.WriteLine("GetFields: unexpected values: " + values);
            Fail(105);
        }

        Console.WriteLine("Field getters succeeded");

        // invoke the method with complex signature
        GetType().InvokeMember("Foo",
                               BindingFlags.Static | BindingFlags.Public | BindingFlags.InvokeMethod, null,
                               null, new Object[] {
            this, "O", "S",
            (float)Randomizer(), (double)Randomizer(), (float)Randomizer(),
            (double)Randomizer(), (float)Randomizer(), (double)Randomizer(),
            (long)Randomizer(), (long)Randomizer(), (long)Randomizer(),
            (long)Randomizer(), (long)Randomizer(), (long)Randomizer(),
            (sbyte)Randomizer(), (byte)Randomizer(), (short)Randomizer(),
            (ushort)Randomizer(), (int)Randomizer(), (uint)Randomizer(),
            (long)Randomizer(), (ulong)Randomizer(),
            (float)Randomizer(), (double)Randomizer(), (float)Randomizer(),
            (double)Randomizer(), (float)Randomizer(), (double)Randomizer()
        }, null, null, null);

        Console.WriteLine("Complex invoke succeeded");

        // invoke the constructor with complex signature
        GetType().InvokeMember("Foo",
                               BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance, null,
                               null, new Object[] {
            this,
            s1_, s2_, s3_, s4_, s5_, s8_, v_, f_, d_, o_, s_, e_,
        }, null, null, null);
        Console.WriteLine("Constructor invoke succeeded");
    }
Example #22
0
	public static int test_0_struct4_args () {
		Struct4 s = new Struct4 ();
		s.i = 1;
		s.j = 2;
		s.k = 3;
		s.l = 4;
		s.m = 5;

		return pass_struct4 (s);
	}
    public Struct4 Foo(ref Struct8 r, Struct5 v, long t, ref long tr) {
        Struct4 ret = new Struct4();

        String values =
            v.ToString() + " " +
            r.ToString() + " " +
            t.ToString() + " " +
            tr.ToString() + " " +
            ".";

        if (values != "218 72 10 152 58 201 168 161 144 249 248" +
            " 209 224 3406623781630010640 3406623781630010640 .")
        {
            Console.WriteLine("Struct4 Foo(...): unexpected values: " + values);
            Fail(14);
        }

        r.Randomize();
        tr += (long)Randomizer();
        ret.Randomize();
        return ret;
    }