Esempio n. 1
0
 public bool Equals(Struct1 str)
 {
     if (mi != str.mi || ms != str.ms || md != str.md || mdt != str.mdt)
     {
         return(false);
     }
     if (mb64.Length != str.mb64.Length)
     {
         return(false);
     }
     for (var i = 0; i < mb64.Length; i++)
     {
         if (mb64[i] != str.mb64[i])
         {
             return(false);
         }
     }
     for (var i = 0; i < ma.Length; i++)
     {
         if (ma[i] != str.ma[i])
         {
             return(false);
         }
     }
     return(true);
 }
Esempio n. 2
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);
    }
Esempio n. 3
0
        public void test4()
        {
            var struct1   = new Struct1();
            var duplicate = struct1.Duplicate();

            AssertNotNull(duplicate);
        }
Esempio n. 4
0
 public void inParameters(bool aBool, byte aByte,
                          short aShort, ushort aUShort,
                          int aInt, uint aUInt,
                          long aLong, ulong aULong,
                          float aFloat, double aDouble,
                          char aChar, string aString,
                          Type aType, uno.Any aAny,
                          Enum2 aEnum, Struct1 aStruct,
                          object aXInterface,
                          unoidl.com.sun.star.lang.XComponent aXComponent,
                          bool[] seqBool)
 {
     m_Bool       = aBool;
     m_Byte       = aByte;
     m_Short      = aShort;
     m_UShort     = aUShort;
     m_Int        = aInt;
     m_UInt       = aUInt;
     m_Long       = aLong;
     m_ULong      = aULong;
     m_Float      = aFloat;
     m_Double     = aDouble;
     m_Char       = aChar;
     m_String     = aString;
     m_Type       = aType;
     m_Any        = aAny;
     m_Enum2      = aEnum;
     m_Struct1    = aStruct;
     m_XInterface = aXInterface;
     m_XComponent = aXComponent;
     m_seqBool    = seqBool;
 }
Esempio n. 5
0
        public static OM2 FromFile(string path)
        {
            //Open Stream
            InputStream ins = new InputStream(path);

            //Read OM2
            OM2 om2 = new OM2();

            om2.header = new Header();
            om2.header.Read(ins);

            om2.struct1s = new List <Struct1>(32);
            for (int i = 0; i < 32; ++i)
            {
                Struct1 s1 = new Struct1();
                s1.Read(ins);

                om2.struct1s.Add(s1);
            }

            om2.meshes = new List <Mesh>();
            for (int i = 0; i < om2.header.numMesh; ++i)
            {
                Mesh m = new Mesh();
                m.Read(ins);

                om2.meshes.Add(m);
            }

            return(om2);
        }
Esempio n. 6
0
        public async Task WhenALoggerWritesToTheSinkItStoresTheCorrectTypesForStructure()
        {
            var storageAccount = CloudStorageAccount.DevelopmentStorageAccount;
            var tableClient    = storageAccount.CreateCloudTableClient();
            var table          = tableClient.GetTableReference("LogEventEntity");

            await table.DeleteIfExistsAsync();

            var logger = new LoggerConfiguration()
                         .WriteTo.AzureTableStorageWithProperties(storageAccount)
                         .CreateLogger();

            var struct1 = new Struct1
            {
                IntVal    = 10,
                StringVal = "ABCDE"
            };

            var struct2 = new Struct2
            {
                DateTimeVal = new DateTime(2014, 12, 3, 17, 37, 12),
                DoubleVal   = Math.PI
            };

            var struct0 = new Struct0
            {
                Struct1Val = struct1,
                Struct2Val = struct2
            };

            logger.Information("{@Struct0}", struct0);
            var result = (await TableQueryTakeDynamicAsync(table, takeCount: 1)).First();

            Assert.Equal("Struct0 { Struct1Val: Struct1 { IntVal: 10, StringVal: \"ABCDE\" }, Struct2Val: Struct2 { DateTimeVal: 12/03/2014 17:37:12, DoubleVal: 3.14159265358979 } }", result.Properties["Struct0"].StringValue);
        }
Esempio n. 7
0
        // Simconnect client will send a win32 message when there is
        // a packet to process. ReceiveMessage must be called to
        // trigger the events. This model keeps simconnect processing on the main thread.



        void simconnect_OnRecvSimobjectDataBytype(SimConnect sender, SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE data)
        {
            switch ((DATA_REQUESTS)data.dwRequestID)
            {
            case DATA_REQUESTS.REQUEST_1:
                Struct1 s1    = (Struct1)data.dwData[0];
                double  angle = s1.TUR * 180 / 3.1415926;
                Trace.WriteLine("Title: " + s1.title);
                Trace.WriteLine("Lat:   " + s1.latitude);
                Trace.WriteLine("Lon:   " + s1.longitude);
                Trace.WriteLine("Alt:   " + s1.altitude);
                Trace.WriteLine("TUR:   " + angle);
                if (Math.Abs(angle - lastAngle) > 0.1)
                {
                    this.canvas.RenderTransform = SetAngleXY(-angle);
                    this.label_DIRValue.Content = (int)angle;
                    lastAngle = angle;
                }

                break;

            default:
                Trace.WriteLine("Unknown request ID: " + data.dwRequestID);
                break;
            }
        }
Esempio n. 8
0
        void simconnect_OnRecvSimobjectData(SimConnect sender, SIMCONNECT_RECV_SIMOBJECT_DATA data)
        {
            switch ((DATA_REQUESTS)data.dwRequestID)
            {
            case DATA_REQUESTS.REQUEST_1:
                Struct1 s1 = (Struct1)data.dwData[0];

                if (!simrunning)
                {
                    sw.Start();
                    simrunning = true;
                }

                s1.time = sw.ElapsedMilliseconds;

                log.Add(s1);

                if (log.Count % 100 == 0)
                {
                    Struct1 current = log.Last();
                    displayStats(current);
                }
                break;

            case DATA_REQUESTS.REQUEST_2:
                Struct2 s2 = (Struct2)data.dwData[0];
                s2.time = log.Count == 0 ? 0 : log.Last().time;
                log2.Add(s2);
                break;

            default:
                displayText("Unknown request ID: " + data.dwRequestID);
                break;
            }
        }
Esempio n. 9
0
        public void test4()
        {
            var struct1 = new Struct1();
            var duplicate = struct1.Duplicate();

            AssertNotNull(duplicate);
        }
Esempio n. 10
0
 public void outParameters(out bool aBool, out byte aByte,
                           out short aShort, out ushort aUShort,
                           out int aInt, out uint aUInt,
                           out long aLong, out ulong aULong,
                           out float aFloat, out double aDouble,
                           out char aChar, out string aString,
                           out Type aType, out uno.Any aAny,
                           out Enum2 aEnum, out Struct1 aStruct,
                           out object aXInterface,
                           out unoidl.com.sun.star.lang.XComponent aXComponent,
                           out bool[] seqBool)
 {
     aBool       = m_Bool;
     aByte       = m_Byte;
     aShort      = m_Short;
     aUShort     = m_UShort;
     aInt        = m_Int;
     aUInt       = m_UInt;
     aLong       = m_Long;
     aULong      = m_ULong;
     aFloat      = m_Float;
     aDouble     = m_Double;
     aChar       = m_Char;
     aString     = m_String;
     aType       = m_Type;
     aAny        = m_Any;
     aEnum       = m_Enum2;
     aStruct     = m_Struct1;
     aXInterface = m_XInterface;
     aXComponent = m_XComponent;
     seqBool     = m_seqBool;
 }
Esempio n. 11
0
 private int method_2(ref Struct0 logFont, ref Struct1 textMetric, uint fontType, int lParam)
 {
     if ((fontType & 4U) > 0U)
     {
         bool flag = logFont.class49_0.int_4 > 600;
         if (logFont.class49_0.byte_0 == (byte)0)
         {
             if (flag)
             {
                 this.fontStyles_0.BoldAvailable = true;
             }
             else
             {
                 this.fontStyles_0.RegularAvailable = true;
             }
         }
         else if (flag)
         {
             this.fontStyles_0.BoldItalicAvailable = true;
         }
         else
         {
             this.fontStyles_0.ItalicAvailable = true;
         }
     }
     return(1);
 }
Esempio n. 12
0
 public static void EditStruct(ref Struct1 structToEdit)
 {
     structToEdit = new Struct1()
     {
         A = 10, B = 20
     };
 }
Esempio n. 13
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);
        }
    }
