コード例 #1
0
        public static void EqualRange(this Kibnet.IntSet intSet, int start, int finish)
        {
            var enumerable = intSet as IEnumerable;
            var last       = start - 1;

            Assert.Equal(start, intSet.First());
            foreach (int i in enumerable)
            {
                Assert.Equal(last + 1, i);
                last = i;
            }
            Assert.Equal(finish, intSet.Last());
        }
コード例 #2
0
        public void CopyToTest()
        {
            var intSet = new Kibnet.IntSet(TestHelper.GetEnumerable(100000, 1));

            var array = new int[intSet.Count];

            intSet.CopyTo(array);

            var last = 0;

            Assert.Equal(1, intSet.First());
            foreach (int i in array)
            {
                Assert.Equal(last + 1, i);
                last = i;
            }
            Assert.Equal(100000, intSet.Last());
        }
コード例 #3
0
        public void IntersectWithIEnumerableTest()
        {
            var intSet = new Kibnet.IntSet(TestHelper.GetEnumerable(100000, 100));

            var intSet2 = TestHelper.GetEnumerable(10000, 0);

            intSet.IntersectWith(intSet2);

            var last       = 99;
            var enumerable = intSet as IEnumerable;

            Assert.Equal(100, intSet.First());
            foreach (int i in enumerable)
            {
                Assert.Equal(last + 1, i);
                last = i;
            }
            Assert.Equal(10000, intSet.Last());
        }