Пример #1
0
        public void EnumeratorSkipsBeyondLastBucket()
        {
            // compression
            var compressedBuffer1 = new EliasFanoList(_postingList.Last(), _postingList.Count, _postingList);

            // get enumerator and skip
            var enumerator = compressedBuffer1.GetEnumerator() as ISkippingEnumerator <uint>;

            Assert.AreEqual(false, enumerator.SkipToBoundary(50000000));
        }
Пример #2
0
        public void EnumeratorSkipsToLastItem()
        {
            // compression
            var compressedBuffer1 = new EliasFanoList(_postingList.Last(), _postingList.Count, _postingList);

            // get enumerator and skip
            var enumerator = compressedBuffer1.GetEnumerator() as ISkippingEnumerator <uint>;

            Assert.AreEqual(true, enumerator.SkipToBoundary(25070429));
            Assert.AreEqual(25070429U, enumerator.Current);
        }
Пример #3
0
        public void EnumeratorSkipsToSecondPointerIndex()
        {
            // compression
            var data = Enumerable.Range(0, 4096).Select(i => (uint)i).ToList();
            var compressedBuffer1 = new EliasFanoList(data);

            // get enumerator and skip
            var enumerator = compressedBuffer1.GetEnumerator() as ISkippingEnumerator <uint>;

            Assert.AreEqual(true, enumerator.SkipToIndex(2048));
            Assert.AreEqual(2048U, enumerator.Current);
            Assert.AreEqual(true, enumerator.MoveNext());
            Assert.AreEqual(2049U, enumerator.Current);
        }
Пример #4
0
        public void EnumeratorSkipsByIndex()
        {
            // compression
            var compressedBuffer1 = new EliasFanoList(_postingList.Last(), _postingList.Count, _postingList);

            // get enumerator and skip
            var enumerator = compressedBuffer1.GetEnumerator() as ISkippingEnumerator <uint>;

            Assert.AreEqual(true, enumerator.SkipToIndex(10));
            Assert.AreEqual(587702U, enumerator.Current);
            Assert.AreEqual(true, enumerator.MoveNext());
            Assert.AreEqual(587882U, enumerator.Current);
            Assert.AreEqual(true, enumerator.MoveNext());
            Assert.AreEqual(588062U, enumerator.Current);
            Assert.AreEqual(true, enumerator.MoveNext());
            Assert.AreEqual(588242U, enumerator.Current);
            Assert.AreEqual(true, enumerator.MoveNext());
            Assert.AreEqual(588422U, enumerator.Current);
        }
Пример #5
0
        public void EnumeratorSkipsBeyondBoundary()
        {
            // compression
            var compressedBuffer1 = new EliasFanoList(_postingList.Last(), _postingList.Count, _postingList);

            // get enumerator and skip
            var enumerator = compressedBuffer1.GetEnumerator() as ISkippingEnumerator <uint>;

            Assert.AreEqual(true, enumerator.SkipToBoundary(595621));
            Assert.AreEqual(595622U, enumerator.Current);
            Assert.AreEqual(true, enumerator.MoveNext());
            Assert.AreEqual(595802U, enumerator.Current);
            Assert.AreEqual(true, enumerator.MoveNext());
            Assert.AreEqual(595982U, enumerator.Current);
            Assert.AreEqual(true, enumerator.MoveNext());
            Assert.AreEqual(596162U, enumerator.Current);
            Assert.AreEqual(true, enumerator.MoveNext());
            Assert.AreEqual(596342U, enumerator.Current);
            Assert.AreEqual(true, enumerator.MoveNext());
            Assert.AreEqual(596522U, enumerator.Current);
        }