Esempio n. 14
0
        void SimConnect_OnRecvSimobjectDataBytype(SimConnect sender, SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE data)
        {
            switch ((DATA_REQUESTS)data.dwRequestID)
            {
            case DATA_REQUESTS.REQUEST_1:
                Struct1 s1 = (Struct1)data.dwData[0];

                //displayText("title: " + s1.title);
                //displayText("Lat:   " + s1.latitude);
                //displayText("Lon:   " + s1.longitude);
                //displayText("Alt:   " + s1.altitude);

                DisplayText("Heading:   " + s1.heading);
                mapCenter = new Location(s1.latitude, s1.longitude);
                myMap.SetView(mapCenter, 16, 0d);

                MapLayer.SetPosition(ImageLayer.FindChild <Image>(), mapCenter);
                RotateTransform rotateTransform = new RotateTransform(s1.heading);
                ImageLayer.FindChild <Image>().RenderTransform = rotateTransform;

                break;

            default:
                DisplayText("Unknown request ID: " + data.dwRequestID);
                break;
            }
        }
Esempio n. 15
0
    private static bool smethod_2(int int_1, string string_0, out string string_1)
    {
        bool flag;

        string_1 = "";
        IntPtr zero = IntPtr.Zero;

        try
        {
            string  s       = "20110401";
            Enum2   sUCCESS = Enum2.SUCCESS;
            Struct1 struct2 = new Struct1();
            sUCCESS = (Enum2)SDog.LIV_get_software_info(ref struct2);
            sUCCESS = (Enum2)SDog.LIV_open(0, int_1, ref zero);
            if (sUCCESS != Enum2.SUCCESS)
            {
                throw new Exception("打开加密狗失败! " + sUCCESS.ToString());
            }
            Struct0 struct3 = new Struct0();
            sUCCESS = (Enum2)SDog.LIV_get_hardware_info(zero, ref struct3);
            if (sUCCESS != Enum2.SUCCESS)
            {
                throw new Exception("获取加密狗信息失败! " + sUCCESS.ToString());
            }
            if (SDog.LIV_passwd(zero, 1, Encoding.UTF8.GetBytes(s)) != 0)
            {
                throw new Exception("加密狗信息无法验证! ");
            }
            byte[] buffer = new byte[0x200];
            if (SDog.LIV_read(zero, 0, buffer) != 0)
            {
                throw new Exception("从加密狗读取数据失败! ");
            }
            string str2  = Encoding.UTF8.GetString(buffer);
            int    index = str2.IndexOf('\0');
            str2 = str2.Substring(0, index);
            if (string_0 != str2.Trim())
            {
                throw new Exception("加密狗授权验证失败! ");
            }
            flag = true;
        }
        catch (Exception exception)
        {
            string_1 = exception.Message;
            flag     = false;
        }
        finally
        {
            try
            {
                SDog.LIV_close(zero);
            }
            catch
            {
            }
        }
        return(flag);
    }
Esempio n. 16
0
    public static int test_0_byte_equality_compater_devirt()
    {
        var dict = new Dictionary <byte, Struct1>();

        dict [1] = new Struct1();
        dict [1] = new Struct1();
        return(0);
    }
Esempio n. 17
0
    static void Main(string[] args)
    {
        IStruct s1 = new Struct1();
        IStruct s2 = new Struct2();

        EditStruct(ref s1);
        EditStruct(ref s2);
    }
Esempio n. 18
0
        void simconnect_OnRecvSimobjectDataBytype(SimConnect sender, SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE data)
        {
            switch ((DATA_REQUESTS)data.dwRequestID)
            {
            case DATA_REQUESTS.REQUEST_1:
                Struct1 s1 = (Struct1)data.dwData[0];


                bool   engines_on = s1.eng1_rpm > 5 || s1.eng2_rpm > 5 || s1.eng3_rpm > 56 || s1.eng4_rpm > 5 || s1.eng5_rpm > 5 || s1.eng6_rpm > 5;
                string e_on       = engines_on ? "1" : "0";

                string[] parts = new string[]
                {
                    s1.latitude.ToString(Eng).Replace(",", ".").Replace("#", ""),
                    s1.longitude.ToString(Eng).Replace(",", ".").Replace("#", ""),
                    s1.altitudemsl.ToString(Eng).Replace(",", ".").Replace("#", ""),
                    Math.Floor(s1.heading).ToString(Eng).Replace(",", ".").Replace("#", ""), // TODO - Heading
                    s1.airspeed_indicated.ToString(Eng).Replace(",", ".").Replace("#", ""),
                    s1.ac_pitch.ToString(Eng).Replace(",", ".").Replace("#", ""),
                    s1.ac_bank.ToString(Eng).Replace(",", ".").Replace("#", ""),
                    Math.Floor(s1.vspeed).ToString(Eng).Replace(",", ".").Replace("#", ""),    // TODO - Vspeed
                    "0",
                    Math.Round(s1.gforce, 2).ToString(Eng).Replace(",", ".").Replace("#", ""), // TODO - Gforce
                    s1.altitudeagl.ToString(Eng).Replace(",", ".").Replace("#", ""),
                    s1.on_ground.ToString(Eng).Replace(",", ".").Replace("#", ""),
                    s1.paused.ToString(Eng).Replace(",", ".").Replace("#", ""), /// Pause State
                    s1.title.ToString(Eng).Replace(",", "-").Replace("#", ""),
                    "",
                    s1.airspeed_true.ToString(Eng).Replace(",", ".").Replace("#", ""),
                    "",
                    s1.altitudeagl.ToString(Eng).Replace(",", ".").Replace("#", ""),
                    s1.zulu_time.ToString(Eng).Replace(",", ".").Replace("#", ""),
                    e_on,
                    s1.local_time.ToString(Eng).Replace(",", ".").Replace("#", ""),
                    (s1.fuel_total_weight * 0.453592).ToString(Eng).Replace(",", ".").Replace("#", ""),
                    s1.atcType.ToString(Eng).Replace(",", "-").Replace("#", "")
                };
                string payload = $"{string.Join("#", parts)}";

                var       scdata = Encoding.UTF8.GetBytes(payload);
                UdpClient client = new UdpClient();
                client.Send(scdata, scdata.Length, ip);
                client.Close();

                if (debugMode.Checked)
                {
                    debugOutput.AppendText("\r\n" + payload.Replace("#", ", "));
                }

                Console.WriteLine(payload);
                break;

            default:
                Console.WriteLine("Unknown request ID: " + data.dwRequestID);
                break;
            }
        }
Esempio n. 19
0
        public void SimpleTestStruct()
        {
            Struct1 s = Mapper.Map <Struct2, Struct1>(new Struct2()
            {
                fld = 13
            });

            Assert.AreEqual(13, s.fld);
        }
    private static void ValidateAndAssignValue(ref Struct1 val)
    {
        if (val.a != 0 || val.b != 0)
        {
            throw new Exception("val was expected to be zero");
        }

        val.a = 42;
        val.b = 43;
    }
Esempio n. 21
0
        public void SimpleTestStruct()
        {
            var mapper = Context.objMan.GetMapper <Struct2, Struct1>();
            //DynamicAssemblyManager.SaveAssembly();
            Struct1 s = mapper.Map(new Struct2()
            {
                fld = 13
            });

            Assert.AreEqual(13, s.fld);
        }
Esempio n. 22
0
        private void calculator(object struct1)
        {
            double  result      = 0;
            Struct1 struct2     = (Struct1)struct1;
            double  start       = struct2.start;
            double  end         = struct2.end;
            int     countN      = struct2.countN;
            int     countThread = struct2.countThread;

            results[countThread] = threadCalc(start, end, countN);
        }
Esempio n. 23
0
        private static void Main()
        {
            Struct1 s11;

            s11.s = "foobar";
            Struct1 s12 = s11;

            s12.s = "foobaz";
            Console.WriteLine("s11.s = " + s11.s);
            Console.WriteLine("s12.s = " + s12.s);
        }
Esempio n. 24
0
 private int method_1(ref Struct3 logFont, ref Struct1 textMetric, uint fontType, int lParam)
 {
     if ((fontType & 4U) > 0U)
     {
         string string0 = logFont.class49_0.string_0;
         if (!this.idictionary_0.ContainsKey(string0))
         {
             this.idictionary_0.Add(string0, string.Empty);
         }
     }
     return(1);
 }
    public static void TestStruct()
    {
        Struct1 val = default;
        int     i   = 0;

        do
        {
            val.a = 0;
            val.b = 0;
            ValidateAndAssignValue(ref val);
        }while (i++ < 2);
    }
