コード例 #1
0
        // INFO: Tests for trieCodeLong()/trieCodeInt() not needed because implicitely tested by range filter tests

        /// <summary>
        /// Note: The neededBounds Iterable must be unsigned (easier understanding what's happening) </summary>
        private void AssertLongRangeSplit(long lower, long upper, int precisionStep, bool useBitSet, IEnumerable <long> expectedBounds, IEnumerable <int> expectedShifts)
        {
            // Cannot use FixedBitSet since the range could be long:
            Int64BitSet        bits         = useBitSet ? new Int64BitSet(upper - lower + 1) : null;
            IEnumerator <long> neededBounds = (expectedBounds == null) ? null : expectedBounds.GetEnumerator();
            IEnumerator <int>  neededShifts = (expectedShifts == null) ? null : expectedShifts.GetEnumerator();

            NumericUtils.SplitInt64Range(new LongRangeBuilderAnonymousInnerClassHelper(this, lower, upper, useBitSet, bits, neededBounds, neededShifts), precisionStep, lower, upper);

            if (useBitSet)
            {
                // after flipping all bits in the range, the cardinality should be zero
                bits.Flip(0, upper - lower + 1);
                Assert.AreEqual(0, bits.Cardinality(), "The sub-range concenated should match the whole range");
            }
        }