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);
        }
    }
Example #2
0
    // Token: 0x060005E2 RID: 1506 RVA: 0x000294B0 File Offset: 0x000276B0
    private static bool smethod_19(Struct8 struct8_0, out long long_1, out TimeSpan timeSpan_0, out DateTimeKind dateTimeKind_0)
    {
        dateTimeKind_0 = DateTimeKind.Utc;
        int num = struct8_0.smethod_0('+', 7, struct8_0.method_2() - 8);

        if (num == -1)
        {
            num = struct8_0.smethod_0('-', 7, struct8_0.method_2() - 8);
        }
        if (num != -1)
        {
            dateTimeKind_0 = DateTimeKind.Local;
            if (!Class25.smethod_23(struct8_0, num + struct8_0.method_1(), out timeSpan_0))
            {
                long_1 = 0L;
                return(false);
            }
        }
        else
        {
            timeSpan_0 = TimeSpan.Zero;
            num        = struct8_0.method_2() - 2;
        }
        return(Class23.smethod_15(struct8_0.method_0(), 6 + struct8_0.method_1(), num - 6, out long_1) == (Enum4)1);
    }
Example #3
0
    // Token: 0x060005E3 RID: 1507 RVA: 0x00029544 File Offset: 0x00027744
    private static bool xkTsxUkKek(Struct8 struct8_0, DateTimeZoneHandling dateTimeZoneHandling_0, out DateTime dateTime_0)
    {
        long         long_;
        TimeSpan     timeSpan;
        DateTimeKind dateTimeKind;

        if (!Class25.smethod_19(struct8_0, out long_, out timeSpan, out dateTimeKind))
        {
            dateTime_0 = default(DateTime);
            return(false);
        }
        DateTime dateTime = Class25.smethod_11(long_);

        if (dateTimeKind != DateTimeKind.Unspecified)
        {
            if (dateTimeKind != DateTimeKind.Local)
            {
                dateTime_0 = dateTime;
            }
            else
            {
                dateTime_0 = dateTime.ToLocalTime();
            }
        }
        else
        {
            dateTime_0 = DateTime.SpecifyKind(dateTime.ToLocalTime(), DateTimeKind.Unspecified);
        }
        dateTime_0 = Class25.smethod_2(dateTime_0, dateTimeZoneHandling_0);
        return(true);
    }
Example #4
0
    // Token: 0x060005DB RID: 1499 RVA: 0x00028E4C File Offset: 0x0002704C
    internal static bool smethod_12(Struct8 struct8_0, DateTimeZoneHandling dateTimeZoneHandling_0, out DateTime dateTime_0)
    {
        Struct5 @struct = default(Struct5);

        if ([email protected]_0(struct8_0.method_0(), struct8_0.method_1(), struct8_0.method_2()))
        {
            dateTime_0 = default(DateTime);
            return(false);
        }
        DateTime dateTime_ = Class25.smethod_14(@struct);

        switch (@struct.enum6_0)
        {
        case (Enum6)1:
            dateTime_ = new DateTime(dateTime_.Ticks, DateTimeKind.Utc);
            break;

        case (Enum6)2:
        {
            TimeSpan timeSpan = new TimeSpan(@struct.int_7, @struct.int_8, 0);
            long     num      = dateTime_.Ticks + timeSpan.Ticks;
            if (num <= DateTime.MaxValue.Ticks)
            {
                dateTime_ = new DateTime(num, DateTimeKind.Utc).ToLocalTime();
            }
            else
            {
                num += dateTime_.smethod_0().Ticks;
                if (num > DateTime.MaxValue.Ticks)
                {
                    num = DateTime.MaxValue.Ticks;
                }
                dateTime_ = new DateTime(num, DateTimeKind.Local);
            }
            break;
        }

        case (Enum6)3:
        {
            TimeSpan timeSpan2 = new TimeSpan(@struct.int_7, @struct.int_8, 0);
            long     num       = dateTime_.Ticks - timeSpan2.Ticks;
            if (num >= DateTime.MinValue.Ticks)
            {
                dateTime_ = new DateTime(num, DateTimeKind.Utc).ToLocalTime();
            }
            else
            {
                num += dateTime_.smethod_0().Ticks;
                if (num < DateTime.MinValue.Ticks)
                {
                    num = DateTime.MinValue.Ticks;
                }
                dateTime_ = new DateTime(num, DateTimeKind.Local);
            }
            break;
        }
        }
        dateTime_0 = Class25.smethod_2(dateTime_, dateTimeZoneHandling_0);
        return(true);
    }