Esempio n. 26
0
        public void StructTest()
        {
            byte[] testb =
            {
                121,
                111,
                117,
                32,
                99,
                97,
                110,
                39,
                116,
                32,
                114,
                101,
                97,
                100,
                32,
                116,
                104,
                105,
                115,
                33
            };

            var str1 = new Struct1();

            str1.mi   = 34567;
            str1.ms   = "another test string";
            str1.mb   = true;
            str1.md   = 8765.123;
            str1.mdt  = new DateTime(2002, 7, 6, 11, 25, 37);
            str1.mb64 = testb;
            str1.ma   = new[] {
                1,
                2,
                3,
                4,
                5
            };
            var xdoc = Utils.Serialize("SerializeTest.testStruct",
                                       str1,
                                       Encoding.UTF8, MappingAction.Ignore);
            Type parsedType, parsedArrayType;
            var  obj = Utils.Parse(xdoc, typeof(Struct1), MappingAction.Error,
                                   out parsedType, out parsedArrayType);

            Assert.IsTrue(obj is Struct1, "result is Struct1");
            var str2 = (Struct1)obj;

            Assert.IsTrue(str2.Equals(str1));
        }
Esempio n. 27
0
        static void Main(string[] args)
        {
            Class1 P1 = new Class1("Naruto", 30);
            Class1 P2 = new Class1("Naruto", 30);


            Struct1 P3 = new Struct1("Sasuke", 30);
            Struct1 P4 = new Struct1("Sasuke", 30);

            System.Console.WriteLine(Equals(P1, P2));
            System.Console.WriteLine(Equals(P3, P4));
        }
        void simconnect_OnRecvSimobjectDataBytype(SimConnect sender, SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE data)
        {
            switch ((DATA_REQUESTS)data.dwRequestID)
            {
            case DATA_REQUESTS.REQUEST_1:
                Struct1 s1 = (Struct1)data.dwData[0];
                updatePresence(s1.title, s1.altitude, s1.speed);
                break;

            default:
                break;
            }
        }
Esempio n. 29
0
    static int test_0_amd64_dyncall_use_stack_struct()
    {
        Struct1 s = new Struct1();

        s.a = 10.0f;
        s.b = 11.0f;
        var res = (Struct1)typeof(Foo2 <Struct1>).GetMethod("Get_T2").Invoke(null, new object [] { 1.0f, 2, 3, 4, 5, 6, 7, 8, 9, s });

        if (res.a != s.a || res.b != s.b)
        {
            return(1);
        }
        return(0);
    }
Esempio n. 30
0
 public void Deserialize(Deserializer deserializer)
 {
     this.Unknown0 = deserializer.ReadVarint();
     byte unknown4Length = deserializer.ReadByte();
     if (unknown4Length > 31)
     {
         throw new InvalidDataException();
     }
     Unknown4 = new Struct1[unknown4Length];
     for (int i = 0; i < Unknown4.Length; i++)
     {
         Unknown4[i] = new Struct1();
     }
 }
Esempio n. 31
0
        void simconnect_OnRecvSimobjectDataBytype(SimConnect sender, SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE data)
        {
            switch ((DATA_REQUESTS)data.dwRequestID)
            {
            case DATA_REQUESTS.REQUEST_1:
                Struct1 s1 = (Struct1)data.dwData[0];     //  monta a string s1 para enviar aos textbox

                // displayText("Title: " + s1.title);
                //displayText("Lat:   " + s1.latitude);
                //displayText("Lon:   " + s1.longitude);
                //displayText("Alt:   " + s1.altitude);

                //TextBox1("" + s1.x);
                //TextBox2("" + s1.x);
                //TextBox3("" + s1.y);
                //TextBox3("B" + s1.b);

                // P é o movimento do profundor pitch
                if (s1.a >= 0)
                {
                    TextBox1("P" + s1.a);
                    serialPort1.WriteLine("P" + s1.a);
                }

                if (s1.a <= 0)
                {
                    TextBox1("P" + s1.a);
                    serialPort1.WriteLine("P" + s1.a);
                }

                // A é o movimento do aileron pitch
                if (s1.b >= 0)
                {
                    TextBox2("A" + s1.b);
                    serialPort1.WriteLine("A" + s1.b);
                }

                if (s1.b <= 0)
                {
                    TextBox2("A" + s1.b);
                    serialPort1.WriteLine("A" + s1.b);
                }

                break;

            default:
                displayText("Unknown request ID: " + data.dwRequestID);
                break;
            }
        }
Esempio n. 32
0
    static void Main(string[] args)
    {
        var x = new Struct1()
        {
            A = 0, B = -10
        };
        var y = new Struct2()
        {
            C = 0, D = -10
        };

        MyFunction(ref x);
        MyFunction(ref y);
    }
Esempio n. 33
0
    void testInterface(Logger l)
    {
        l.Function = "testInterface";
        try {
            Context c = new Context(Context.test_kind.NORMAL);
            XTest obj = S1.create1(c);
            bool aBool = true;
            byte aByte = 0xff;
            short aShort =   0x7fff;
            ushort aUShort =   0xffff;
            int aInt  = 0x7fffffff;
            uint aUInt = 0xffffffff;
            long aLong = 0x7fffffffffffffff;
            ulong aULong = 0xffffffffffffffff;
            float aFloat = 0.314f;
            double aDouble = 0.314d;
            char aChar  = 'A';
            string aString = "Hello World";
            Type aType = typeof(XTest);
            Any aAny = new Any(typeof(XTest), obj);
            Enum2 aEnum2 = Enum2.VALUE2;
            Struct1 aStruct1 = new Struct1();
            object aXInterface = new object();
            ucss.lang.XComponent aXComponent = (ucss.lang.XComponent) obj;
            bool[] aSeqBool = {true, false, true};
            
            obj.inParameters(aBool, aByte, aShort, aUShort,
                             aInt, aUInt, aLong, aULong,
                             aFloat, aDouble, aChar, aString,
                             aType, aAny,aEnum2, aStruct1,
                             aXInterface, aXComponent, aSeqBool);

            bool outBool;
            byte outByte;
            short outShort;
            ushort outUShort;
            int outInt;
            uint outUInt;
            long outLong;
            ulong outULong;
            float outFloat;
            double outDouble;
            char outChar;
            string outString;
            Type outType;
            Any outAny;
            Enum2 outEnum2;
            Struct1 outStruct1;
            object outXInterface;
            ucss.lang.XComponent outXComponent;
            bool[] outSeqBool;

            obj.outParameters(out outBool, out outByte, out  outShort, out outUShort,
                              out outInt, out outUInt, out outLong, out outULong,
                              out outFloat, out outDouble, out outChar, out outString,
                              out outType, out outAny, out outEnum2, out outStruct1,
                              out outXInterface, out outXComponent, out outSeqBool);

            l.assure(aBool == outBool);
            l.assure(aByte == outByte);
            l.assure(aShort == outShort);
            l.assure(aUShort == outUShort);
            l.assure(aInt == outInt);
            l.assure(aUInt == outUInt);
            l.assure(aLong == outLong);
            l.assure(aULong == outULong);
            l.assure(aFloat == outFloat);
            l.assure(aDouble == outDouble);
            l.assure(aChar == outChar);
            l.assure(aString == outString);
            l.assure(aType == outType);
            l.assure(aAny.Equals(outAny));
            l.assure(aEnum2 == outEnum2);
            l.assure(aStruct1 == outStruct1);
            l.assure(aXInterface == outXInterface);
            l.assure(aXComponent == outXComponent);
            l.assure(aSeqBool == outSeqBool);

            bool inoutBool = false;
            byte inoutByte = 10;
            short inoutShort = 11;
            ushort inoutUShort = 12;
            int inoutInt = 13;
            uint inoutUInt = 14;
            long inoutLong = 15;
            ulong inoutULong = 16;
            float inoutFloat = 4.134f;
            double inoutDouble = 5.135;
            char inoutChar = 'B';
            string inoutString =  "Hello Hamburg";
            Type inoutType = typeof(int);
            Any inoutAny = new Any(inoutInt);
            Enum2 inoutEnum2 = Enum2.VALUE4;
            Struct1 inoutStruct1 = new Struct1();
            object inoutXInterface = new object();
            ucss.lang.XComponent inoutXComponent = (ucss.lang.XComponent) S1.create1(c);
            bool[] inoutSeqBool = {false, true, false};


            obj.inoutParameters(ref inoutBool, ref inoutByte, ref inoutShort, ref inoutUShort,
                                ref inoutInt, ref inoutUInt, ref inoutLong, ref inoutULong,
                                ref inoutFloat, ref inoutDouble, ref inoutChar, ref inoutString,
                                ref inoutType, ref inoutAny, ref inoutEnum2, ref inoutStruct1,
                                ref inoutXInterface, ref inoutXComponent, ref inoutSeqBool);
				
            l.assure(aBool == inoutBool);
            l.assure(aByte == inoutByte);
            l.assure(aShort == inoutShort);
            l.assure(aUShort == inoutUShort);
            l.assure(aInt == inoutInt);
            l.assure(aUInt == inoutUInt);
            l.assure(aLong == inoutLong);
            l.assure(aULong == inoutULong);
            l.assure(aFloat == inoutFloat);
            l.assure(aDouble == inoutDouble);
            l.assure(aChar == inoutChar);
            l.assure(aString == inoutString);
            l.assure(aType == inoutType);
            l.assure(aAny.Equals(inoutAny));
            l.assure(aEnum2 == inoutEnum2);
            l.assure(aStruct1 == inoutStruct1);
            l.assure(aXInterface == inoutXInterface);
            l.assure(aXComponent == inoutXComponent);
            l.assure(aSeqBool == inoutSeqBool);


            //now check the return values
            obj.inParameters(aBool, aByte, aShort, aUShort,
                             aInt, aUInt, aLong, aULong,
                             aFloat, aDouble, aChar, aString,
                             aType, aAny,aEnum2, aStruct1,
                             aXInterface, aXComponent, aSeqBool);

            l.assure(obj.retBoolean() == aBool);
            l.assure(obj.retByte() == aByte);
            l.assure(obj.retShort() == aShort);
            l.assure(obj.retUShort() == aUShort);
            l.assure(obj.retLong() == aInt);
            l.assure(obj.retULong() == aUInt);
            l.assure(obj.retHyper() == aLong);
            l.assure(obj.retUHyper() == aULong);
            l.assure(obj.retFloat() == aFloat);
            l.assure(obj.retDouble() == aDouble);
            l.assure(obj.retChar() == aChar);
            l.assure(obj.retString() == aString);
            l.assure(obj.retType() == aType);
            l.assure(obj.retAny().Equals(aAny));
            l.assure(obj.retEnum() == aEnum2);
            l.assure(obj.retStruct1() == aStruct1);
            l.assure(obj.retXInterface() == aXInterface);
            l.assure(obj.retXComponent() == aXComponent);
            l.assure(obj.retSeqBool() == aSeqBool);


            obj = S1.create1(c);
            obj.attrBoolean = true;
            l.assure(obj.attrBoolean == true);
            obj.attrByte = aByte;
            l.assure(obj.attrByte == aByte);
            obj.attrShort = aShort;
            l.assure(obj.attrShort == aShort);
            obj.attrUShort = aUShort;
            l.assure(obj.attrUShort == aUShort);
            obj.attrLong = aInt;
            l.assure(obj.attrLong == aInt);
            obj.attrULong = aUInt;
            l.assure(obj.attrULong == aUInt);
            obj.attrHyper = aLong;
            l.assure(obj.attrHyper == aLong);
            obj.attrUHyper = aULong;
            l.assure(obj.attrUHyper == aULong);
            obj.attrFloat = aFloat;
            l.assure(obj.attrFloat == aFloat);
            obj.attrDouble = aDouble;
            l.assure(obj.attrDouble == aDouble);
            obj.attrChar = aChar;
            l.assure(obj.attrChar == aChar);
            obj.attrString = aString;
            l.assure(obj.attrString == aString);
            obj.attrType = aType;
            l.assure(obj.attrType == aType);
            obj.attrAny = aAny;
            l.assure(obj.attrAny.Equals(aAny));
            obj.attrEnum2 = aEnum2;
            l.assure(obj.attrEnum2 == aEnum2);
            obj.attrStruct1 = aStruct1;
            l.assure(obj.attrStruct1 == aStruct1);
            obj.attrXInterface = aXInterface;
            l.assure(obj.attrXInterface == aXInterface);
            obj.attrXComponent = aXComponent;
            l.assure(obj.attrXComponent == aXComponent);
            obj.attrSeqBoolean = aSeqBool;
            l.assure(obj.attrSeqBoolean == aSeqBool);
        } catch (Exception )
        {
            l.assure(false);
        }
    }
