http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Tests/core/Util/TestLongBitSet.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/core/Util/TestLongBitSet.cs b/src/Lucene.Net.Tests/core/Util/TestLongBitSet.cs index 7267536..0fa9acf 100644 --- a/src/Lucene.Net.Tests/core/Util/TestLongBitSet.cs +++ b/src/Lucene.Net.Tests/core/Util/TestLongBitSet.cs @@ -27,7 +27,7 @@ namespace Lucene.Net.Util [TestFixture] public class TestLongBitSet : LuceneTestCase { - internal virtual void DoGet(BitArray a, LongBitSet b) + internal virtual void DoGet(BitArray a, Int64BitSet b) { long max = b.Length; for (int i = 0; i < max; i++) @@ -39,7 +39,7 @@ namespace Lucene.Net.Util } } - internal virtual void DoNextSetBit(BitArray a, LongBitSet b) + internal virtual void DoNextSetBit(BitArray a, Int64BitSet b) { int aa = -1; long bb = -1; @@ -51,7 +51,7 @@ namespace Lucene.Net.Util } while (aa >= 0); } - internal virtual void DoPrevSetBit(BitArray a, LongBitSet b) + internal virtual void DoPrevSetBit(BitArray a, Int64BitSet b) { int aa = a.Length + Random().Next(100); long bb = aa; @@ -86,13 +86,13 @@ namespace Lucene.Net.Util internal virtual void DoRandomSets(int maxSize, int iter, int mode) { BitArray a0 = null; - LongBitSet b0 = null; + Int64BitSet b0 = null; for (int i = 0; i < iter; i++) { int sz = TestUtil.NextInt(Random(), 2, maxSize); BitArray a = new BitArray(sz); - LongBitSet b = new LongBitSet(sz); + Int64BitSet b = new Int64BitSet(sz); // test the various ways of setting bits if (sz > 0) @@ -140,7 +140,7 @@ namespace Lucene.Net.Util toIndex = fromIndex + Random().Next(sz - fromIndex); BitArray aa = new BitArray(a); aa.Flip(fromIndex, toIndex); - LongBitSet bb = b.Clone(); + Int64BitSet bb = b.Clone(); bb.Flip(fromIndex, toIndex); fromIndex = Random().Next(sz / 2); @@ -178,14 +178,14 @@ namespace Lucene.Net.Util BitArray a_andn = new BitArray(a); a_andn.AndNot(a0); - LongBitSet b_and = b.Clone(); + Int64BitSet b_and = b.Clone(); Assert.AreEqual(b, b_and); b_and.And(b0); - LongBitSet b_or = b.Clone(); + Int64BitSet b_or = b.Clone(); b_or.Or(b0); - LongBitSet b_xor = b.Clone(); + Int64BitSet b_xor = b.Clone(); b_xor.Xor(b0); - LongBitSet b_andn = b.Clone(); + Int64BitSet b_andn = b.Clone(); b_andn.AndNot(b0); Assert.AreEqual(a0.Cardinality(), b0.Cardinality()); @@ -214,7 +214,7 @@ namespace Lucene.Net.Util [Test, LuceneNetSpecific] public void TestClearSmall() { - LongBitSet a = new LongBitSet(30); // 0110010111001000101101001001110...0 + Int64BitSet a = new Int64BitSet(30); // 0110010111001000101101001001110...0 int[] onesA = { 1, 2, 5, 7, 8, 9, 12, 16, 18, 19, 21, 24, 27, 28, 29 }; for (int i = 0; i < onesA.size(); i++) @@ -222,7 +222,7 @@ namespace Lucene.Net.Util a.Set(onesA[i]); } - LongBitSet b = new LongBitSet(30); // 0110000001001000101101001001110...0 + Int64BitSet b = new Int64BitSet(30); // 0110000001001000101101001001110...0 int[] onesB = { 1, 2, 9, 12, 16, 18, 19, 21, 24, 27, 28, 29 }; for (int i = 0; i < onesB.size(); i++) @@ -248,8 +248,8 @@ namespace Lucene.Net.Util { Random random = new Random(); int sz = AtLeast(1200); - LongBitSet a = new LongBitSet(sz); - LongBitSet b = new LongBitSet(sz); + Int64BitSet a = new Int64BitSet(sz); + Int64BitSet b = new Int64BitSet(sz); int from = random.Next(sz - 1); int to = random.Next(from, sz); @@ -282,8 +282,8 @@ namespace Lucene.Net.Util { // this test can't handle numBits==0: int numBits = Random().Next(2000) + 1; - LongBitSet b1 = new LongBitSet(numBits); - LongBitSet b2 = new LongBitSet(numBits); + Int64BitSet b1 = new Int64BitSet(numBits); + Int64BitSet b2 = new Int64BitSet(numBits); Assert.IsTrue(b1.Equals(b2)); Assert.IsTrue(b2.Equals(b1)); for (int iter = 0; iter < 10 * RANDOM_MULTIPLIER; iter++) @@ -309,8 +309,8 @@ namespace Lucene.Net.Util { // this test can't handle numBits==0: int numBits = Random().Next(2000) + 1; - LongBitSet b1 = new LongBitSet(numBits); - LongBitSet b2 = new LongBitSet(numBits); + Int64BitSet b1 = new Int64BitSet(numBits); + Int64BitSet b2 = new Int64BitSet(numBits); Assert.IsTrue(b1.Equals(b2)); Assert.IsTrue(b2.Equals(b1)); for (int iter = 0; iter < 10 * RANDOM_MULTIPLIER; iter++) @@ -334,8 +334,8 @@ namespace Lucene.Net.Util // Make sure size 0-10 bit sets are OK: for (int numBits = 0; numBits < 10; numBits++) { - LongBitSet b1 = new LongBitSet(numBits); - LongBitSet b2 = new LongBitSet(numBits); + Int64BitSet b1 = new Int64BitSet(numBits); + Int64BitSet b2 = new Int64BitSet(numBits); Assert.IsTrue(b1.Equals(b2)); Assert.AreEqual(b1.GetHashCode(), b2.GetHashCode()); Assert.AreEqual(0, b1.Cardinality()); @@ -349,22 +349,22 @@ namespace Lucene.Net.Util } } - private LongBitSet MakeLongFixedBitSet(int[] a, int numBits) + private Int64BitSet MakeLongFixedBitSet(int[] a, int numBits) { - LongBitSet bs; + Int64BitSet bs; if (Random().NextBoolean()) { - int bits2words = LongBitSet.Bits2words(numBits); + int bits2words = Int64BitSet.Bits2words(numBits); long[] words = new long[bits2words + Random().Next(100)]; for (int i = bits2words; i < words.Length; i++) { words[i] = Random().NextLong(); } - bs = new LongBitSet(words, numBits); + bs = new Int64BitSet(words, numBits); } else { - bs = new LongBitSet(numBits); + bs = new Int64BitSet(numBits); } foreach (int e in a) { @@ -385,7 +385,7 @@ namespace Lucene.Net.Util private void CheckPrevSetBitArray(int[] a, int numBits) { - LongBitSet obs = MakeLongFixedBitSet(a, numBits); + Int64BitSet obs = MakeLongFixedBitSet(a, numBits); BitArray bs = MakeBitSet(a); DoPrevSetBit(bs, obs); } @@ -400,7 +400,7 @@ namespace Lucene.Net.Util private void CheckNextSetBitArray(int[] a, int numBits) { - LongBitSet obs = MakeLongFixedBitSet(a, numBits); + Int64BitSet obs = MakeLongFixedBitSet(a, numBits); BitArray bs = MakeBitSet(a); DoNextSetBit(bs, obs); } @@ -421,11 +421,11 @@ namespace Lucene.Net.Util [Test] public virtual void TestEnsureCapacity() { - LongBitSet bits = new LongBitSet(5); + Int64BitSet bits = new Int64BitSet(5); bits.Set(1); bits.Set(4); - LongBitSet newBits = LongBitSet.EnsureCapacity(bits, 8); // grow within the word + Int64BitSet newBits = Int64BitSet.EnsureCapacity(bits, 8); // grow within the word Assert.IsTrue(newBits.Get(1)); Assert.IsTrue(newBits.Get(4)); newBits.Clear(1); @@ -434,11 +434,11 @@ namespace Lucene.Net.Util Assert.IsFalse(newBits.Get(1)); newBits.Set(1); - newBits = LongBitSet.EnsureCapacity(newBits, newBits.Length - 2); // reuse + newBits = Int64BitSet.EnsureCapacity(newBits, newBits.Length - 2); // reuse Assert.IsTrue(newBits.Get(1)); bits.Set(1); - newBits = LongBitSet.EnsureCapacity(bits, 72); // grow beyond one word + newBits = Int64BitSet.EnsureCapacity(bits, 72); // grow beyond one word Assert.IsTrue(newBits.Get(1)); Assert.IsTrue(newBits.Get(4)); newBits.Clear(1);
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Tests/core/Util/TestNumericUtils.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/core/Util/TestNumericUtils.cs b/src/Lucene.Net.Tests/core/Util/TestNumericUtils.cs index ab14b15..5c3de83 100644 --- a/src/Lucene.Net.Tests/core/Util/TestNumericUtils.cs +++ b/src/Lucene.Net.Tests/core/Util/TestNumericUtils.cs @@ -242,7 +242,7 @@ namespace Lucene.Net.Util 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: - LongBitSet bits = useBitSet ? new LongBitSet(upper - lower + 1) : null; + 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(); @@ -256,18 +256,18 @@ namespace Lucene.Net.Util } } - private class LongRangeBuilderAnonymousInnerClassHelper : NumericUtils.LongRangeBuilder + private class LongRangeBuilderAnonymousInnerClassHelper : NumericUtils.Int64RangeBuilder { private readonly TestNumericUtils OuterInstance; private long Lower; private long Upper; private bool UseBitSet; - private LongBitSet Bits; + private Int64BitSet Bits; private IEnumerator<long> NeededBounds; private IEnumerator<int> NeededShifts; - public LongRangeBuilderAnonymousInnerClassHelper(TestNumericUtils outerInstance, long lower, long upper, bool useBitSet, LongBitSet bits, IEnumerator<long> neededBounds, IEnumerator<int> neededShifts) + public LongRangeBuilderAnonymousInnerClassHelper(TestNumericUtils outerInstance, long lower, long upper, bool useBitSet, Int64BitSet bits, IEnumerator<long> neededBounds, IEnumerator<int> neededShifts) { this.OuterInstance = outerInstance; this.Lower = lower; @@ -456,7 +456,7 @@ namespace Lucene.Net.Util } } - private class IntRangeBuilderAnonymousInnerClassHelper : NumericUtils.IntRangeBuilder + private class IntRangeBuilderAnonymousInnerClassHelper : NumericUtils.Int32RangeBuilder { private readonly TestNumericUtils OuterInstance; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Tests/core/Util/TestRecyclingIntBlockAllocator.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/core/Util/TestRecyclingIntBlockAllocator.cs b/src/Lucene.Net.Tests/core/Util/TestRecyclingIntBlockAllocator.cs index b218493..8d8ea32 100644 --- a/src/Lucene.Net.Tests/core/Util/TestRecyclingIntBlockAllocator.cs +++ b/src/Lucene.Net.Tests/core/Util/TestRecyclingIntBlockAllocator.cs @@ -23,7 +23,7 @@ namespace Lucene.Net.Util */ /// <summary> - /// Testcase for <seealso cref="RecyclingIntBlockAllocator"/> + /// Testcase for <seealso cref="RecyclingInt32BlockAllocator"/> /// </summary> [TestFixture] public class TestRecyclingIntBlockAllocator : LuceneTestCase @@ -34,15 +34,15 @@ namespace Lucene.Net.Util base.SetUp(); } - private RecyclingIntBlockAllocator NewAllocator() + private RecyclingInt32BlockAllocator NewAllocator() { - return new RecyclingIntBlockAllocator(1 << (2 + Random().Next(15)), Random().Next(97), Util.Counter.NewCounter()); + return new RecyclingInt32BlockAllocator(1 << (2 + Random().Next(15)), Random().Next(97), Util.Counter.NewCounter()); } [Test] public virtual void TestAllocate() { - RecyclingIntBlockAllocator allocator = NewAllocator(); + RecyclingInt32BlockAllocator allocator = NewAllocator(); HashSet<int[]> set = new HashSet<int[]>(); int[] block = allocator.GetInt32Block(); set.Add(block); @@ -64,7 +64,7 @@ namespace Lucene.Net.Util [Test] public virtual void TestAllocateAndRecycle() { - RecyclingIntBlockAllocator allocator = NewAllocator(); + RecyclingInt32BlockAllocator allocator = NewAllocator(); HashSet<int[]> allocated = new HashSet<int[]>(); int[] block = allocator.GetInt32Block(); @@ -106,7 +106,7 @@ namespace Lucene.Net.Util [Test] public virtual void TestAllocateAndFree() { - RecyclingIntBlockAllocator allocator = NewAllocator(); + RecyclingInt32BlockAllocator allocator = NewAllocator(); HashSet<int[]> allocated = new HashSet<int[]>(); int freeButAllocated = 0; int[] block = allocator.GetInt32Block(); http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Tests/core/Util/TestSentinelIntSet.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/core/Util/TestSentinelIntSet.cs b/src/Lucene.Net.Tests/core/Util/TestSentinelIntSet.cs index bfb48ea..e5c4188 100644 --- a/src/Lucene.Net.Tests/core/Util/TestSentinelIntSet.cs +++ b/src/Lucene.Net.Tests/core/Util/TestSentinelIntSet.cs @@ -27,7 +27,7 @@ namespace Lucene.Net.Util [Test] public virtual void Test() { - SentinelIntSet set = new SentinelIntSet(10, -1); + SentinelInt32Set set = new SentinelInt32Set(10, -1); Assert.IsFalse(set.Exists(50)); set.Put(50); Assert.IsTrue(set.Exists(50)); @@ -56,7 +56,7 @@ namespace Lucene.Net.Util int maxVal = (Random().NextBoolean() ? Random().Next(50) : Random().Next(int.MaxValue)) + 1; HashSet<int> a = new HashSet<int>(/*initSz*/); - SentinelIntSet b = new SentinelIntSet(initSz, -1); + SentinelInt32Set b = new SentinelInt32Set(initSz, -1); for (int j = 0; j < num; j++) { http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Tests/core/Util/TestSmallFloat.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/core/Util/TestSmallFloat.cs b/src/Lucene.Net.Tests/core/Util/TestSmallFloat.cs index a933ccd..0fe0e8a 100644 --- a/src/Lucene.Net.Tests/core/Util/TestSmallFloat.cs +++ b/src/Lucene.Net.Tests/core/Util/TestSmallFloat.cs @@ -106,13 +106,13 @@ namespace Lucene.Net.Util for (int i = 0; i < 256; i++) { float f1 = Orig_byteToFloat((sbyte)i); - float f2 = SmallFloat.ByteToSingle((sbyte)i, 3, 15); - float f3 = SmallFloat.Byte315ToSingle((sbyte)i); + float f2 = SmallSingle.ByteToSingle((sbyte)i, 3, 15); + float f3 = SmallSingle.Byte315ToSingle((sbyte)i); Assert.AreEqual(f1, f2, 0.0); Assert.AreEqual(f2, f3, 0.0); - float f4 = SmallFloat.ByteToSingle((sbyte)i, 5, 2); - float f5 = SmallFloat.Byte52ToSingle((sbyte)i); + float f4 = SmallSingle.ByteToSingle((sbyte)i, 5, 2); + float f5 = SmallSingle.Byte52ToSingle((sbyte)i); Assert.AreEqual(f4, f5, 0.0); } } @@ -122,19 +122,19 @@ namespace Lucene.Net.Util { Assert.AreEqual(0, Orig_floatToByte_v13(5.8123817E-10f)); // verify the old bug (see LUCENE-2937) Assert.AreEqual(1, Orig_floatToByte(5.8123817E-10f)); // verify it's fixed in this test code - Assert.AreEqual(1, SmallFloat.SingleToByte315(5.8123817E-10f)); // verify it's fixed + Assert.AreEqual(1, SmallSingle.SingleToByte315(5.8123817E-10f)); // verify it's fixed // test some constants - Assert.AreEqual(0, SmallFloat.SingleToByte315(0)); + Assert.AreEqual(0, SmallSingle.SingleToByte315(0)); //Java's Float.MIN_VALUE equals C#'s float.Epsilon - Assert.AreEqual(1, SmallFloat.SingleToByte315(float.Epsilon)); // underflow rounds up to smallest positive - Assert.AreEqual(255, SmallFloat.SingleToByte315(float.MaxValue) & 0xff); // overflow rounds down to largest positive - Assert.AreEqual(255, SmallFloat.SingleToByte315(float.PositiveInfinity) & 0xff); + Assert.AreEqual(1, SmallSingle.SingleToByte315(float.Epsilon)); // underflow rounds up to smallest positive + Assert.AreEqual(255, SmallSingle.SingleToByte315(float.MaxValue) & 0xff); // overflow rounds down to largest positive + Assert.AreEqual(255, SmallSingle.SingleToByte315(float.PositiveInfinity) & 0xff); // all negatives map to 0 - Assert.AreEqual(0, SmallFloat.SingleToByte315(-float.Epsilon)); - Assert.AreEqual(0, SmallFloat.SingleToByte315(-float.MaxValue)); - Assert.AreEqual(0, SmallFloat.SingleToByte315(float.NegativeInfinity)); + Assert.AreEqual(0, SmallSingle.SingleToByte315(-float.Epsilon)); + Assert.AreEqual(0, SmallSingle.SingleToByte315(-float.MaxValue)); + Assert.AreEqual(0, SmallSingle.SingleToByte315(float.NegativeInfinity)); // up iterations for more exhaustive test after changing something int num = AtLeast(100000); @@ -146,13 +146,13 @@ namespace Lucene.Net.Util continue; } sbyte b1 = Orig_floatToByte(f); - sbyte b2 = SmallFloat.SingleToByte(f, 3, 15); - sbyte b3 = SmallFloat.SingleToByte315(f); + sbyte b2 = SmallSingle.SingleToByte(f, 3, 15); + sbyte b3 = SmallSingle.SingleToByte315(f); Assert.AreEqual(b1, b2); Assert.AreEqual(b2, b3); - sbyte b4 = SmallFloat.SingleToByte(f, 5, 2); - sbyte b5 = SmallFloat.SingleToByte52(f); + sbyte b4 = SmallSingle.SingleToByte(f, 5, 2); + sbyte b5 = SmallSingle.SingleToByte52(f); Assert.AreEqual(b4, b5); } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8b7f4185/src/Lucene.Net.Tests/core/Util/TestUnicodeUtil.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Tests/core/Util/TestUnicodeUtil.cs b/src/Lucene.Net.Tests/core/Util/TestUnicodeUtil.cs index d4d40a7..67dc330 100644 --- a/src/Lucene.Net.Tests/core/Util/TestUnicodeUtil.cs +++ b/src/Lucene.Net.Tests/core/Util/TestUnicodeUtil.cs @@ -158,7 +158,7 @@ namespace Lucene.Net.Util public virtual void TestUTF8toUTF32() { BytesRef utf8 = new BytesRef(20); - IntsRef utf32 = new IntsRef(20); + Int32sRef utf32 = new Int32sRef(20); int[] codePoints = new int[20]; int num = AtLeast(50000); for (int i = 0; i < num; i++)