Example #5
0
    public static int Main()
    {
        const int Pass = 100;
        const int Fail = -1;

        Struct1 str1 = new Struct1(true);

        if (!TestStruct1Param(str1, 4))
        {
            return(Fail);
        }

        Struct8 str8 = new Struct8(1.0);

        if (!TestStruct8Param(str8, 4))
        {
            return(Fail);
        }

        Test test = new Test();

        if (!test.TestGenericSharing <object>())
        {
            return(Fail);
        }

        if (!test.TestStackParam(1, 0, 5, 7))
        {
            return(Fail);
        }

        return(Pass);
    }
 public void StructSize8()
 {
     for (int i = 0; i < _struct8.Length; i++)
     {
         Struct8 s = _struct8[i];
         s.Value1    = i;
         s.Value2    = i;
         _struct8[i] = s;
     }
 }
Example #7
0
        public unsafe void InitBlockAllOnes8()
        {
            Struct8 dstLcl;

            for (int i = 0; i < OperationsPerInvoke; i++)
            {
                Unsafe.InitBlock(&dstLcl, 255, 8);
            }

            fld8 = dstLcl;
        }
Example #8
0
        private int method_5(byte[] byte_0, int int_4, int int_5)
        {
            float[] array = new float[int_5 / 3];
            int     num   = this.stream1_0.vmethod_4(array, 0, array.Length);
            int     i     = 0;

            while (i < num)
            {
                Buffer.BlockCopy(Struct8.smethod_4(Class11.smethod_23(array[i])), 0, byte_0, int_4, 3);
                i++;
                int_4 += 3;
            }
            return(num + num + num);
        }
Example #9
0
    // Token: 0x060005E5 RID: 1509 RVA: 0x000295F0 File Offset: 0x000277F0
    private static bool smethod_21(Struct8 struct8_0, out DateTimeOffset dateTimeOffset_0)
    {
        long         long_;
        TimeSpan     timeSpan;
        DateTimeKind dateTimeKind;

        if (!Class25.smethod_19(struct8_0, out long_, out timeSpan, out dateTimeKind))
        {
            dateTimeOffset_0 = default(DateTime);
            return(false);
        }
        dateTimeOffset_0 = new DateTimeOffset(Class25.smethod_11(long_).Add(timeSpan).Ticks, timeSpan);
        return(true);
    }
Example #10
0
        public unsafe void CopyBlock8()
        {
            Struct8 srcLcl;
            Struct8 dstLcl;

            srcLcl = fld8;

            for (int i = 0; i < OperationsPerInvoke; i++)
            {
                Unsafe.CopyBlock(&dstLcl, &srcLcl, 8);
            }

            fld8 = dstLcl;
        }
Example #11
0
        private int method_1(byte[] byte_0, int int_4, int int_5)
        {
            byte[] array = new byte[int_5 + int_5 + int_5];
            int    num   = this.stream1_0.Read(array, 0, array.Length);
            int    i     = 0;

            while (i < num)
            {
                byte_0[int_4] = Class11.smethod_8(Struct8.smethod_2(byte_0, i));
                i            += 3;
                int_4++;
            }
            return(num / 3);
        }
Example #12
0
    public Class358()
    {
        this.list_0             = new List <IntPtr>();
        this.list_1             = new List <IntPtr>();
        this.intptr_0           = Marshal.AllocHGlobal(int_6);
        this.struct8_0          = new Struct8();
        this.list_2             = new List <Class358>();
        this.bool_0             = true;
        this.struct8_0.intptr_0 = (IntPtr)1L;
        int num = 0;

        for (int i = 0; num < (int_6 / 4); i += 4)
        {
            Marshal.WriteInt32(this.intptr_0, i, 0);
            num++;
        }
    }
