예제 #1
0
        public void UnsignedFieldsXml()
        {
            // Ensure Kotlin unsigned types end up in the xml
            var klass = LoadClassFile("UnsignedTypesKt.class");

            KotlinFixups.Fixup(new [] { klass });

            var xml = new XmlClassDeclarationBuilder(klass).ToXElement();

            Assert.AreEqual("uint", xml.Elements("field").Single(f => f.Attribute("name").Value == "UINT_CONST").Attribute("type").Value);
            Assert.AreEqual("ushort", xml.Elements("field").Single(f => f.Attribute("name").Value == "USHORT_CONST").Attribute("type").Value);
            Assert.AreEqual("ulong", xml.Elements("field").Single(f => f.Attribute("name").Value == "ULONG_CONST").Attribute("type").Value);
            Assert.AreEqual("ubyte", xml.Elements("field").Single(f => f.Attribute("name").Value == "UBYTE_CONST").Attribute("type").Value);
        }
예제 #2
0
        public void UnsignedMethodsXml()
        {
            // Ensure Kotlin unsigned types end up in the xml
            var klass = LoadClassFile("UnsignedTypes.class");

            KotlinFixups.Fixup(new [] { klass });

            var xml = new XmlClassDeclarationBuilder(klass).ToXElement();

            Assert.AreEqual("uint", xml.Elements("method").Single(f => f.Attribute("name").Value == "foo_uint-WZ4Q5Ns").Attribute("return").Value);
            Assert.AreEqual("uint", xml.Elements("method").Single(f => f.Attribute("name").Value == "foo_uint-WZ4Q5Ns").Element("parameter").Attribute("type").Value);

            Assert.AreEqual("ushort", xml.Elements("method").Single(f => f.Attribute("name").Value == "foo_ushort-xj2QHRw").Attribute("return").Value);
            Assert.AreEqual("ushort", xml.Elements("method").Single(f => f.Attribute("name").Value == "foo_ushort-xj2QHRw").Element("parameter").Attribute("type").Value);

            Assert.AreEqual("ulong", xml.Elements("method").Single(f => f.Attribute("name").Value == "foo_ulong-VKZWuLQ").Attribute("return").Value);
            Assert.AreEqual("ulong", xml.Elements("method").Single(f => f.Attribute("name").Value == "foo_ulong-VKZWuLQ").Element("parameter").Attribute("type").Value);

            Assert.AreEqual("ubyte", xml.Elements("method").Single(f => f.Attribute("name").Value == "foo_ubyte-7apg3OU").Attribute("return").Value);
            Assert.AreEqual("ubyte", xml.Elements("method").Single(f => f.Attribute("name").Value == "foo_ubyte-7apg3OU").Element("parameter").Attribute("type").Value);

            Assert.AreEqual("uint[]", xml.Elements("method").Single(f => f.Attribute("name").Value == "foo_uintarray--ajY-9A").Attribute("return").Value);
            Assert.AreEqual("uint[]", xml.Elements("method").Single(f => f.Attribute("name").Value == "foo_uintarray--ajY-9A").Element("parameter").Attribute("type").Value);

            Assert.AreEqual("ushort[]", xml.Elements("method").Single(f => f.Attribute("name").Value == "foo_ushortarray-rL5Bavg").Attribute("return").Value);
            Assert.AreEqual("ushort[]", xml.Elements("method").Single(f => f.Attribute("name").Value == "foo_ushortarray-rL5Bavg").Element("parameter").Attribute("type").Value);

            Assert.AreEqual("ulong[]", xml.Elements("method").Single(f => f.Attribute("name").Value == "foo_ulongarray-QwZRm1k").Attribute("return").Value);
            Assert.AreEqual("ulong[]", xml.Elements("method").Single(f => f.Attribute("name").Value == "foo_ulongarray-QwZRm1k").Element("parameter").Attribute("type").Value);

            Assert.AreEqual("ubyte[]", xml.Elements("method").Single(f => f.Attribute("name").Value == "foo_ubytearray-GBYM_sE").Attribute("return").Value);
            Assert.AreEqual("ubyte[]", xml.Elements("method").Single(f => f.Attribute("name").Value == "foo_ubytearray-GBYM_sE").Element("parameter").Attribute("type").Value);
        }