Beispiel #1
0
        public void BlockPropertyTest(ulong z, int level, ulong first, ulong last)
        {
            int   i = ZCurve.LargestLevel(z);
            ulong f = ZCurve.FirstInBlock(z, i);
            ulong l = ZCurve.LastInBlock(z, i);
            ulong n = ZCurve.CellsPerBlock(i);

            Assert.Equal(level, i);
            Assert.Equal(first, f);
            Assert.Equal(last, l);

            _output.WriteLine($"z={z} i={i} first={f:X8} last={l:X8} cells_in_block={n}");
        }
Beispiel #2
0
        public void LastInBlockTest()
        {
            Assert.Equal(0UL, ZCurve.LastInBlock(0, 0));
            Assert.Equal(1UL, ZCurve.LastInBlock(1, 0));
            Assert.Equal(2UL, ZCurve.LastInBlock(2, 0));
            Assert.Equal(3UL, ZCurve.LastInBlock(3, 0));
            Assert.Equal(4UL, ZCurve.LastInBlock(4, 0));
            Assert.Equal(256UL, ZCurve.LastInBlock(256, 0));
            Assert.Equal(ulong.MaxValue, ZCurve.LastInBlock(ulong.MaxValue, 0));

            Assert.Equal(3UL, ZCurve.LastInBlock(0, 1));
            Assert.Equal(15UL, ZCurve.LastInBlock(0, 2));
            Assert.Equal(63UL, ZCurve.LastInBlock(0, 3));
            Assert.Equal(255UL, ZCurve.LastInBlock(0, 4));
            Assert.Equal(65535UL, ZCurve.LastInBlock(0, 8));
            Assert.Equal(0x3FFFFFFFFFFFFFFFUL, ZCurve.LastInBlock(0, 31));
            Assert.Equal(ulong.MaxValue, ZCurve.LastInBlock(0, 32));

            Assert.Equal(15UL, ZCurve.LastInBlock(1, 2));

            Assert.Equal(0x3FFFFFFFFFFFFFFFUL, ZCurve.LastInBlock(0, 31));
            Assert.Equal(0x7FFFFFFFFFFFFFFFUL, ZCurve.LastInBlock(1L << 62, 31));
            Assert.Equal(0xFFFFFFFFFFFFFFFFUL, ZCurve.LastInBlock(0, 32));
        }