Esempio n. 1
0
        public void EncodeDecodeTest()
        {
            const uint ux = 0xFFFFFFFF;
            const uint uy = 0x5555AAAA;

            ulong uz = ZCurve.Encode(ux, uy);

            Assert.Equal(0x77777777DDDDDDDDUL, uz);
            Assert.Equal(ux, ZCurve.DecodeX(uz));
            Assert.Equal(uy, ZCurve.DecodeY(uz));

            Assert.Equal(0U, ZCurve.DecodeX(ZCurve.Encode(0, 0)));
            Assert.Equal(0U, ZCurve.DecodeY(ZCurve.Encode(0, 0)));
            Assert.Equal(123456789U, ZCurve.DecodeX(ZCurve.Encode(123456789, 999999)));
            Assert.Equal(999999U, ZCurve.DecodeY(ZCurve.Encode(12345689, 999999)));

            Assert.Equal(ulong.MaxValue, ZCurve.Encode(uint.MaxValue, uint.MaxValue));
        }