示例#1
0
    private static void TestCLongUnmanagedCallersOnly()
    {
        ThisCallNative.C c      = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
        CLong            result = ThisCallNative.GetWidthAsLongFromManaged(&c);

        Assert.Equal((nint)c.width, result.Value);
    }
    private static void TestCLongUnmanagedCallersOnly()
    {
        PlatformDefaultMemberFunctionNative.C c = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
        CLong result = PlatformDefaultMemberFunctionNative.GetWidthAsLongFromManaged(&c);

        Assert.AreEqual((nint)c.width, result.Value);
    }
示例#3
0
        public void Ctor_NInt_LargeValue()
        {
            nint  largeValue = unchecked (((nint)int.MaxValue) + 1);
            CLong value      = new CLong(largeValue);

            Assert.Equal(largeValue, value.Value);
        }
示例#4
0
    private static void TestCLongReverse()
    {
        ThisCallNative.C c = CreateCWithManagedVTable(2.0f, 3.0f);
        CLong result = ThisCallNative.GetWidthAsLongFromManaged(&c);

        Assert.AreEqual((nint)c.width, result.Value);
    }
示例#5
0
    private static void TestCLong(ThisCallNative.C *instance)
    {
        ThisCallNative.GetWidthAsLongFn callback = Marshal.GetDelegateForFunctionPointer <ThisCallNative.GetWidthAsLongFn>(instance->vtable->getWidthAsLong);

        CLong result = callback(instance);

        Assert.Equal((nint)instance->width, result.Value);
    }
示例#6
0
 public void EqualsTest(CLong clong, object obj, bool expected)
 {
     if (obj is CLong clong2)
     {
         Assert.Equal(expected, clong.Equals(clong2));
         Assert.Equal(expected, clong.GetHashCode().Equals(clong2.GetHashCode()));
     }
     Assert.Equal(expected, clong.Equals(obj));
 }
    private static void TestCLong(PlatformDefaultMemberFunctionNative.C *instance)
    {
        CLong result = instance->vtable->getWidthAsLong(instance);

        Assert.AreEqual((nint)instance->width, result.Value);
    }
示例#8
0
        public static void ToStringTest(int value, string expected)
        {
            CLong clong = new CLong(value);

            Assert.Equal(expected, clong.ToString());
        }
示例#9
0
        public void Ctor_NInt()
        {
            CLong value = new CLong((nint)42);

            Assert.Equal(42, value.Value);
        }
示例#10
0
        public void Ctor_Empty()
        {
            CLong value = new CLong();

            Assert.Equal(0, value.Value);
        }
示例#11
0
    private static void TestCLong(StdCallMemberFunctionNative.C *instance)
    {
        CLong result = instance->vtable->getWidthAsLong(instance);

        Assert.Equal((nint)instance->width, result.Value);
    }