Example #13
0
    // Test a recursive tail call with an 8-byte struct parameter.
    static bool TestStruct8Param(Struct8 str8, int count)
    {
        Console.WriteLine(count);
        Console.WriteLine(count);
        Console.WriteLine(count);
        Console.WriteLine(count);
        if (!CheckStruct8(str8))
        {
            return(false);
        }

        if (count <= 0)
        {
            return(true);
        }

        return(TestStruct8Param(str8, count - 1));
    }
Example #14
0
    // Token: 0x060005DC RID: 1500 RVA: 0x00028FE0 File Offset: 0x000271E0
    internal static bool smethod_13(Struct8 struct8_0, out DateTimeOffset dateTimeOffset_0)
    {
        Struct5 @struct = default(Struct5);

        if ([email protected]_0(struct8_0.method_0(), struct8_0.method_1(), struct8_0.method_2()))
        {
            dateTimeOffset_0 = default(DateTimeOffset);
            return(false);
        }
        DateTime dateTime = Class25.smethod_14(@struct);
        TimeSpan utcOffset;

        switch (@struct.enum6_0)
        {
        case (Enum6)1:
            utcOffset = new TimeSpan(0L);
            break;

        case (Enum6)2:
            utcOffset = new TimeSpan([email protected]_7, [email protected]_8, 0);
            break;

        case (Enum6)3:
            utcOffset = new TimeSpan(@struct.int_7, @struct.int_8, 0);
            break;

        default:
            utcOffset = TimeZoneInfo.Local.GetUtcOffset(dateTime);
            break;
        }
        long num = dateTime.Ticks - utcOffset.Ticks;

        if (num >= 0L && num <= 3155378975999999999L)
        {
            dateTimeOffset_0 = new DateTimeOffset(dateTime, utcOffset);
            return(true);
        }
        dateTimeOffset_0 = default(DateTimeOffset);
        return(false);
    }
Example #15
0
    public static int Main()
    {
        const int Pass = 100;
        const int Fail = -1;

        Struct1 str1 = new Struct1(true);

        if (!TestStruct1Param(str1, 4))
        {
            return(Fail);
        }

        Struct8 str8 = new Struct8(1.0);

        if (!TestStruct8Param(str8, 4))
        {
            return(Fail);
        }

        Test_RecursiveTailCall test = new Test_RecursiveTailCall();

        if (!test.TestGenericSharing <object>())
        {
            return(Fail);
        }

        if (!test.TestStackParam(1, 0, 5, 7))
        {
            return(Fail);
        }

        if (TestGenericContext <GenericClass <int> >(5) != 120)
        {
            return(Fail);
        }

        return(Pass);
    }
Example #16
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 #17
0
    public Struct5 Foo(Struct8 v, ref Valuesa r, byte t, ref byte tr)
    {
        Struct5 ret = new Struct5();

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

        if (values != "64 210 16 130 224 50 176 226 224 -23767 606" +
            "228808 2874968872843236865 -9016159779942285264 360942425 4248 49 160 160 .")
        {
            Console.WriteLine("Struct5 Foo(...): unexpected values: " + values);
            Fail(15);
        }

        r.Randomize();
        tr += (byte)Randomizer();
        ret.Randomize();
        return(ret);
    }
Example #18
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 #19
0
    public Struct5 Foo(Struct8 v, ref Valuesa r, byte t, ref byte tr)
    {
        Struct5 ret = new Struct5();

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

        if (values != "193 121 129 185 65 249 1 57 41 20808 639653" +
            "377 -9016159779942285264 -7525944817302140071 1480724632 6961 128 114 114 .")
        {
            Console.WriteLine("Struct5 Foo(...): unexpected values: " + values);
            Fail(15);
        }

        r.Randomize();
        tr += (byte)Randomizer();
        ret.Randomize();
        return(ret);
    }
