public void TestGetStringEncoding()
{
Assert.AreEqual("c", ObjectiveCEncoding.GetTypeEncoding(typeof (bool)), "Encoding is wrong for bool");
Assert.AreEqual("S", ObjectiveCEncoding.GetTypeEncoding(typeof (char)), "Encoding is wrong for char");
Assert.AreEqual("s", ObjectiveCEncoding.GetTypeEncoding(typeof (short)), "Encoding is wrong for short");
Assert.AreEqual("s", ObjectiveCEncoding.GetTypeEncoding(typeof (Int16)), "Encoding is wrong for Int16");
Assert.AreEqual("i", ObjectiveCEncoding.GetTypeEncoding(typeof (int)), "Encoding is wrong for int");
Assert.AreEqual("i", ObjectiveCEncoding.GetTypeEncoding(typeof (Int32)), "Encoding is wrong for Int32");
Assert.AreEqual("q", ObjectiveCEncoding.GetTypeEncoding(typeof (long)), "Encoding is wrong for long");
Assert.AreEqual("q", ObjectiveCEncoding.GetTypeEncoding(typeof (Int64)), "Encoding is wrong for Int64");
Assert.AreEqual("S", ObjectiveCEncoding.GetTypeEncoding(typeof (ushort)), "Encoding is wrong for ushort");
Assert.AreEqual("S", ObjectiveCEncoding.GetTypeEncoding(typeof (UInt16)), "Encoding is wrong for UInt16");
Assert.AreEqual("I", ObjectiveCEncoding.GetTypeEncoding(typeof (uint)), "Encoding is wrong for uint");
Assert.AreEqual("I", ObjectiveCEncoding.GetTypeEncoding(typeof (UInt32)), "Encoding is wrong for UInt32");
Assert.AreEqual("Q", ObjectiveCEncoding.GetTypeEncoding(typeof (ulong)), "Encoding is wrong for ulong");
Assert.AreEqual("Q", ObjectiveCEncoding.GetTypeEncoding(typeof (UInt64)), "Encoding is wrong for UInt64");
Assert.AreEqual("f", ObjectiveCEncoding.GetTypeEncoding(typeof (float)), "Encoding is wrong for float");
Assert.AreEqual("d", ObjectiveCEncoding.GetTypeEncoding(typeof (double)), "Encoding is wrong for double");
Assert.AreEqual("v", ObjectiveCEncoding.GetTypeEncoding(typeof (void)), "Encoding is wrong for void");
Assert.AreEqual("*", ObjectiveCEncoding.GetTypeEncoding(typeof (String)), "Encoding is wrong for String");
Assert.AreEqual("@", ObjectiveCEncoding.GetTypeEncoding(typeof (Id)), "Encoding is wrong for id");
Assert.AreEqual("#", ObjectiveCEncoding.GetTypeEncoding(typeof (Class)), "Encoding is wrong for ObjCClass");
Assert.AreEqual("{TSDecimal=iSSSSSSSS}", ObjectiveCEncoding.GetTypeEncoding(typeof (TSDecimal)), "Encoding is wrong for TSDecimal");
// Variable types
if (ObjectiveCRuntime.Is64Bits)
{
Assert.AreEqual("d", ObjectiveCEncoding.GetTypeEncoding(typeof (TSFloat)), "Encoding is wrong for CGFloat");
Assert.AreEqual("q", ObjectiveCEncoding.GetTypeEncoding(typeof (TSInteger)), "Encoding is wrong for NSInteger");
Assert.AreEqual("Q", ObjectiveCEncoding.GetTypeEncoding(typeof (TSUInteger)), "Encoding is wrong for NSUInteger");
Assert.AreEqual("{TSRange64=QQ}", ObjectiveCEncoding.GetTypeEncoding(typeof (TSRange)), "Encoding is wrong for TSRange");
Assert.AreEqual("{TSPoint64=dd}", ObjectiveCEncoding.GetTypeEncoding(typeof (TSPoint)), "Encoding is wrong for TSPoint");
Assert.AreEqual("{TSSize64=dd}", ObjectiveCEncoding.GetTypeEncoding(typeof (TSSize)), "Encoding is wrong for TSSize");
Assert.AreEqual("{TSRect64={TSPoint64=dd}{TSSize64=dd}}", ObjectiveCEncoding.GetTypeEncoding(typeof (TSRect)), "Encoding is wrong for TSRect");
Assert.AreEqual("q", ObjectiveCEncoding.GetTypeEncoding(typeof (TSIntegerEnumeration)), "Encoding is wrong for TSIntegerEnumeration");
Assert.AreEqual("Q", ObjectiveCEncoding.GetTypeEncoding(typeof (TSUIntegerEnumeration)), "Encoding is wrong for TSUIntegerEnumeration");
}
else
{
Assert.AreEqual("f", ObjectiveCEncoding.GetTypeEncoding(typeof (TSFloat)), "Encoding is wrong for CGFloat");
Assert.AreEqual("i", ObjectiveCEncoding.GetTypeEncoding(typeof (TSInteger)), "Encoding is wrong for NSInteger");
Assert.AreEqual("I", ObjectiveCEncoding.GetTypeEncoding(typeof (TSUInteger)), "Encoding is wrong for NSUInteger");
Assert.AreEqual("{TSRange=II}", ObjectiveCEncoding.GetTypeEncoding(typeof (TSRange)), "Encoding is wrong for TSRange");
Assert.AreEqual("{TSPoint=ff}", ObjectiveCEncoding.GetTypeEncoding(typeof (TSPoint)), "Encoding is wrong for TSPoint");
Assert.AreEqual("{TSSize=ff}", ObjectiveCEncoding.GetTypeEncoding(typeof (TSSize)), "Encoding is wrong for TSSize");
Assert.AreEqual("{TSRect={TSPoint=ff}{TSSize=ff}}", ObjectiveCEncoding.GetTypeEncoding(typeof (TSRect)), "Encoding is wrong for TSRect");
Assert.AreEqual("i", ObjectiveCEncoding.GetTypeEncoding(typeof (TSIntegerEnumeration)), "Encoding is wrong for TSIntegerEnumeration");
Assert.AreEqual("I", ObjectiveCEncoding.GetTypeEncoding(typeof (TSUIntegerEnumeration)), "Encoding is wrong for TSUIntegerEnumeration");
}
// Arrays (Not Supported Yet)
// Union (Not Supported Yet)
// BitField (Not Supported Yet)
// Enum
Assert.AreEqual("i", ObjectiveCEncoding.GetTypeEncoding(typeof (TSWindingRule)), "Encoding is wrong for TSWindingRule");
Assert.AreEqual(@"^", ObjectiveCEncoding.GetTypeEncoding(typeof (IntPtr)), "Encoding is wrong for IntPtr");
Assert.AreEqual("@", ObjectiveCEncoding.GetTypeEncoding(typeof (ITSObject)), "Encoding is wrong for ITSObject");
Assert.AreEqual("@", ObjectiveCEncoding.GetTypeEncoding(typeof (TSObject)), "Encoding is wrong for TSObject");
Assert.AreEqual("@", ObjectiveCEncoding.GetTypeEncoding(typeof (TSString)), "Encoding is wrong for TSString");
Assert.AreEqual("@", ObjectiveCEncoding.GetTypeEncoding(typeof (TSControl)), "Encoding is wrong for TSControl");
}