Esempio n. 1
0
        private static void VerifyPointer(nuint value, ulong expected)
        {
            Assert.Equal(expected, value.ToUInt64());

            uint expected32 = unchecked ((uint)expected);

            if (expected32 != expected)
            {
                Assert.Throws <OverflowException>(() => value.ToUInt32());
                return;
            }

            Assert.Equal(expected32, value.ToUInt32());

            Assert.Equal(expected.ToString(), value.ToString());

            Assert.Equal(value, checked ((nuint)expected));
            Assert.True(value == checked ((nuint)expected));
            Assert.False(value != checked ((nuint)expected));

            Assert.NotEqual(value, checked ((nuint)expected + 1));
            Assert.False(value == checked ((nuint)expected + 1));
            Assert.True(value != checked ((nuint)expected + 1));
        }