Example #20
0
    public Struct8 Foo(ref float r, Valuesa v, ushort t, ref ushort tr)
    {
        Struct8 ret = new Struct8();

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

        if (values != "211 13120 -1219659045 754467178707868024 40" +
            "85042269830528355 -1490187216 -6293 104 -6.583926E+18 34594 34594 .")
        {
            Console.WriteLine("Struct8 Foo(...): unexpected values: " + values);
            Fail(16);
        }

        r  += (float)Randomizer();
        tr += (ushort)Randomizer();
        ret.Randomize();
        return(ret);
    }
Example #21
0
    public Struct8 Foo(ref float r, Valuesa v, ushort t, ref ushort tr)
    {
        Struct8 ret = new Struct8();

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

        if (values != "121 -16511 697284281 -978709601062956991 15" +
            "81927808989185017 -802663167 32057 193 -5.193024E+18 33392 33392 .")
        {
            Console.WriteLine("Struct8 Foo(...): unexpected values: " + values);
            Fail(16);
        }

        r  += (float)Randomizer();
        tr += (ushort)Randomizer();
        ret.Randomize();
        return(ret);
    }
Example #22
0
    // Token: 0x060005E7 RID: 1511 RVA: 0x00029678 File Offset: 0x00027878
    private static bool smethod_23(Struct8 struct8_0, int int_2, out TimeSpan timeSpan_0)
    {
        bool flag = struct8_0[int_2] == '-';
        int  num;

        if (Class23.smethod_14(struct8_0.method_0(), int_2 + 1, 2, out num) != (Enum4)1)
        {
            timeSpan_0 = default(TimeSpan);
            return(false);
        }
        int num2 = 0;

        if (struct8_0.method_2() - int_2 > 5 && Class23.smethod_14(struct8_0.method_0(), int_2 + 3, 2, out num2) != (Enum4)1)
        {
            timeSpan_0 = default(TimeSpan);
            return(false);
        }
        timeSpan_0 = TimeSpan.FromHours((double)num) + TimeSpan.FromMinutes((double)num2);
        if (flag)
        {
            timeSpan_0 = timeSpan_0.Negate();
        }
        return(true);
    }
Example #23
0
 // Token: 0x060005E0 RID: 1504 RVA: 0x000292FC File Offset: 0x000274FC
 internal static bool smethod_17(Struct8 struct8_0, string string_0, IFormatProvider iformatProvider_0, out DateTimeOffset dateTimeOffset_0)
 {
     if (struct8_0.method_2() > 0)
     {
         int num = struct8_0.method_1();
         if (struct8_0[num] == '/')
         {
             if (struct8_0.method_2() >= 9 && struct8_0.smethod_1("/Date(") && struct8_0.smethod_2(")/") && Class25.smethod_21(struct8_0, out dateTimeOffset_0))
             {
                 return(true);
             }
         }
         else if (struct8_0.method_2() >= 19 && struct8_0.method_2() <= 40 && char.IsDigit(struct8_0[num]) && struct8_0[num + 10] == 'T' && Class25.smethod_13(struct8_0, out dateTimeOffset_0))
         {
             return(true);
         }
         if (!string.IsNullOrEmpty(string_0) && Class25.smethod_22(struct8_0.ToString(), string_0, iformatProvider_0, out dateTimeOffset_0))
         {
             return(true);
         }
     }
     dateTimeOffset_0 = default(DateTimeOffset);
     return(false);
 }
