public static int Main(string[] args)
 {
     try
     {
         float width  = 1.0f;
         float height = 2.0f;
         PlatformDefaultMemberFunctionNative.C *instance = PlatformDefaultMemberFunctionNative.CreateInstanceOfC(width, height);
         Test8ByteHFA(instance);
         Test4ByteHFA(instance);
         Test4ByteNonHFA(instance);
         TestEnum(instance);
         TestCLong(instance);
         Test8ByteHFAUnmanagedCallersOnly();
         Test4ByteHFAUnmanagedCallersOnly();
         Test4ByteNonHFAUnmanagedCallersOnly();
         TestEnumUnmanagedCallersOnly();
         TestCLongUnmanagedCallersOnly();
     }
     catch (System.Exception ex)
     {
         Console.WriteLine(ex);
         return(101);
     }
     return(100);
 }
    private static void TestCLongUnmanagedCallersOnly()
    {
        PlatformDefaultMemberFunctionNative.C c = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
        CLong result = PlatformDefaultMemberFunctionNative.GetWidthAsLongFromManaged(&c);

        Assert.AreEqual((nint)c.width, result.Value);
    }
    private static void TestEnumUnmanagedCallersOnly()
    {
        PlatformDefaultMemberFunctionNative.C c      = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
        PlatformDefaultMemberFunctionNative.E result = PlatformDefaultMemberFunctionNative.GetEFromManaged(&c);

        Assert.AreEqual(c.dummy, result);
    }
    private static void Test4ByteNonHFAUnmanagedCallersOnly()
    {
        PlatformDefaultMemberFunctionNative.C          c      = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
        PlatformDefaultMemberFunctionNative.IntWrapper result = PlatformDefaultMemberFunctionNative.GetHeightAsIntFromManaged(&c);

        Assert.AreEqual((int)c.height, result.i);
    }
    private static void Test4ByteHFAUnmanagedCallersOnly()
    {
        PlatformDefaultMemberFunctionNative.C     c      = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
        PlatformDefaultMemberFunctionNative.Width result = PlatformDefaultMemberFunctionNative.GetWidthFromManaged(&c);

        Assert.AreEqual(c.width, result.width);
    }
예제 #6
0
    private static void Test8ByteHFAUnmanagedCallersOnly()
    {
        PlatformDefaultMemberFunctionNative.C     c      = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
        PlatformDefaultMemberFunctionNative.SizeF result = PlatformDefaultMemberFunctionNative.GetSizeFromManaged(&c);

        Assert.Equal(c.width, result.width);
        Assert.Equal(c.height, result.height);
    }