Esempio n. 34
0
 public void StructTest()
 {
   byte[] testb = new Byte[] 
   {
     121, 111, 117, 32, 99, 97, 110, 39, 116, 32, 114, 101, 97, 100, 
     32, 116, 104, 105, 115, 33 
   }; 
   
   Struct1 str1 = new Struct1();
   str1.mi = 34567;
   str1.ms = "another test string";
   str1.mb = true;
   str1.md = 8765.123;
   str1.mdt = new DateTime(2002, 7, 6, 11, 25, 37);
   str1.mb64 = testb;
   str1.ma = new int[] { 1, 2, 3, 4, 5 };
   XmlDocument xdoc = Utils.Serialize("SerializeTest.testStruct", 
     str1, 
     Encoding.UTF8, MappingAction.Ignore);
   Type parsedType, parsedArrayType;    
   object obj = Utils.Parse(xdoc, typeof(Struct1), MappingAction.Error, 
     out parsedType, out parsedArrayType);
   Assert.IsTrue(obj is Struct1, "result is Struct1");
   Struct1 str2 = (Struct1)obj;
   Assert.IsTrue(str2.Equals(str1));
 }  
    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");
    }
Esempio n. 36
0
 public bool Equals(Struct1 str)
 {
   if (mi != str.mi || ms != str.ms || md != str.md || mdt != str.mdt)
     return false;
   if (mb64.Length != str.mb64.Length)
     return false;
   for (int i = 0; i < mb64.Length; i++)
     if (mb64[i] != str.mb64[i])
       return false;
   for (int i = 0; i < ma.Length; i++)
     if (ma[i] != str.ma[i])
       return false;
   return true;
 }
		public void WhenALoggerWritesToTheSinkItStoresTheCorrectTypesForStructure()
		{
			var storageAccount = CloudStorageAccount.DevelopmentStorageAccount;
			var tableClient = storageAccount.CreateCloudTableClient();
			var table = tableClient.GetTableReference("LogEventEntity");

			table.DeleteIfExists();

			var logger = new LoggerConfiguration()
				.WriteTo.AzureTableStorageWithProperties(storageAccount)
				.CreateLogger();

			var struct1 = new Struct1
			{
				IntVal = 10,
				StringVal = "ABCDE"
			};

			var struct2 = new Struct2
			{
				DateTimeVal = new DateTime(2014, 12, 3, 17, 37, 12),
				DoubleVal = Math.PI
			};

			var struct0 = new Struct0
			{
				Struct1Val = struct1,
				Struct2Val = struct2
			};

			logger.Information("{@Struct0}", struct0);
			var result = table.ExecuteQuery(new TableQuery().Take(1)).First();

			Assert.AreEqual("Struct0 { Struct1Val: Struct1 { IntVal: 10, StringVal: \"ABCDE\" }, Struct2Val: Struct2 { DateTimeVal: 12/03/2014 17:37:12, DoubleVal: 3.14159265358979 } }", result.Properties["Struct0"].StringValue);
		}
    public float Foo(ref Struct1 r, double v, ulong t, ref ulong tr) {
        float ret;

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

        if (values != "-1.96436844951191E+18 57 2826742804614237570 " +
            "2826742804614237570 .")
        {
            Console.WriteLine("float Foo(...): unexpected values: " + values);
            Fail(18);
        }

        r.Randomize();
        tr += (ulong)Randomizer();
        ret = (float)Randomizer();
        return ret;
    }
    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());
    }