Example #24
0
 // Token: 0x060005DE RID: 1502 RVA: 0x00029140 File Offset: 0x00027340
 internal static bool smethod_15(Struct8 struct8_0, DateTimeZoneHandling dateTimeZoneHandling_0, string string_0, IFormatProvider iformatProvider_0, out DateTime dateTime_0)
 {
     if (struct8_0.method_2() > 0)
     {
         int num = struct8_0.method_1();
         if (struct8_0[num] == '/')
         {
             if (struct8_0.method_2() >= 9 && struct8_0.smethod_1("/Date(") && struct8_0.smethod_2(")/") && Class25.xkTsxUkKek(struct8_0, dateTimeZoneHandling_0, out dateTime_0))
             {
                 return(true);
             }
         }
         else if (struct8_0.method_2() >= 19 && struct8_0.method_2() <= 40 && char.IsDigit(struct8_0[num]) && struct8_0[num + 10] == 'T' && Class25.smethod_12(struct8_0, dateTimeZoneHandling_0, out dateTime_0))
         {
             return(true);
         }
         if (!string.IsNullOrEmpty(string_0) && Class25.smethod_20(struct8_0.ToString(), dateTimeZoneHandling_0, string_0, iformatProvider_0, out dateTime_0))
         {
             return(true);
         }
     }
     dateTime_0 = default(DateTime);
     return(false);
 }
    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 Struct8 Foo(ref float r, Valuesa v, ushort t, ref ushort tr) {
        Struct8 ret = new Struct8();

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

        if (values != "121 -16511 697284281 -978709601062956991 15" +
            "81927808989185017 -802663167 32057 193 -5.193024E+18 33392 33392 .")
        {
            Console.WriteLine("Struct8 Foo(...): unexpected values: " + values);
            Fail(16);
        }

        r += (float)Randomizer();
        tr += (ushort)Randomizer();
        ret.Randomize();
        return ret;
    }
    public Struct5 Foo(Struct8 v, ref Valuesa r, byte t, ref byte tr) {
        Struct5 ret = new Struct5();

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

        if (values != "64 210 16 130 224 50 176 226 224 -23767 606" +
            "228808 2874968872843236865 -9016159779942285264 360942425 4248 49 160 160 .")
        {
            Console.WriteLine("Struct5 Foo(...): unexpected values: " + values);
            Fail(15);
        }

        r.Randomize();
        tr += (byte)Randomizer();
        ret.Randomize();
        return ret;
    }
    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 #30
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 #31
0
        public override int vmethod_4(float[] float_0, int int_12, int int_13)
        {
            if (this.bool_0)
            {
                return(0);
            }
            int num    = int_12;
            int num2   = int_12 + int_13;
            int short_ = (int)this.waveFormat_0.short_0;

            do
            {
                int num3 = this.class151_0.class140_0.int_0 - this.int_10;
                if (num3 > 0)
                {
                    if (num3 > num2 - num)
                    {
                        num3 = num2 - num;
                    }
                    for (int i = 0; i < short_; i++)
                    {
                        int[] array   = this.method_0()[i].vmethod_0();
                        short short_2 = this.waveFormat_0.short_2;
                        if (short_2 <= 16)
                        {
                            if (short_2 != 8)
                            {
                                if (short_2 == 16)
                                {
                                    int j    = this.int_10;
                                    int num4 = num + i;
                                    while (j < num3)
                                    {
                                        float_0[num4] = Class11.smethod_7((short)array[j]);
                                        j++;
                                        num4 += short_;
                                    }
                                }
                            }
                            else
                            {
                                int k    = this.int_10;
                                int num5 = num + i;
                                while (k < num3)
                                {
                                    float_0[num5] = Class11.smethod_3((byte)array[k]);
                                    k++;
                                    num5 += short_;
                                }
                            }
                        }
                        else if (short_2 != 24)
                        {
                            if (short_2 == 32)
                            {
                                int l    = this.int_10;
                                int num6 = num + i;
                                while (l < num3)
                                {
                                    float_0[num6] = Class11.smethod_15(array[l]);
                                    l++;
                                    num6 += short_;
                                }
                            }
                        }
                        else
                        {
                            int m    = this.int_10;
                            int num7 = num + i;
                            while (m < num3)
                            {
                                float_0[num7] = Class11.smethod_11(Struct8.smethod_1(array[m]));
                                m++;
                                num7 += short_;
                            }
                        }
                    }
                    this.long_1 += (long)num3;
                    this.int_10 += num3;
                    num         += num3 * short_;
                    if (num >= num2)
                    {
                        break;
                    }
                }
            }while (this.method_5() != null);
            return(num - int_12);
        }
