示例#1
0
        public void IterationDeleteTest(int from, int to)
        {
            var intSet = new Kibnet.IntSet();

            for (int i = from; i < to; i++)
            {
                intSet.Add(i);
            }

            for (int i = from; i < to; i++)
            {
                Assert.True(intSet.Contains(i));
                intSet.Remove(i);
                for (int j = from; j < to; j++)
                {
                    if (i >= j)
                    {
                        Assert.False(intSet.Contains(j));
                    }
                    else
                    {
                        Assert.True(intSet.Contains(j));
                    }
                }
            }
        }
示例#2
0
        public void SimpleDeleteTest()
        {
            var intSet = new Kibnet.IntSet();

            for (int i = 100000; i < 200000; i++)
            {
                intSet.Add(i);
                Assert.True(intSet.Contains(i));
                intSet.Remove(i);
                Assert.False(intSet.Contains(i));
            }
        }
示例#3
0
        public void SimpleContainsTest()
        {
            var intSet = new Kibnet.IntSet();

            for (int i = 0; i < 100000; i++)
            {
                intSet.Add(i);
            }
            for (int i = 0; i < 100000; i++)
            {
                Assert.True(intSet.Contains(i));
            }
            for (int i = 100000; i < 200000; i++)
            {
                Assert.False(intSet.Contains(i));
            }
        }
示例#4
0
        public void EmptySetTest(int from, int to)
        {
            var intSet = new Kibnet.IntSet();

            foreach (var i in TestHelper.GetEnumerable(from, to))
            {
                Assert.False(intSet.Contains(i));
            }
        }
示例#5
0
        public void BoundContainsTest(int value)
        {
            var intSet = new Kibnet.IntSet();

            {
                intSet.Add(value);
            }
            Assert.True(intSet.Contains(value));
        }
示例#6
0
        public void FullSetTest(int from, int to)
        {
            var intSet = new Kibnet.IntSet(false, true);

            intSet.Add(0);

            foreach (var i in TestHelper.GetEnumerable(from, to))
            {
                Assert.True(intSet.Contains(i));
            }
        }
示例#7
0
        public void FullEnumeratorTest()
        {
            var intSet = new Kibnet.IntSet(false, true);

            var last = -1;

            foreach (var i in intSet.Take(100000))
            {
                Assert.Equal(last + 1, i);
                Assert.True(intSet.Contains(i));
                last = i;
            }
        }
示例#8
0
        public void Card0FullTest()
        {
            var intSet = new Kibnet.IntSet();

            intSet.Add(0);
            var card0 = intSet.root.Cards.FirstOrDefault(card => card != null);

            card0.Full  = true;
            card0.Cards = null;
            intSet.Add(0);

            Assert.True(intSet.Contains(0));
        }
示例#9
0
        public void NotEvensTest(int from, int to)
        {
            var intSet = new Kibnet.IntSet();

            foreach (var i in TestHelper.GetEnumerable(from, to))
            {
                if (i % 2 != 0)
                {
                    intSet.Add(i);
                }
            }

            foreach (var i in TestHelper.GetEnumerable(from, to))
            {
                if (i % 2 != 0)
                {
                    Assert.True(intSet.Contains(i));
                }
                else
                {
                    Assert.False(intSet.Contains(i));
                }
            }
        }