Esempio n. 40
0
    public void testS1(Logger l) {
        l.Function = "testS1";
        object obj = new Object();
        ucss.uno.RuntimeException excRuntime =
            new ucss.uno.RuntimeException("RuntimeException", obj);
        ucss.uno.Exception excException =
            new ucss.uno.Exception("Exception", obj);
        ucss.lang.IllegalAccessException excIllegalAccess =
            new ucss.lang.IllegalAccessException("IllegalAccessException", obj);
        ucss.uno.DeploymentException excDeployment =
            new ucss.uno.DeploymentException("DeploymentException", obj);
        ucss.lang.InvalidListenerException excInvalidListener =
            new ucss.lang.InvalidListenerException("ListenerException", obj);
        
        /* create1 does not specify exceptions. Therefore RuntimeExceptions
           fly through and other exceptions cause a DeploymentException.
        */            
        try {
            S1.create1(new Context(Context.test_kind.TEST_EXCEPTION, excRuntime));
        } catch (ucss.uno.RuntimeException e) {
            l.assure(e.Message == excRuntime.Message
                     && e.Context == obj);
        } catch (System.Exception) {
            l.assure(false);
        }

        Context c = new Context(Context.test_kind.TEST_EXCEPTION, excException); 
        try {
            S1.create1(c);
        } catch (ucss.uno.DeploymentException e) {
            //The message of the original exception should be contained
            // in the Deploymentexception
            l.assure(e.Message.IndexOf(excException.Message) != -1 && e.Context == c);
        } catch (System.Exception) {
            l.assure(false);
        }

        /* create2 specifies many exceptions, including RuntimeException and Exception.
           Because Exception is specified all exceptions are allowed, hence all thrown
           exceptions fly through.
         */
        try {
            S1.create2(new Context(Context.test_kind.TEST_EXCEPTION, excRuntime));
        } catch (ucss.uno.RuntimeException e) {
            l.assure(e.Message == excRuntime.Message
                     && e.Context == obj);
        } catch (System.Exception) {
            l.assure(false);
        }

        try {
            S1.create2(new Context(Context.test_kind.TEST_EXCEPTION, excIllegalAccess));
        } catch (ucss.lang.IllegalAccessException e) {
            l.assure(e.Message == excIllegalAccess.Message
                     && e.Context == obj);
        } catch (System.Exception) {
            l.assure(false);
        }

        try {
            S1.create2(new Context(Context.test_kind.TEST_EXCEPTION, excException));
        } catch (ucss.uno.Exception e) {
            l.assure(e.Message == excException.Message
                     && e.Context == obj);
        } catch (System.Exception) {
            l.assure(false);
        }

        /* create3 specifies exceptions but no com.sun.star.uno.Exception. RuntimeException
           and derived fly through. Other specified exceptions are rethrown and all other
           exceptions cause a DeploymentException.
        */
        try {
            S1.create3(new Context(Context.test_kind.TEST_EXCEPTION, excDeployment),
                       new Any[]{});
        } catch (ucss.uno.DeploymentException e) {
            l.assure(e.Message == excDeployment.Message
                     && e.Context == obj);
        } catch (System.Exception) {
            l.assure(false);
        }

        try {
            S1.create3(new Context(Context.test_kind.TEST_EXCEPTION, excIllegalAccess),
                       new Any[0]);
        } catch (ucss.lang.IllegalAccessException e) {
            l.assure(e.Message == excIllegalAccess.Message
                     && e.Context == obj);
        } catch (System.Exception) {
            l.assure(false);
        }

        c = new Context(Context.test_kind.TEST_EXCEPTION, excInvalidListener);
        try {
            S1.create3(c, new Any[0]);
        } catch (ucss.uno.DeploymentException e) {
            l.assure(e.Message.IndexOf(excInvalidListener.Message) != -1
                     && e.Context == c);
        } catch (System.Exception) {
            l.assure(false);
        }

        /* test the case when the context cannot provide a service manager.
         */
        try {
            S1.create2(new Context(Context.test_kind.NO_FACTORY));
        } catch (ucss.uno.DeploymentException e) {
            l.assure(e.Message.Length > 0);
        } catch (System.Exception) {
            l.assure(false);
        }

        /* When the service manager returns a null pointer then a DeploymentException
         * is to be thrown.
         */
        try {
            S1.create2(new Context(Context.test_kind.CREATION_FAILED));
        } catch (ucss.uno.DeploymentException e) {
            l.assure(e.Message.Length > 0);
        } catch (System.Exception) {
            l.assure(false);
        }


        /** Test creation of components and if the passing of parameters works.
         */
        c = new Context(Context.test_kind.NORMAL);
        try {
            XTest xTest = S1.create1(c);
            Component cobj = (Component) xTest;
            l.assure(cobj.Args[0].Value == c);

            Any a1 = new Any("bla");
            Any a2 = new Any(3.14f);
            Any a3 = new Any(3.145d);
            xTest = S1.create2(c, a1, a2, a3);
            cobj = (Component) xTest;
            l.assure(cobj.Args[0].Value == c
                     && a1.Equals(cobj.Args[1])
                     && a2.Equals(cobj.Args[2])
                     && a3.Equals(cobj.Args[3]));

            bool b1 = true;
            byte b2 = 1;
            short b3 = 2;
            ushort b4 = 3;
            int b5 = 4;
            uint b6 = 5;
            long b7 = 6;
            ulong b8 = 7;
            float b9 = 0.8f;
            double b10 = 0.9;
            char b11 = 'A';
            string b12 = "BCD";
            Type b13 = typeof(ulong);
            Any b14 = new Any(22);
            Enum2 b15 = Enum2.VALUE4;
            Struct1 b16 = new Struct1(1);
            PolyStruct b17 = new PolyStruct('A', 1);
            PolyStruct b18 = new PolyStruct(new Any(true), 1);
            object b19 = new uno.util.WeakComponentBase();
            ucss.lang.XComponent b20 = (ucss.lang.XComponent) b19;
            bool b21 = b1;
            byte b22 = b2;
            short b23 = b3;
            ushort b24 = b4;
            int b25 = b5;
            uint b26 = b6;
            long b27 = b7;
            ulong b28 = b8;
            float b29 = b9;
            double b30 = b10;
            char b31 = b11;
            string b32 = b12;
            Type b33 = b13;
            Any b34 = b14;
            Enum2 b35 = b15;
            Struct1 b36 = b16;
            object b37 = b19;
            ucss.lang.XComponent b38 = b20;
            bool[] b39 = new bool[] { false, true };
            byte[] b40 = new byte[] { (byte) 1, (byte) 2 };
            short[] b41 = new short[] { (short) 123, (short) 456};
            ushort[] b42 = new ushort[] { (ushort) 789, (ushort) 101};
            int[] b43 = new int[] {1, 2, 3};
            uint[] b44 = new uint[] {4, 5, 6};
            long[] b45 = new long[] {7,8,9};
            ulong[] b46 = new ulong[] {123, 4356};
            float[] b47 = new float[] {2435f,87f};
            double[] b48 = new double[] {234d,45.2134d};
            char[] b49 = new char[] {'\u1234', 'A'};
            string[] b50 = new string[] {"a","bc"};
            Type[] b51 = new Type[] {typeof(int), typeof(long)};
            Any[] b52 = new Any[] {new Any(1), new Any("adf")};
            Enum2[] b53 = new Enum2[] {Enum2.VALUE2};
            Struct1[] b54 = new Struct1[] {new Struct1(11), new Struct1(22)};
            object[] b55 = new object[0];
            ucss.lang.XComponent[] b56 = new ucss.lang.XComponent[]{
                new uno.util.WeakComponentBase(), new uno.util.WeakComponentBase()};
            bool[][] b57 = new bool[][] {new bool[]{true,false}, new  bool[] {true}};
            byte[][] b58 = new byte[][]{new byte[] {(byte) 1}, new byte[]{(byte) 2}};
            short[][] b59 = new short[][] {new short[]{(short)6, (short)7}, new short[] {(short)9}};
            ushort[][] b60 = new ushort[][] { new ushort[]{(ushort) 11}};
            int[][] b61 = new int[][] {new int[]{1}, new int[]{2,3}, new int[]{4,5,6}};
            uint[][] b62 = new uint[][] {new uint[]{10U}, new uint[]{20U,30U}, new uint[]{40U,50U,60}};
            long[][] b63 = new long[][] {new long[]{10L}, new long[]{20L,30}, new long[]{40,50,60}};
            ulong[][] b64 = new ulong[][] { new ulong[]{10L}, new ulong[]{20L, 30L}, new ulong[]{40,50,60}};
            float[][] b65 = new float[][] {new float[]{10f}, new float[]{20f,30f}, new float[]{40f,50f,60f}};
            double[][] b66 = new double[][]{new double[]{10d}, new double[]{20d,30d}};
            char[][] b67 = new char[][] {new char[]{'a'}, new char[]{'b', 'c'}};
            string[][] b68 = new String[][] {new string[]{"a"}, new string[]{"ad", "lkj"}};
            Type[][] b69 = new Type[][] {new Type[]{typeof(byte), typeof(long)}, new Type[]{typeof(Any)}};
            Any[][] b70 = new Any[][] {new Any[]{new Any(1f), new Any(2d)}, new Any[]{new Any(34U)}};
            Enum2[][] b71 = new Enum2[][] {new Enum2[]{Enum2.VALUE2}};
            Struct1[][] b72 = new Struct1[][] {new Struct1[]{new Struct1(2), new Struct1(3)}};
            object[][] b73 =  new Object[0][];
            ucss.lang.XComponent[][] b74 = new uno.util.WeakComponentBase[0][];
            bool[][] b75 = b57;
            byte[][] b76 = b58;
            short[][] b77 = b59;
            ushort[][] b78 = b60;
            int[][] b79 = b61;
            uint[][] b80 = b62;
            long[][] b81 = b63;
            ulong[][] b82 = b64;
            float[][] b83 = b65;
            double[][] b84 = b66;
            char[][] b85 = b67;
            String[][] b86 = b68;
            Type[][] b87 =b69;
            Any[][] b88 = b70;
            Enum2[][] b89 = b71;
            Struct1[][] b90 = b72;
            Object[][] b91 = b73;
            ucss.lang.XComponent[][] b92 = b74;

            xTest = S1.create5(
                c,
                b1, b2, b3, b4, b5, b6, b7 ,b8, b9, b10,
                b11, b12, b13,
                b14,
                b15, b16, b17, b18, b19, b20,
                b21, b22, b23, b24, b25, b26, b27, b28, b29, b30,
                b31, b32, b33,
                b34,
                b35, b36, b37, b38, b39, b40,
                b41, b42, b43, b44, b45, b46, b47, b48, b49, b50,
                b51, b52, b53, b54, b55, b56, b57, b58, b59, b60,
                b61, b62, b63, b64, b65, b66, b67, b68, b69, b70,
                b71, b72, b73, b74, b75, b76, b77, b78, b79, b80,
                b81, b82, b83, b84, b85, b86, b87, b88, b89, b90,
                b91, b92
                 );

            cobj = (Component) xTest;
            l.assure(cobj.Args[0].Value == c);
            l.assure(b1.Equals(cobj.Args[1].Value));
            l.assure(b2.Equals(cobj.Args[2].Value));
            l.assure(b3.Equals(cobj.Args[3].Value));
            l.assure(b4.Equals(cobj.Args[4].Value));
            l.assure(b5.Equals(cobj.Args[5].Value));
            l.assure(b6.Equals(cobj.Args[6].Value));
            l.assure(b7.Equals(cobj.Args[7].Value));
            l.assure(b8.Equals(cobj.Args[8].Value));
            l.assure(b9.Equals(cobj.Args[9].Value));
            l.assure(b10.Equals(cobj.Args[10].Value));
            l.assure(b11.Equals(cobj.Args[11].Value));
            l.assure(b12.Equals(cobj.Args[12].Value));
            l.assure(b13.Equals(cobj.Args[13].Value));
			//Anys are not wrapped by the generated code
            l.assure(b14.Equals(cobj.Args[14]));
            l.assure(b15.Equals(cobj.Args[15].Value));
            l.assure(b16.Equals(cobj.Args[16].Value));
            l.assure(b17.Equals(cobj.Args[17].Value));
            l.assure(b18.Equals(cobj.Args[18].Value));
            l.assure(b19.Equals(cobj.Args[19].Value));
            l.assure(b20.Equals(cobj.Args[20].Value));
            l.assure(b21.Equals(cobj.Args[21].Value));
            l.assure(b22.Equals(cobj.Args[22].Value));
            l.assure(b23.Equals(cobj.Args[23].Value));
            l.assure(b24.Equals(cobj.Args[24].Value));
            l.assure(b25.Equals(cobj.Args[25].Value));
            l.assure(b26.Equals(cobj.Args[26].Value));
            l.assure(b27.Equals(cobj.Args[27].Value));
            l.assure(b28.Equals(cobj.Args[28].Value));
            l.assure(b29.Equals(cobj.Args[29].Value));
            l.assure(b30.Equals(cobj.Args[30].Value));
            l.assure(b31.Equals(cobj.Args[31].Value));
            l.assure(b32.Equals(cobj.Args[32].Value));
            l.assure(b33.Equals(cobj.Args[33].Value));
			//Anys are not wrapped by the generated code
            l.assure(b34.Equals(cobj.Args[34]));
            l.assure(b35.Equals(cobj.Args[35].Value));
            l.assure(b36.Equals(cobj.Args[36].Value));
            l.assure(b37.Equals(cobj.Args[37].Value));
            l.assure(b38.Equals(cobj.Args[38].Value));
            l.assure(b39.Equals(cobj.Args[39].Value));
            l.assure(b40.Equals(cobj.Args[40].Value));
            l.assure(b41.Equals(cobj.Args[41].Value));
            l.assure(b42.Equals(cobj.Args[42].Value));
            l.assure(b43.Equals(cobj.Args[43].Value));
            l.assure(b44.Equals(cobj.Args[44].Value));
            l.assure(b45.Equals(cobj.Args[45].Value));
            l.assure(b46.Equals(cobj.Args[46].Value));
            l.assure(b47.Equals(cobj.Args[47].Value));
            l.assure(b48.Equals(cobj.Args[48].Value));
            l.assure(b49.Equals(cobj.Args[49].Value));
            l.assure(b50.Equals(cobj.Args[50].Value));
            l.assure(b51.Equals(cobj.Args[51].Value));
            l.assure(b52.Equals(cobj.Args[52].Value));
            l.assure(b53.Equals(cobj.Args[53].Value));
            l.assure(b54.Equals(cobj.Args[54].Value));
            l.assure(b55.Equals(cobj.Args[55].Value));
            l.assure(b56.Equals(cobj.Args[56].Value));
            l.assure(b57.Equals(cobj.Args[57].Value));
            l.assure(b58.Equals(cobj.Args[58].Value));
            l.assure(b59.Equals(cobj.Args[59].Value));
            l.assure(b60.Equals(cobj.Args[60].Value));
            l.assure(b61.Equals(cobj.Args[61].Value));
            l.assure(b62.Equals(cobj.Args[62].Value));
            l.assure(b63.Equals(cobj.Args[63].Value));
            l.assure(b64.Equals(cobj.Args[64].Value));
            l.assure(b65.Equals(cobj.Args[65].Value));
            l.assure(b66.Equals(cobj.Args[66].Value));
            l.assure(b67.Equals(cobj.Args[67].Value));
            l.assure(b68.Equals(cobj.Args[68].Value));
            l.assure(b69.Equals(cobj.Args[69].Value));
            l.assure(b70.Equals(cobj.Args[70].Value));
            l.assure(b71.Equals(cobj.Args[71].Value));
            l.assure(b72.Equals(cobj.Args[72].Value));
            l.assure(b73.Equals(cobj.Args[73].Value));
            l.assure(b74.Equals(cobj.Args[74].Value));
            l.assure(b75.Equals(cobj.Args[75].Value));
            l.assure(b76.Equals(cobj.Args[76].Value));
            l.assure(b77.Equals(cobj.Args[77].Value));
            l.assure(b78.Equals(cobj.Args[78].Value));
            l.assure(b79.Equals(cobj.Args[79].Value));
            l.assure(b80.Equals(cobj.Args[80].Value));
            l.assure(b81.Equals(cobj.Args[81].Value));
            l.assure(b82.Equals(cobj.Args[82].Value));
            l.assure(b83.Equals(cobj.Args[83].Value));
            l.assure(b84.Equals(cobj.Args[84].Value));
            l.assure(b85.Equals(cobj.Args[85].Value));
            l.assure(b86.Equals(cobj.Args[86].Value));
            l.assure(b87.Equals(cobj.Args[87].Value));
            l.assure(b88.Equals(cobj.Args[88].Value));
            l.assure(b89.Equals(cobj.Args[89].Value));
            l.assure(b90.Equals(cobj.Args[90].Value));
            l.assure(b91.Equals(cobj.Args[91].Value));
            l.assure(b92.Equals(cobj.Args[92].Value));

        } catch (Exception) {
            l.assure(false);
        }

        //test
        c = new Context(Context.test_kind.NORMAL);
        try {
            
            PolyStruct2 arg1 = new PolyStruct2(typeof(PolyStruct2), 1);
            PolyStruct2 arg2 = new PolyStruct2(new Any(true), 1);
            PolyStruct2 arg3 = new PolyStruct2(true, 1);
            PolyStruct2 arg4 = new PolyStruct2((Byte)8, 1);
            PolyStruct2 arg5 = new PolyStruct2('c', 1);
            PolyStruct2 arg6 = new PolyStruct2((Int16)10, 1);
            PolyStruct2 arg7 = new PolyStruct2(11, 1);
            PolyStruct2 arg8 = new PolyStruct2(12L, 1);
            PolyStruct2 arg9 = new PolyStruct2("Hello", 1);
            PolyStruct2 arg10 = new PolyStruct2(1.3, 1);
            PolyStruct2 arg11 = new PolyStruct2(1.3d, 1);
            PolyStruct2 arg12 = new PolyStruct2(new Object(), 1);
            PolyStruct2 arg13 = new PolyStruct2(new uno.util.WeakComponentBase(), 1);
            PolyStruct2 arg14 = new PolyStruct2(
                new PolyStruct('A', 1), 1);
            PolyStruct2 arg15 = new PolyStruct2(
                new PolyStruct(new PolyStruct('A',1),1),1);
            PolyStruct arg16 = new PolyStruct("Hallo", 1);
            PolyStruct arg17 = new PolyStruct(
                new PolyStruct('A',1),1);

            Type[] arType = {typeof(PolyStruct), typeof(PolyStruct2)};
            PolyStruct2 arg101 = new PolyStruct2(arType,1);
            PolyStruct2 arg102 = new PolyStruct2(
                new Any[] {new Any(true)},1);
            PolyStruct2 arg103 = new PolyStruct2(new bool[]{true}, 1);
            PolyStruct2 arg104 = new PolyStruct2(new byte[] { (byte) 1}, 1);
            PolyStruct2 arg105 = new PolyStruct2(new char[] {'\u1234', 'A'}, 1);
            PolyStruct2 arg106 = new PolyStruct2(new short[] {(short)1}, 1);
            PolyStruct2 arg107 = new PolyStruct2(new int[] {1}, 1);
            PolyStruct2 arg108 = new PolyStruct2(new long[] {1}, 1);
            PolyStruct2 arg109 = new PolyStruct2(new string[]{"Hallo"}, 1);
            PolyStruct2 arg110 = new PolyStruct2(new float[]{1.3f}, 1);
            PolyStruct2 arg111 = new PolyStruct2(new double[] {1.3d}, 1);
            PolyStruct2 arg112 = new PolyStruct2(
                new Object[] { new Object()}, 1);
            PolyStruct2 arg113 = new PolyStruct2(
                new uno.util.WeakComponentBase[] {
                    new uno.util.WeakComponentBase()}, 1);
            PolyStruct2 arg114 = new PolyStruct2(
                new PolyStruct[]{
                new PolyStruct('A',1)} ,1);
            PolyStruct2 arg115 = new PolyStruct2(
                new PolyStruct[] {
                new PolyStruct( new PolyStruct2('A',1),1)}
                ,1);
            PolyStruct2 arg201 = new PolyStruct2(new char[][] { new char[]{'A'},
                                                            new char[]{'B'}}, 1);

			PolyStruct2[] arg301 = new PolyStruct2[] {new PolyStruct2('A', 1)};
			PolyStruct2[] arg302 = new PolyStruct2[] {new PolyStruct2(
				new PolyStruct('A', 1), 1)};
			PolyStruct2[] arg303 = new PolyStruct2[] {new PolyStruct2(
				new PolyStruct(new PolyStruct('A',1),1),1)};
			PolyStruct[] arg304 = new PolyStruct[] {new PolyStruct("Hallo", 1)};
			PolyStruct[] arg305 = new PolyStruct[] {new PolyStruct(
				new PolyStruct('A',1),1)};

			PolyStruct2[][] arg401 = new PolyStruct2[][] {new PolyStruct2[] {new PolyStruct2('A', 1)}};
			PolyStruct2[][] arg402 = new PolyStruct2[][] {new PolyStruct2[] {new PolyStruct2(
				new PolyStruct('A', 1), 1)}};
			PolyStruct2[][] arg403 = new PolyStruct2[][] {new PolyStruct2[] {new PolyStruct2(
				new PolyStruct(new PolyStruct('A',1),1),1)}};
			PolyStruct[][] arg404 = new PolyStruct[][] {new PolyStruct[] {new PolyStruct("Hallo", 1)}};
			PolyStruct[][] arg405 = new PolyStruct[][] {new PolyStruct[] {new PolyStruct(
				new PolyStruct('A',1),1)}};


            XTest xTest = S1.create6(c,
                 arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,
                 arg11,arg12,arg13,arg14,arg15,arg16,arg17,
                 arg101,arg102,arg103,arg104,arg105,arg106,arg107,arg108,arg109,arg110,
                 arg111,arg112,arg113,arg114,arg115,
                 arg201,
				arg301, arg302, arg303, arg304, arg305,
				arg401, arg402, arg403, arg404, arg405);
            Component cobj = (Component) xTest;
            l.assure(cobj.Args[0].Value == c);
			//arg1 - arg17
            string sType = ((PolymorphicType) cobj.Args[1].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Type>");
            sType = ((PolymorphicType) cobj.Args[2].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<uno.Any>");
            sType = ((PolymorphicType) cobj.Args[3].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Boolean>");
            sType = ((PolymorphicType) cobj.Args[4].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Byte>");
            sType = ((PolymorphicType) cobj.Args[5].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Char>");
            sType = ((PolymorphicType) cobj.Args[6].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Int16>");
            sType = ((PolymorphicType) cobj.Args[7].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Int32>");
            sType = ((PolymorphicType) cobj.Args[8].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Int64>");
            sType = ((PolymorphicType) cobj.Args[9].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.String>");
            sType = ((PolymorphicType) cobj.Args[10].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Single>");
            sType = ((PolymorphicType) cobj.Args[11].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Double>");
            sType = ((PolymorphicType) cobj.Args[12].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Object>");
            sType = ((PolymorphicType) cobj.Args[13].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<unoidl.com.sun.star.lang.XComponent>");
            sType = ((PolymorphicType) cobj.Args[14].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>>");
            sType = ((PolymorphicType) cobj.Args[15].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<" +
                      "unoidl.test.cliure.climaker.PolyStruct<" +
                      "unoidl.test.cliure.climaker.PolyStruct<" +
                      "System.Char,uno.Any>,System.String>>");
            sType = ((PolymorphicType) cobj.Args[16].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct<" +
                      "System.String,unoidl.test.cliure.climaker.PolyStruct<" +
                      "System.Char,unoidl.test.cliure.climaker.PolyStruct2<" +
                      "uno.Any>>>");
            sType = ((PolymorphicType) cobj.Args[17].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct<" +
                      "unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>," +
                      "unoidl.test.cliure.climaker.PolyStruct2<System.Char>>");
			//arg101 - arg115
            sType = ((PolymorphicType) cobj.Args[18].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Type[]>");
            sType = ((PolymorphicType) cobj.Args[19].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<uno.Any[]>");
            sType = ((PolymorphicType) cobj.Args[20].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Boolean[]>");
            sType = ((PolymorphicType) cobj.Args[21].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Byte[]>");
            sType = ((PolymorphicType) cobj.Args[22].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Char[]>");
            sType = ((PolymorphicType) cobj.Args[23].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Int16[]>");
            sType = ((PolymorphicType) cobj.Args[24].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Int32[]>");
            sType = ((PolymorphicType) cobj.Args[25].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Int64[]>");
            sType = ((PolymorphicType) cobj.Args[26].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.String[]>");
            sType = ((PolymorphicType) cobj.Args[27].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Single[]>");
            sType = ((PolymorphicType) cobj.Args[28].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Double[]>");
            sType = ((PolymorphicType) cobj.Args[29].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Object[]>");
            sType = ((PolymorphicType) cobj.Args[30].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<unoidl.com.sun.star.lang.XComponent[]>");
            sType = ((PolymorphicType) cobj.Args[31].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<" +
                      "unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any[]>[]>");
            sType = ((PolymorphicType) cobj.Args[32].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<" +
                                "unoidl.test.cliure.climaker.PolyStruct<" +
                                "unoidl.test.cliure.climaker.PolyStruct2<" +
                                "System.Char>,uno.Any[]>[]>");
			//arg 201
            sType = ((PolymorphicType) cobj.Args[33].Type).PolymorphicName;
            l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<" +
                                "System.Char[][]>");
			//arg 301 - arg305
			sType = ((PolymorphicType) cobj.Args[34].Type).PolymorphicName;
			l.assure (sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Char>[]");
			sType = ((PolymorphicType) cobj.Args[35].Type).PolymorphicName;
			l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>>[]");
			sType = ((PolymorphicType) cobj.Args[36].Type).PolymorphicName;
			l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<" +
				"unoidl.test.cliure.climaker.PolyStruct<" +
				"unoidl.test.cliure.climaker.PolyStruct<" +
				"System.Char,uno.Any>,System.String>>[]");
			sType = ((PolymorphicType) cobj.Args[37].Type).PolymorphicName;
			l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct<" +
				"System.String,unoidl.test.cliure.climaker.PolyStruct<" +
				"System.Char,unoidl.test.cliure.climaker.PolyStruct2<" +
				"uno.Any>>>[]");
			sType = ((PolymorphicType) cobj.Args[38].Type).PolymorphicName;
			l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct<" +
				"unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>," +
				"unoidl.test.cliure.climaker.PolyStruct2<System.Char>>[]");
			//arg 401 - arg405
			sType = ((PolymorphicType) cobj.Args[39].Type).PolymorphicName;
			l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<System.Char>[][]");
			sType = ((PolymorphicType) cobj.Args[40].Type).PolymorphicName;
			l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<" +
				"unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>>[][]");
			sType = ((PolymorphicType) cobj.Args[41].Type).PolymorphicName;
			l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct2<" +
				"unoidl.test.cliure.climaker.PolyStruct<" +
				"unoidl.test.cliure.climaker.PolyStruct<" +
				"System.Char,uno.Any>,System.String>>[][]");
			sType = ((PolymorphicType) cobj.Args[42].Type).PolymorphicName;
			l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct<" +
				"System.String,unoidl.test.cliure.climaker.PolyStruct<" +
				"System.Char,unoidl.test.cliure.climaker.PolyStruct2<" +
				"uno.Any>>>[][]");
			sType = ((PolymorphicType) cobj.Args[43].Type).PolymorphicName;
			l.assure( sType == "unoidl.test.cliure.climaker.PolyStruct<" +
				"unoidl.test.cliure.climaker.PolyStruct<System.Char,uno.Any>," +
				"unoidl.test.cliure.climaker.PolyStruct2<System.Char>>[][]");
			
			
			
 
        } 
		catch (Exception) 
		{
            l.assure(false);
        }
    }
Esempio n. 41
0
    public void inParameters(bool aBool, byte aByte,
                      short aShort, ushort aUShort,
                      int aInt, uint aUInt,
                      long aLong, ulong aULong,
                      float aFloat, double aDouble,
                      char aChar, string aString,
                      Type aType, uno.Any aAny,
                      Enum2 aEnum, Struct1 aStruct,
                      object aXInterface,
                      unoidl.com.sun.star.lang.XComponent aXComponent,
                      bool[] seqBool)
    {
        m_Bool = aBool;
        m_Byte = aByte;
        m_Short = aShort;
        m_UShort = aUShort;
        m_Int = aInt;
        m_UInt = aUInt;
        m_Long = aLong;
        m_ULong = aULong;
        m_Float = aFloat;
        m_Double = aDouble;
        m_Char = aChar;
        m_String = aString;
        m_Type = aType;
        m_Any = aAny;
        m_Enum2 = aEnum;
        m_Struct1 = aStruct;
        m_XInterface = aXInterface;
        m_XComponent = aXComponent;
        m_seqBool = seqBool;

    }
Esempio n. 42
0
 public void outParameters(out bool aBool, out byte aByte,
                   out short aShort, out ushort aUShort,
                   out int aInt, out uint aUInt,
                   out long aLong, out ulong aULong,
                   out float aFloat, out double aDouble,
                   out char aChar, out string aString,
                   out Type aType, out uno.Any aAny,
                   out Enum2 aEnum, out Struct1 aStruct,
                   out object aXInterface,
                   out unoidl.com.sun.star.lang.XComponent aXComponent,
                   out bool[] seqBool)
 {
     aBool = m_Bool;
     aByte = m_Byte;
     aShort = m_Short;
     aUShort = m_UShort;
     aInt = m_Int;
     aUInt = m_UInt;
     aLong = m_Long;
     aULong = m_ULong;
     aFloat = m_Float;
     aDouble = m_Double;
     aChar = m_Char;
     aString = m_String;
     aType = m_Type;
     aAny = m_Any;
     aEnum = m_Enum2;
     aStruct = m_Struct1;
     aXInterface = m_XInterface;
     aXComponent = m_XComponent;
     seqBool = m_seqBool;
         
 }
Esempio n. 43
0
    public void StructOrderTest()
    {
      byte[] testb = new Byte[] 
      {
        121, 111, 117, 32, 99, 97, 110, 39, 116, 32, 114, 101, 97, 100, 
        32, 116, 104, 105, 115, 33 
      };

      Struct1 str1 = new Struct1();
      str1.mi = 34567;
      str1.ms = "another test string";
      str1.mb = true;
      str1.md = 8765.123;
      str1.mdt = new DateTime(2002, 7, 6, 11, 25, 37);
      str1.mb64 = testb;
      str1.ma = new int[] { 1, 2, 3, 4, 5 };

      Stream stm = new MemoryStream();
      XmlRpcRequest req = new XmlRpcRequest();
      req.args = new Object[] { str1 };
      req.method = "Foo";
      XmlRpcSerializer ser = new XmlRpcSerializer();
      ser.SerializeRequest(stm, req);
      stm.Position = 0;
      TextReader tr = new StreamReader(stm);
      string reqstr = tr.ReadToEnd();
      Assert.Less(reqstr.IndexOf(">mi</"), reqstr.IndexOf(">ms</"));
      Assert.Less(reqstr.IndexOf(">ms</"), reqstr.IndexOf(">mb</"));
      Assert.Less(reqstr.IndexOf(">mb</"), reqstr.IndexOf(">md</"));
      Assert.Less(reqstr.IndexOf(">md</"), reqstr.IndexOf(">mdt</"));
      Assert.Less(reqstr.IndexOf(">mdt</"), reqstr.IndexOf(">mb64</"));
      Assert.Less(reqstr.IndexOf(">mb64</"), reqstr.IndexOf(">ma</"));
    }
    public double Foo(ref Struct2 r, Struct1 v, String t, ref String tr) {
        double ret;

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

        if (values != "170 65 240 -5893266573950244255 -58932665739" +
            "50244255 .")
        {
            Console.WriteLine("double Foo(...): unexpected values: " + values);
            Fail(19);
        }

        r.Randomize();
        /* tr += */ Randomizer().ToString();
        ret = (double)Randomizer();
        return ret;
    }
    public Struct1 Foo(Struct2 v, ref Struct3 r, sbyte t, ref sbyte tr) {
        Struct1 ret = new Struct1();

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

        if (values != "104 225 80 57 184 -62 -62 .")
        {
            Console.WriteLine("Struct1 Foo(...): unexpected values: " + values);
            Fail(11);
        }

        r.Randomize();
        tr += (sbyte)Randomizer();
        ret.Randomize();
        return ret;
    }
Esempio n. 46
0
    public static int Main(string[] args)
    {
        Inter1 i1 = new Struct1();

        return (i1.Return42() - ((Inter2)i1).Return42() - ((Inter3)i1).Return0()) + 100;
    }
    public float Foo(ref Struct1 r, double v, ulong t, ref ulong tr) {
        float ret;

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

        if (values != "-8.88217392868046E+18 241 3406623781630010640" +
            " 3406623781630010640 .")
        {
            Console.WriteLine("float Foo(...): unexpected values: " + values);
            Fail(18);
        }

        r.Randomize();
        tr += (ulong)Randomizer();
        ret = (float)Randomizer();
        return ret;
    }
    public double Foo(ref Struct2 r, Struct1 v, String t, ref String tr) {
        double ret;

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

        if (values != "226 121 120 2212973731230676456 221297373123" +
            "0676456 .")
        {
            Console.WriteLine("double Foo(...): unexpected values: " + values);
            Fail(19);
        }

        r.Randomize();
        tr += Randomizer().ToString();
        ret = (double)Randomizer();
        return ret;
    }
    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);
        }
    }
Esempio n. 50
0
    //returns the values which have been set in a previous call
    //to this function or inParameters.
    public void inoutParameters(ref bool aBool, ref byte aByte,
                      ref short aShort, ref ushort aUShort,
                      ref int aInt, ref uint aUInt,
                      ref long aLong, ref ulong aULong,
                      ref float aFloat, ref double aDouble,
                      ref char aChar,  ref string aString,
                      ref Type aType, ref uno.Any aAny,
                      ref Enum2 aEnum, ref Struct1 aStruct,
                      ref object aXInterface,
                      ref unoidl.com.sun.star.lang.XComponent aXComponent,
                      ref bool[] seqBool)
    {
        bool _bool = aBool;
        aBool = m_Bool;
        m_Bool = _bool;

        byte _byte = aByte;
        aByte = m_Byte;
        m_Byte = _byte;
        
        short _short = aShort;
        aShort = m_Short;
        m_Short = _short;

        ushort _ushort = aUShort;
        aUShort = m_UShort;
        m_UShort = _ushort;

        int _int = aInt;
        aInt = m_Int;
        m_Int = _int;

        uint _uint = aUInt;
        aUInt = m_UInt;
        m_UInt = _uint;
        
        long _long = aLong;
        aLong = m_Long;
        m_Long = _long;

        ulong _ulong = aULong;
        aULong = m_ULong;
        m_ULong = _ulong;
        
        float _f = aFloat;
        aFloat = m_Float;
        m_Float = _f;

        double _d = aDouble;
        aDouble = m_Double;
        m_Double = _d;
        
        char _char = aChar;
        aChar = m_Char;
        m_Char = _char;

        string _string = aString;
        aString = m_String;
        m_String = _string;

        Type _type = aType;
        aType = m_Type;
        m_Type = _type;

        Any _any = aAny;
        aAny = m_Any;
        m_Any = _any;

        Enum2 _enum2 = aEnum;
        aEnum = m_Enum2;
        m_Enum2 = _enum2;

        Struct1 _struct1 = aStruct;
        aStruct = m_Struct1;
        m_Struct1 = _struct1;
        
        object _obj = aXInterface;
        aXInterface = m_XInterface;
        m_XInterface = _obj;

        ucss.lang.XComponent _xcomp = aXComponent;
        aXComponent = m_XComponent;
        m_XComponent = _xcomp;

        bool[] _seq = seqBool;
        seqBool = m_seqBool;
        m_seqBool = _seq;
    }
 static extern Struct1 StructTest1(Struct1 s, ref Struct1 _s);