public void GivenRandomPopulatedTreeWhenGetPrevReturnsCorrectValue()
        {
            var tree = new VanEmdeBoasTree8();
            var rand = new Random();
            var list = new List <byte>();

            for (int i = 0; i <= byte.MaxValue; i++)
            {
                var elem = (byte)rand.Next(1 << 8);
                list.Add(elem);
                tree.Add(elem);
            }
            var arr = list.OrderByDescending(x => x).Distinct().ToArray();

            if (arr[0] != byte.MaxValue)
            {
                Assert.True(tree.TryGetPrevious(byte.MaxValue, out byte res));
                Assert.Equal(arr[0], res);
            }
            for (int i = 1; i < arr.Length - 1; i++)
            {
                if (arr[i - 1] - arr[i] > 1)
                {
                    Assert.True(tree.TryGetPrevious((byte)((arr[i - 1] - arr[i]) / 2 + arr[i]), out byte prev));
                    Assert.Equal(arr[i], prev);
                }
                Assert.True(tree.TryGetPrevious(arr[i - 1], out byte res));
                Assert.Equal(arr[i], res);
            }
            Assert.False(tree.TryGetPrevious(arr[arr.Length - 1], out byte _));
        }
        public void GivenEmptyTreeWhenTryGetPrevReturnsFalse()
        {
            var tree = new VanEmdeBoasTree8();

            Assert.False(tree.TryGetPrevious(byte.MaxValue, out byte _));
        }