Example #32
0
        public override float[][] vmethod_5(int int_12)
        {
            if (this.bool_0)
            {
                return(null);
            }
            float[][] array = new float[(int)this.waveFormat_0.short_0][];
            for (int i = 0; i < array.Length; i++)
            {
                array[i] = new float[int_12];
            }
            int num = 0;

            do
            {
                int num2 = this.class151_0.class140_0.int_0 - this.int_10;
                if (num2 > 0)
                {
                    if (num2 > int_12 - num)
                    {
                        num2 = int_12 - num;
                    }
                    for (int j = 0; j < array.Length; j++)
                    {
                        float[] array2 = array[j];
                        int[]   array3 = this.method_0()[j].vmethod_0();
                        short   short_ = this.waveFormat_0.short_2;
                        if (short_ <= 16)
                        {
                            if (short_ != 8)
                            {
                                if (short_ == 16)
                                {
                                    int k    = num;
                                    int num3 = this.int_10;
                                    while (k < num2)
                                    {
                                        array2[k] = Class11.smethod_7((short)array3[num3]);
                                        k++;
                                        num3++;
                                    }
                                }
                            }
                            else
                            {
                                int l    = num;
                                int num4 = this.int_10;
                                while (l < num2)
                                {
                                    array2[l] = Class11.smethod_3((byte)array3[num4]);
                                    l++;
                                    num4++;
                                }
                            }
                        }
                        else if (short_ != 24)
                        {
                            if (short_ == 32)
                            {
                                int m    = num;
                                int num5 = this.int_10;
                                while (m < num2)
                                {
                                    array2[m] = Class11.smethod_15(array3[num5]);
                                    m++;
                                    num5++;
                                }
                            }
                        }
                        else
                        {
                            int n    = num;
                            int num6 = this.int_10;
                            while (n < num2)
                            {
                                array2[n] = Class11.smethod_11(Struct8.smethod_1(array3[num6]));
                                n++;
                                num6++;
                            }
                        }
                    }
                    num         += num2;
                    this.long_1 += (long)num2;
                    this.int_10 += num2;
                    if (num >= int_12)
                    {
                        break;
                    }
                }
            }while (this.method_5() != null);
            if (num == 0)
            {
                return(null);
            }
            if (num < int_12)
            {
                for (int num7 = 0; num7 < array.Length; num7++)
                {
                    Array.Resize <float>(ref array[num7], num);
                }
            }
            return(array);
        }
    public Struct5 Foo(Struct8 v, ref Valuesa r, byte t, ref byte tr) {
        Struct5 ret = new Struct5();

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

        if (values != "193 121 129 185 65 249 1 57 41 20808 639653" +
            "377 -9016159779942285264 -7525944817302140071 1480724632 6961 128 114 114 .")
        {
            Console.WriteLine("Struct5 Foo(...): unexpected values: " + values);
            Fail(15);
        }

        r.Randomize();
        tr += (byte)Randomizer();
        ret.Randomize();
        return ret;
    }
    public Struct8 Foo(ref float r, Valuesa v, ushort t, ref ushort tr) {
        Struct8 ret = new Struct8();

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

        if (values != "211 13120 -1219659045 754467178707868024 40" +
            "85042269830528355 -1490187216 -6293 104 -6.583926E+18 34594 34594 .")
        {
            Console.WriteLine("Struct8 Foo(...): unexpected values: " + values);
            Fail(16);
        }

        r += (float)Randomizer();
        tr += (ushort)Randomizer();
        ret.Randomize();
        return ret;
    }
