Beispiel #1
0
 private static void CountUpTestHelper(BigSegmentedArray array)
 {
     Initialize(array);
     Assert.AreEqual(short.MaxValue * 2, array.Size());
     for (int i = 0; i < array.Size(); i++)
     {
         Assert.AreEqual(i % array.MaxValue, array.Get(i));
     }
 }
 private static void CountUpTestHelper(BigSegmentedArray array)
 {
     Initialize(array);
     Assert.AreEqual(short.MaxValue * 2, array.Size());
     for (int i = 0; i < array.Size(); i++)
     {
         Assert.AreEqual(i % array.MaxValue, array.Get(i));
     }
 }
Beispiel #3
0
 public static int[] ToArray(BigSegmentedArray original)
 {
     int[] result = new int[original.Size()];
     for (int i = 0; i < original.Size(); i++)
     {
         result[i] = original.Get(i);
     }
     return(result);
 }
Beispiel #4
0
 public static BigSegmentedArray Initialize(BigSegmentedArray array)
 {
     for (int i = 0; i < array.Size(); i++)
     {
         array.Add(i, i % array.MaxValue);
     }
     return(array);
 }
Beispiel #5
0
        private static void FindValueRangeHelper(BigSegmentedArray array)
        {
            int a = array.MaxValue / 16;
            int b = a * 2;
            int c = a * 3;
            int d = a * 4;
            int e = a * 5;
            int f = a * 6;

            array.Add(10000, b);
            Assert.AreEqual(DocIdSetIterator.NO_MORE_DOCS, array.FindValueRange(d, e, 0, array.Size()));
            Assert.AreEqual(10000, array.FindValueRange(a, e, 0, array.Size()));
            Assert.AreEqual(10000, array.FindValueRange(a, e, 10000, array.Size()));
            Assert.AreEqual(10000, array.FindValueRange(a, e, 0, 10000));

            Assert.AreEqual(10000, array.FindValueRange(a, b, 9000, 10100));
            Assert.AreEqual(10000, array.FindValueRange(b, e, 9000, 10000));
            Assert.AreEqual(10000, array.FindValueRange(b, b, 9000, 10000));
        }
        private static void FindValueRangeHelper(BigSegmentedArray array)
        {
            int a = array.MaxValue / 16;
            int b = a * 2;
            int c = a * 3;
            int d = a * 4;
            int e = a * 5;
            int f = a * 6;

            array.Add(10000, b);
            Assert.AreEqual(DocIdSetIterator.NO_MORE_DOCS, array.FindValueRange(d, e, 0, array.Size()));
            Assert.AreEqual(10000, array.FindValueRange(a, e, 0, array.Size()));
            Assert.AreEqual(10000, array.FindValueRange(a, e, 10000, array.Size()));
            Assert.AreEqual(10000, array.FindValueRange(a, e, 0, 10000));

            Assert.AreEqual(10000, array.FindValueRange(a, b, 9000, 10100));
            Assert.AreEqual(10000, array.FindValueRange(b, e, 9000, 10000));
            Assert.AreEqual(10000, array.FindValueRange(b, b, 9000, 10000));
        }
 private static void EmptyArrayTestHelper(BigSegmentedArray array)
 {
     Assert.AreEqual(0, array.Get(0));
     Assert.AreEqual(0, array.Size());
 }
 public static BigSegmentedArray Initialize(BigSegmentedArray array)
 {
     for (int i = 0; i < array.Size(); i++)
     {
         array.Add(i, i % array.MaxValue);
     }
     return array;
 }
Beispiel #9
0
 private static void EmptyArrayTestHelper(BigSegmentedArray array)
 {
     Assert.AreEqual(0, array.Get(0));
     Assert.AreEqual(0, array.Size());
 }
Beispiel #10
0
 public static int[] ToArray(BigSegmentedArray original)
 {
     int[] result = new int[original.Size()];
     for (int i = 0; i < original.Size(); i++)
     {
         result[i] = original.Get(i);
     }
     return result;
 }