Example #1
0
        private static void FindValueHelper(BigSegmentedArray array)
        {
            int a = array.MaxValue / 16;
            int b = a * 2;
            int c = a * 3;

            array.Add(1000, a);
            array.Add(2000, b);
            Assert.AreEqual(1000, array.FindValue(a, 0, 2000));
            Assert.AreEqual(DocIdSetIterator.NO_MORE_DOCS, array.FindValue(a, 1001, 2000));
            Assert.AreEqual(2000, array.FindValue(b, 2000, 3000));

            array.Fill(c);
            Assert.AreEqual(DocIdSetIterator.NO_MORE_DOCS, array.FindValue(b, 2000, 3000));
            Assert.AreEqual(4000, array.FindValue(c, 4000, 4000));
        }
        private static void FindValueHelper(BigSegmentedArray array)
        {
            int a = array.MaxValue / 16;
            int b = a * 2;
            int c = a * 3;

            array.Add(1000, a);
            array.Add(2000, b);
            Assert.AreEqual(1000, array.FindValue(a, 0, 2000));
            Assert.AreEqual(DocIdSetIterator.NO_MORE_DOCS, array.FindValue(a, 1001, 2000));
            Assert.AreEqual(2000, array.FindValue(b, 2000, 3000));

            array.Fill(c);
            Assert.AreEqual(DocIdSetIterator.NO_MORE_DOCS, array.FindValue(b, 2000, 3000));
            Assert.AreEqual(4000, array.FindValue(c, 4000, 4000));
        }
Example #3
0
        private static void FillTestHelper(BigSegmentedArray array)
        {
            int a = array.MaxValue / 4;
            int b = array.MaxValue / 2;
            int c = array.MaxValue - 1;

            Assert.AreEqual(0, array.Get(20000));

            array.Fill(a);
            Assert.AreEqual(a, array.Get(20000));

            array.Add(20000, b);
            Assert.AreEqual(b, array.Get(20000));
            Assert.AreEqual(a, array.Get(20001));

            Assert.AreEqual(20000, array.FindValue(b, 0, 21000));

            array.Fill(c);
            Assert.AreEqual(c, array.Get(20000));
            Assert.AreEqual(c, array.Get(40000));
            Assert.AreEqual(c, array.Get(0));
        }
        private static void FillTestHelper(BigSegmentedArray array)
        {
            int a = array.MaxValue / 4;
            int b = array.MaxValue / 2;
            int c = array.MaxValue - 1;

            Assert.AreEqual(0, array.Get(20000));

            array.Fill(a);
            Assert.AreEqual(a, array.Get(20000));

            array.Add(20000, b);
            Assert.AreEqual(b, array.Get(20000));
            Assert.AreEqual(a, array.Get(20001));

            Assert.AreEqual(20000, array.FindValue(b, 0, 21000));

            array.Fill(c);
            Assert.AreEqual(c, array.Get(20000));
            Assert.AreEqual(c, array.Get(40000));
            Assert.AreEqual(c, array.Get(0));
        }