Example #35
0
        public void method_2(byte[] byte_1)
        {
            int num;

            if (this.enum3_0 == Enum3.const_1)
            {
                num = ((this.enum5_0 == Enum5.const_3) ? 17 : 32);
            }
            else
            {
                num = ((this.enum5_0 == Enum5.const_3) ? 9 : 17);
            }
            try
            {
                string @string = Encoding.UTF8.GetString(byte_1, num, 4);
                if (@string.Equals("Xing") || @string.Equals("Info"))
                {
                    this.bool_2 = true;
                    this.int_9  = -1;
                    this.int_11 = -1;
                    this.int_10 = -1;
                    byte[] array = new byte[100];
                    int    num2  = zzSoundClass.smethod_0(BitConverter.ToInt32(byte_1, num + 4));
                    int    num3  = 8;
                    if ((num2 & 1) != 0)
                    {
                        this.int_9 = zzSoundClass.smethod_0(BitConverter.ToInt32(byte_1, num + num3));
                        num3      += 4;
                    }
                    if ((num2 & 2) != 0)
                    {
                        this.int_11 = zzSoundClass.smethod_0(BitConverter.ToInt32(byte_1, num + num3));
                        num3       += 4;
                    }
                    if ((num2 & 4) != 0)
                    {
                        Buffer.BlockCopy(byte_1, num + num3, array, 0, array.Length);
                        num3          += array.Length;
                        this.class83_0 = new Class83(array, this.int_11);
                    }
                    if ((num2 & 8) != 0)
                    {
                        this.int_10 = zzSoundClass.smethod_0(BitConverter.ToInt32(byte_1, num + num3));
                        num3       += 4;
                    }
                }
            }
            catch (IndexOutOfRangeException exception_)
            {
                throw new BitstreamException("Xing Header Corrupted", exception_);
            }
            num = 32;
            try
            {
                if (Encoding.UTF8.GetString(byte_1, num, 4).Equals("VBRI"))
                {
                    this.bool_2 = true;
                    this.int_9  = -1;
                    this.int_11 = -1;
                    this.int_10 = -1;
                    this.int_10 = (int)zzSoundClass.smethod_1(BitConverter.ToInt16(byte_1, num + 8));
                    this.int_11 = zzSoundClass.smethod_0(BitConverter.ToInt32(byte_1, num + 10));
                    this.int_9  = zzSoundClass.smethod_0(BitConverter.ToInt32(byte_1, num + 14));
                    int[] array2 = new int[(int)zzSoundClass.smethod_1(BitConverter.ToInt16(byte_1, num + 18))];
                    short num4   = zzSoundClass.smethod_1(BitConverter.ToInt16(byte_1, num + 20));
                    short num5   = zzSoundClass.smethod_1(BitConverter.ToInt16(byte_1, num + 22));
                    short num6   = zzSoundClass.smethod_1(BitConverter.ToInt16(byte_1, num + 24));
                    int   num7   = 26;
                    switch (num5)
                    {
                    case 1:
                    {
                        int i = 0;
                        while (i < array2.Length)
                        {
                            array2[i] = (int)((short)byte_1[num + num7] * num4);
                            i++;
                            num7++;
                        }
                        break;
                    }

                    case 2:
                    {
                        int j = 0;
                        while (j < array2.Length)
                        {
                            array2[j] = (int)(zzSoundClass.smethod_1(BitConverter.ToInt16(byte_1, num + num7)) * num4);
                            j++;
                            num7 += 2;
                        }
                        break;
                    }

                    case 3:
                    {
                        int k = 0;
                        while (k < array2.Length)
                        {
                            array2[k] = Struct8.smethod_0(Struct8.smethod_3(byte_1, num + num7, true)) * (int)num4;
                            k++;
                            num7 += 3;
                        }
                        break;
                    }

                    case 4:
                    {
                        int l = 0;
                        while (l < array2.Length)
                        {
                            array2[l] = zzSoundClass.smethod_0(BitConverter.ToInt32(byte_1, num + num7)) * (int)num4;
                            l++;
                            num7 += 4;
                        }
                        break;
                    }

                    default:
                        throw new Exception("Size per table entry in bytes - is bigger then 4: " + num5);
                    }
                    this.class83_0 = new Class83(array2, num6);
                }
            }
            catch (IndexOutOfRangeException exception_2)
            {
                throw new BitstreamException("VBRI Header Corrupted", exception_2);
            }
        }
Example #36
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");
    }
    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 #38
0
 static bool CheckStruct8(Struct8 str8)
 {
     return(str8.dfield == 1.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());
    }