public void GivenRandomPopulatedTreeWhenTryGetNextReturnsCorrectValue()
        {
            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);
            }
            list.Sort();
            var arr = list.OrderBy(x => x).Distinct().ToArray();

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

            Assert.False(tree.TryGetNext(byte.MinValue, out byte _));
        }