You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by cc...@apache.org on 2011/11/12 12:26:32 UTC

[Lucene.Net] svn commit: r1201246 - in /incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core: UpdatedTests.txt Util/LuceneTestCase.cs Util/TestAttributeSource.cs Util/TestCloseableThreadLocal.cs Util/TestFieldCacheSanityChecker.cs Util/TestNumericUtils.cs

Author: ccurrens
Date: Sat Nov 12 11:26:31 2011
New Revision: 1201246

URL: http://svn.apache.org/viewvc?rev=1201246&view=rev
Log:
updated a few tests.  Many more still broken.

Modified:
    incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/UpdatedTests.txt
    incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/LuceneTestCase.cs
    incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/TestAttributeSource.cs
    incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/TestCloseableThreadLocal.cs
    incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/TestFieldCacheSanityChecker.cs
    incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/TestNumericUtils.cs

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/UpdatedTests.txt
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/UpdatedTests.txt?rev=1201246&r1=1201245&r2=1201246&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/UpdatedTests.txt (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/UpdatedTests.txt Sat Nov 12 11:26:31 2011
@@ -3,12 +3,12 @@ util\_TestUtil.java - DONE
 util\ArrayUtilTest.java - IDENTICAL
 util\English.java - Text files are different
 util\util\util\LocalizedTestCase.java - DONE
-util\LuceneTestCase.java - Text files are different
-util\TestAttributeSource.java - Text files are different
-util\util\TestBitVector.java - Text files are different
-util\TestCloseableThreadLocal.java - Text files are different
-util\TestFieldCacheSanityChecker.java - Text files are different
-util\TestIndexableBinaryStringTools.java - Text files are different
+util\LuceneTestCase.java - DONE
+util\TestAttributeSource.java - DONE
+util\util\TestBitVector.java - DONE
+util\TestCloseableThreadLocal.java - DONE? * Had to add type parameters to CloseableThreadLocal that java didn't require?
+util\TestFieldCacheSanityChecker.java - DONE
+util\TestIndexableBinaryStringTools.java - DONE
 util\TestNumericUtils.java - Text files are different
 util\TestOpenBitSet.java - IDENTICAL
 util\TestPriorityQueue.java - Text files are different

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/LuceneTestCase.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/LuceneTestCase.cs?rev=1201246&r1=1201245&r2=1201246&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/LuceneTestCase.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/LuceneTestCase.cs Sat Nov 12 11:26:31 2011
@@ -115,12 +115,8 @@ namespace Lucene.Net.Util
 				PurgeFieldCache(Lucene.Net.Search.FieldCache_Fields.DEFAULT);
 			}
 			
-			TokenStream.SetOnlyUseNewAPI(savedAPISetting);
 			//base.TearDown();  // {{Aroush-2.9}}
-            this.seed_init = false;
-
-            //{{Lucene.Net-2.9.1}}
-            Lucene.Net.Search.BooleanQuery.SetAllowDocsOutOfOrder(allowDocsOutOfOrder); 
+            this.seed = null;
 		}
 		
 		/// <summary> Asserts that FieldCacheSanityChecker does not detect any 
@@ -216,7 +212,7 @@ namespace Lucene.Net.Util
 		/// </summary>
 		public virtual System.Random NewRandom()
 		{
-			if (seed_init != false)
+			if (this.seed != null)
 			{
 				throw new System.SystemException("please call LuceneTestCase.newRandom only once per test");
 			}
@@ -229,11 +225,10 @@ namespace Lucene.Net.Util
 		/// </summary>
 		public virtual System.Random NewRandom(int seed)
 		{
-			if (this.seed_init != false)
+			if (this.seed != null)
 			{
 				throw new System.SystemException("please call LuceneTestCase.newRandom only once per test");
 			}
-            this.seed_init = true;
 			this.seed = seed;
 			return new System.Random(seed);
 		}
@@ -243,13 +238,13 @@ namespace Lucene.Net.Util
 		{
 			try
 			{
-				seed_init = false;
+				this.seed = null;
 				//base.RunBare(); // {{Aroush-2.9}}
                 System.Diagnostics.Debug.Fail("Port issue:", "base.RunBare()"); // {{Aroush-2.9}}
 			}
 			catch (System.Exception e)
 			{
-				if (seed_init != false)
+				if (this.seed != null)
 				{
 					System.Console.Out.WriteLine("NOTE: random seed of testcase '" + GetType() + "' was: " + seed);
 				}
@@ -259,8 +254,8 @@ namespace Lucene.Net.Util
 		
 		// recorded seed
 		[NonSerialized]
-		protected internal int seed = 0;
-        protected internal bool seed_init = false;
+		protected internal int? seed = null;
+        //protected internal bool seed_init = false;
 		
 		// static members
 		[NonSerialized]

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/TestAttributeSource.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/TestAttributeSource.cs?rev=1201246&r1=1201245&r2=1201246&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/TestAttributeSource.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/TestAttributeSource.cs Sat Nov 12 11:26:31 2011
@@ -20,6 +20,7 @@ using System;
 using NUnit.Framework;
 
 using Token = Lucene.Net.Analysis.Token;
+using FlagsAttribute = Lucene.Net.Analysis.Tokenattributes.FlagsAttribute;
 using Lucene.Net.Analysis.Tokenattributes;
 
 namespace Lucene.Net.Util
@@ -34,8 +35,8 @@ namespace Lucene.Net.Util
         {
             // init a first instance
             AttributeSource src = new AttributeSource();
-            TermAttribute termAtt = (TermAttribute)src.AddAttribute(typeof(TermAttribute));
-            TypeAttribute typeAtt = (TypeAttribute)src.AddAttribute(typeof(TypeAttribute));
+            TermAttribute termAtt = src.AddAttribute<TermAttribute>();
+            TypeAttribute typeAtt = src.AddAttribute<TypeAttribute>();
             termAtt.SetTermBuffer("TestTerm");
             typeAtt.SetType("TestType");
             int hashCode = src.GetHashCode();
@@ -54,17 +55,17 @@ namespace Lucene.Net.Util
 
             // restore into an exact configured copy
             AttributeSource copy = new AttributeSource();
-            copy.AddAttribute(typeof(TermAttribute));
-            copy.AddAttribute(typeof(TypeAttribute));
+            copy.AddAttribute<TermAttribute>();
+            copy.AddAttribute<TypeAttribute>();
             copy.RestoreState(state);
             Assert.AreEqual(src.GetHashCode(), copy.GetHashCode(), "Both AttributeSources should have same hashCode after restore");
             Assert.AreEqual(src, copy, "Both AttributeSources should be equal after restore");
 
             // init a second instance (with attributes in different order and one additional attribute)
             AttributeSource src2 = new AttributeSource();
-            typeAtt = (TypeAttribute)src2.AddAttribute(typeof(TypeAttribute));
-            Lucene.Net.Analysis.Tokenattributes.FlagsAttribute flagsAtt = (Lucene.Net.Analysis.Tokenattributes.FlagsAttribute)src2.AddAttribute(typeof(Lucene.Net.Analysis.Tokenattributes.FlagsAttribute));
-            termAtt = (TermAttribute)src2.AddAttribute(typeof(TermAttribute));
+            typeAtt = src2.AddAttribute<TypeAttribute>();
+            FlagsAttribute flagsAtt = src2.AddAttribute<FlagsAttribute>();
+            termAtt = src2.AddAttribute<TermAttribute>();
             flagsAtt.SetFlags(12345);
 
             src2.RestoreState(state);
@@ -74,7 +75,7 @@ namespace Lucene.Net.Util
 
             // init a third instance missing one Attribute
             AttributeSource src3 = new AttributeSource();
-            termAtt = (TermAttribute)src3.AddAttribute(typeof(TermAttribute));
+            termAtt = src3.AddAttribute<TermAttribute>();
             try
             {
                 src3.RestoreState(state);
@@ -90,21 +91,21 @@ namespace Lucene.Net.Util
         public virtual void TestCloneAttributes()
         {
             AttributeSource src = new AttributeSource();
-            TermAttribute termAtt = (TermAttribute)src.AddAttribute(typeof(TermAttribute));
-            TypeAttribute typeAtt = (TypeAttribute)src.AddAttribute(typeof(TypeAttribute));
+            TermAttribute termAtt = src.AddAttribute<TermAttribute>();
+            TypeAttribute typeAtt = src.AddAttribute<TypeAttribute>();
             termAtt.SetTermBuffer("TestTerm");
             typeAtt.SetType("TestType");
 
             AttributeSource clone = src.CloneAttributes();
-            System.Collections.IEnumerator it = clone.GetAttributeClassesIterator().GetEnumerator();
+            System.Collections.Generic.IEnumerator<Type> it = clone.GetAttributeClassesIterator().GetEnumerator();
             Assert.IsTrue(it.MoveNext());
             Assert.AreEqual(typeof(TermAttribute), it.Current, "TermAttribute must be the first attribute");
             Assert.IsTrue(it.MoveNext());
             Assert.AreEqual(typeof(TypeAttribute), it.Current, "TypeAttribute must be the second attribute");
             Assert.IsFalse(it.MoveNext(), "No more attributes");
 
-            TermAttribute termAtt2 = (TermAttribute)clone.GetAttribute(typeof(TermAttribute));
-            TypeAttribute typeAtt2 = (TypeAttribute)clone.GetAttribute(typeof(TypeAttribute));
+            TermAttribute termAtt2 = clone.GetAttribute<TermAttribute>();
+            TypeAttribute typeAtt2 = clone.GetAttribute<TypeAttribute>();
             Assert.IsFalse(ReferenceEquals(termAtt2, termAtt), "TermAttribute of original and clone must be different instances");
             Assert.IsFalse(ReferenceEquals(typeAtt2, typeAtt), "TypeAttribute of original and clone must be different instances");
             Assert.AreEqual(termAtt2, termAtt, "TermAttribute of original and clone must be equal");
@@ -115,8 +116,8 @@ namespace Lucene.Net.Util
         public virtual void TestToStringAndMultiAttributeImplementations()
         {
             AttributeSource src = new AttributeSource();
-            TermAttribute termAtt = (TermAttribute)src.AddAttribute(typeof(TermAttribute));
-            TypeAttribute typeAtt = (TypeAttribute)src.AddAttribute(typeof(TypeAttribute));
+            TermAttribute termAtt = src.AddAttribute<TermAttribute>();
+            TypeAttribute typeAtt = src.AddAttribute<TypeAttribute>();
             termAtt.SetTermBuffer("TestTerm");
             typeAtt.SetType("TestType");
             Assert.AreEqual("(" + termAtt.ToString() + "," + typeAtt.ToString() + ")", src.ToString(), "Attributes should appear in original order");
@@ -130,7 +131,7 @@ namespace Lucene.Net.Util
             src = new AttributeSource();
             src.AddAttributeImpl(new Token());
             // this should not add a new attribute as Token implements TermAttribute, too
-            termAtt = (TermAttribute)src.AddAttribute(typeof(TermAttribute));
+            termAtt = src.AddAttribute<TermAttribute>();
             Assert.IsTrue(termAtt is Token, "TermAttribute should be implemented by Token");
             // get the Token attribute and check, that it is the only one
             it = src.GetAttributeImplsIterator().GetEnumerator();
@@ -143,23 +144,50 @@ namespace Lucene.Net.Util
         }
 
         [Test]
+        public void TestDefaultAttributeFactory()
+        {
+            AttributeSource src = new AttributeSource();
+
+            Assert.IsTrue(src.AddAttribute<TermAttribute>() is TermAttributeImpl,
+                          "TermAttribute is not implemented by TermAttributeImpl");
+            Assert.IsTrue(src.AddAttribute<OffsetAttribute>() is OffsetAttributeImpl,
+                          "OffsetAttribute is not implemented by OffsetAttributeImpl");
+            Assert.IsTrue(src.AddAttribute<FlagsAttribute>() is FlagsAttributeImpl,
+                          "FlagsAttribute is not implemented by FlagsAttributeImpl");
+            Assert.IsTrue(src.AddAttribute<PayloadAttribute>() is PayloadAttributeImpl,
+                          "PayloadAttribute is not implemented by PayloadAttributeImpl");
+            Assert.IsTrue(src.AddAttribute<PositionIncrementAttribute>() is PositionIncrementAttributeImpl,
+                          "PositionIncrementAttribute is not implemented by PositionIncrementAttributeImpl");
+            Assert.IsTrue(src.AddAttribute<TypeAttribute>() is TypeAttributeImpl,
+                          "TypeAttribute is not implemented by TypeAttributeImpl");
+        }
+
+        [Test]
         public void TestInvalidArguments()
         {
             try
             {
                 AttributeSource src = new AttributeSource();
-                src.AddAttribute(typeof(Token));
-                Assert.Fail("Should throw IllegalArgumentException");
+                src.AddAttribute<Token>();
+                Assert.Fail("Should throw ArgumentException");
             }
             catch (ArgumentException iae) { }
 
             try
             {
                 AttributeSource src = new AttributeSource();
-                src.AddAttribute(typeof(System.Collections.IEnumerator));
+                src.AddAttribute<Token>();
                 Assert.Fail("Should throw IllegalArgumentException");
             }
             catch (ArgumentException iae) { }
+
+            //try
+            //{
+            //    AttributeSource src = new AttributeSource();
+            //    src.AddAttribute<System.Collections.IEnumerator>(); //Doesn't compile.
+            //    Assert.Fail("Should throw IllegalArgumentException");
+            //}
+            //catch (ArgumentException iae) { }
         }
     }
     

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/TestCloseableThreadLocal.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/TestCloseableThreadLocal.cs?rev=1201246&r1=1201245&r2=1201246&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/TestCloseableThreadLocal.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/TestCloseableThreadLocal.cs Sat Nov 12 11:26:31 2011
@@ -50,12 +50,12 @@ namespace Lucene.Net.Util
 		{
 			// LUCENE-1805: make sure default get returns null,
 			// twice in a row
-			CloseableThreadLocal ctl = new CloseableThreadLocal();
+            CloseableThreadLocal<object> ctl = new CloseableThreadLocal<object>();
 			Assert.IsNull(ctl.Get());
 			Assert.IsNull(ctl.Get());
 		}
-		
-		public class InitValueThreadLocal:CloseableThreadLocal
+
+        public class InitValueThreadLocal : CloseableThreadLocal<object>
 		{
 			public InitValueThreadLocal(TestCloseableThreadLocal enclosingInstance)
 			{

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/TestFieldCacheSanityChecker.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/TestFieldCacheSanityChecker.cs?rev=1201246&r1=1201245&r2=1201246&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/TestFieldCacheSanityChecker.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/TestFieldCacheSanityChecker.cs Sat Nov 12 11:26:31 2011
@@ -80,8 +80,8 @@ namespace Lucene.Net.Util
 			}
 			wA.Close();
 			wB.Close();
-			readerA = IndexReader.Open(dirA);
-			readerB = IndexReader.Open(dirB);
+			readerA = IndexReader.Open(dirA, true);
+			readerB = IndexReader.Open(dirB, true);
 			readerX = new MultiReader(new IndexReader[]{readerA, readerB});
 		}
 		

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/TestNumericUtils.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/TestNumericUtils.cs?rev=1201246&r1=1201245&r2=1201246&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/TestNumericUtils.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/core/Util/TestNumericUtils.cs Sat Nov 12 11:26:31 2011
@@ -16,6 +16,8 @@
  */
 
 using System;
+using System.Collections.Generic;
+using System.Linq;
 using Lucene.Net.Support;
 using NUnit.Framework;
 
@@ -71,28 +73,17 @@ namespace Lucene.Net.Util
 				// make unsigned longs for easier display and understanding
 				min ^= unchecked((long) 0x8000000000000000L);
 				max ^= unchecked((long) 0x8000000000000000L);
-				//System.out.println("new Long(0x"+Long.toHexString(min>>>shift)+"L),new Long(0x"+Long.toHexString(max>>>shift)+"L),");
+				//System.out.println("Long.valueOf(0x"+Long.toHexString(min>>>shift)+"L),Long.valueOf(0x"+Long.toHexString(max>>>shift)+"L)/*shift="+shift+"*/,");
                 neededShifts.MoveNext();
                 Assert.AreEqual(((Int32)neededShifts.Current), shift, "shift");
                 neededBounds.MoveNext();
-                try
+                unchecked
                 {
-                    Assert.AreEqual(neededBounds.Current, (ulong)Number.URShift(min, shift), "inner min bound");
+                    Assert.AreEqual((long)neededBounds.Current, (ulong) Number.URShift(min, shift), "inner min bound");
+                    neededBounds.MoveNext();
+                    Assert.AreEqual((long)neededBounds.Current, (ulong)Number.URShift(max, shift), "inner max bound");
                 }
-                catch (OverflowException)
-                {
-                    Assert.AreEqual((long)neededBounds.Current, Number.URShift(min, shift), "inner min bound");
-                }
-                neededBounds.MoveNext();
-                try
-                {
-                    Assert.AreEqual(neededBounds.Current, (ulong)Number.URShift(max, shift), "inner max bound");
-                }
-                catch (OverflowException)
-                {
-                    Assert.AreEqual((long)neededBounds.Current, Number.URShift(max, shift), "inner max bound");
-                }
-            }
+			}
 		}
 
 		private class AnonymousClassIntRangeBuilder:NumericUtils.IntRangeBuilder
@@ -320,88 +311,90 @@ namespace Lucene.Net.Util
 		// INFO: Tests for trieCodeLong()/trieCodeInt() not needed because implicitely tested by range filter tests
 		
 		/// <summary>Note: The neededBounds iterator must be unsigned (easier understanding what's happening) </summary>
-		internal virtual void  AssertLongRangeSplit(long lower, long upper, int precisionStep, bool useBitSet, System.Collections.IEnumerator neededBounds, System.Collections.IEnumerator neededShifts)
+        internal virtual void AssertLongRangeSplit(long lower, long upper, int precisionStep, bool useBitSet, IEnumerator<long> neededBounds, IEnumerator<int> neededShifts)
 		{
-			OpenBitSet bits = useBitSet?new OpenBitSet(upper - lower + 1):null;
-			
-			NumericUtils.SplitLongRange(new AnonymousClassLongRangeBuilder(lower, upper, useBitSet, bits, neededBounds,neededShifts,this), precisionStep, lower, upper);
-			
-			if (useBitSet)
-			{
-				// after flipping all bits in the range, the cardinality should be zero
-				bits.Flip(0, upper - lower + 1);
-				Assert.IsTrue(bits.IsEmpty(), "The sub-range concenated should match the whole range");
-			}
+		    OpenBitSet bits = useBitSet ? new OpenBitSet(upper - lower + 1) : null;
+
+		    NumericUtils.SplitLongRange(
+		        new AnonymousClassLongRangeBuilder(lower, upper, useBitSet, bits, neededBounds, neededShifts, this),
+		        precisionStep, lower, upper);
+
+		    if (useBitSet)
+		    {
+		        // after flipping all bits in the range, the cardinality should be zero
+		        bits.Flip(0, upper - lower + 1);
+		        Assert.IsTrue(bits.IsEmpty(), "The sub-range concenated should match the whole range");
+		    }
 		}
-		
-         /** LUCENE-2541: NumericRangeQuery errors with endpoints near long min and max values */
+
+        /** LUCENE-2541: NumericRangeQuery errors with endpoints near long min and max values */
         [Test]
         public void TestLongExtremeValues()
         {
             // upper end extremes
             AssertLongRangeSplit(long.MaxValue, long.MaxValue, 1, true,
-                new ulong[] { 0xffffffffffffffffL, 0xffffffffffffffffL }.GetEnumerator(),
-                new int[] { 0 }.GetEnumerator());
+                new ulong[] { 0xffffffffffffffffL, 0xffffffffffffffffL }.Cast<long>().GetEnumerator(),
+                new int[] { 0 }.AsEnumerable().GetEnumerator());
 
             AssertLongRangeSplit(long.MaxValue, long.MaxValue, 2, true,
-                new ulong[] { 0xffffffffffffffffL, 0xffffffffffffffffL }.GetEnumerator(),
-                new int[] { 0 }.GetEnumerator());
+                new ulong[] { 0xffffffffffffffffL, 0xffffffffffffffffL }.Cast<long>().GetEnumerator(),
+                new int[] { 0 }.AsEnumerable().GetEnumerator());
 
             AssertLongRangeSplit(long.MaxValue, long.MaxValue, 4, true,
-                new ulong[] { 0xffffffffffffffffL, 0xffffffffffffffffL }.GetEnumerator(),
-                new int[] { 0 }.GetEnumerator());
+                new ulong[] { 0xffffffffffffffffL, 0xffffffffffffffffL }.Cast<long>().GetEnumerator(),
+                new int[] { 0 }.AsEnumerable().GetEnumerator());
 
             AssertLongRangeSplit(long.MaxValue, long.MaxValue, 6, true,
-                new ulong[] { 0xffffffffffffffffL, 0xffffffffffffffffL }.GetEnumerator(),
-                new int[] { 0 }.GetEnumerator());
+                new ulong[] { 0xffffffffffffffffL, 0xffffffffffffffffL }.Cast<long>().GetEnumerator(),
+                new int[] { 0 }.AsEnumerable().GetEnumerator());
 
             AssertLongRangeSplit(long.MaxValue, long.MaxValue, 8, true,
-                new ulong[] { 0xffffffffffffffffL, 0xffffffffffffffffL }.GetEnumerator(),
-                new int[] { 0 }.GetEnumerator());
+                new ulong[] { 0xffffffffffffffffL, 0xffffffffffffffffL }.Cast<long>().GetEnumerator(),
+                new int[] { 0 }.AsEnumerable().GetEnumerator());
 
             AssertLongRangeSplit(long.MaxValue, long.MaxValue, 64, true,
-                new ulong[] { 0xffffffffffffffffL, 0xffffffffffffffffL }.GetEnumerator(),
-                new int[] { 0 }.GetEnumerator());
+                new ulong[] { 0xffffffffffffffffL, 0xffffffffffffffffL }.Cast<long>().GetEnumerator(),
+                new int[] { 0 }.AsEnumerable().GetEnumerator());
             
             AssertLongRangeSplit(long.MaxValue - 0xfL, long.MaxValue, 4, true,
-                new ulong[] { 0xfffffffffffffffL, 0xfffffffffffffffL }.GetEnumerator(),
-                new int[] { 4 }.GetEnumerator());
+                new ulong[] { 0xfffffffffffffffL, 0xfffffffffffffffL }.Cast<long>().GetEnumerator(),
+                new int[] { 4 }.AsEnumerable().GetEnumerator());
             AssertLongRangeSplit(long.MaxValue - 0x10L, long.MaxValue, 4, true,
-                new ulong[] { 0xffffffffffffffefL, 0xffffffffffffffefL, 0xfffffffffffffffL, 0xfffffffffffffffL }.GetEnumerator(),
-                new int[] { 0, 4 }.GetEnumerator());
+                new ulong[] { 0xffffffffffffffefL, 0xffffffffffffffefL, 0xfffffffffffffffL, 0xfffffffffffffffL }.Cast<long>().GetEnumerator(),
+                new int[] { 0, 4 }.AsEnumerable().GetEnumerator());
 
             // lower end extremes
             AssertLongRangeSplit(long.MinValue, long.MinValue, 1, true,
-                new long[] { 0x0000000000000000L, 0x0000000000000000L }.GetEnumerator(),
-                new int[] { 0 }.GetEnumerator());
+                new long[] { 0x0000000000000000L, 0x0000000000000000L }.Cast<long>().GetEnumerator(),
+                new int[] { 0 }.AsEnumerable().GetEnumerator());
 
             AssertLongRangeSplit(long.MinValue, long.MinValue, 2, true,
-                new long[] { 0x0000000000000000L, 0x0000000000000000L }.GetEnumerator(),
-                new int[] { 0 }.GetEnumerator());
+                new long[] { 0x0000000000000000L, 0x0000000000000000L }.Cast<long>().GetEnumerator(),
+                new int[] { 0 }.AsEnumerable().GetEnumerator());
 
             AssertLongRangeSplit(long.MinValue, long.MinValue, 4, true,
-                new long[] { 0x0000000000000000L, 0x0000000000000000L }.GetEnumerator(),
-                new int[] { 0 }.GetEnumerator());
+                new long[] { 0x0000000000000000L, 0x0000000000000000L }.Cast<long>().GetEnumerator(),
+                new int[] { 0 }.AsEnumerable().GetEnumerator());
 
             AssertLongRangeSplit(long.MinValue, long.MinValue, 6, true,
-                new long[] { 0x0000000000000000L, 0x0000000000000000L }.GetEnumerator(),
-                new int[] { 0 }.GetEnumerator());
+                new long[] { 0x0000000000000000L, 0x0000000000000000L }.Cast<long>().GetEnumerator(),
+                new int[] { 0 }.AsEnumerable().GetEnumerator());
 
             AssertLongRangeSplit(long.MinValue, long.MinValue, 8, true,
-                new long[] { 0x0000000000000000L, 0x0000000000000000L }.GetEnumerator(),
-                new int[] { 0 }.GetEnumerator());
+                new long[] { 0x0000000000000000L, 0x0000000000000000L }.Cast<long>().GetEnumerator(),
+                new int[] { 0 }.AsEnumerable().GetEnumerator());
 
             AssertLongRangeSplit(long.MinValue, long.MinValue, 64, true,
-                new long[] { 0x0000000000000000L, 0x0000000000000000L }.GetEnumerator(),
-                new int[] { 0 }.GetEnumerator());
+                new long[] { 0x0000000000000000L, 0x0000000000000000L }.Cast<long>().GetEnumerator(),
+                new int[] { 0 }.AsEnumerable().GetEnumerator());
 
 
             AssertLongRangeSplit(long.MinValue, long.MinValue + 0xfL, 4, true,
-                new long[] { 0x000000000000000L, 0x000000000000000L }.GetEnumerator(),
-                new int[] { 4 }.GetEnumerator());
+                new long[] { 0x000000000000000L, 0x000000000000000L }.Cast<long>().GetEnumerator(),
+                new int[] { 4 }.AsEnumerable().GetEnumerator());
             AssertLongRangeSplit(long.MinValue, long.MinValue + 0x10L, 4, true,
-                new long[] { 0x0000000000000010L, 0x0000000000000010L, 0x000000000000000L, 0x000000000000000L }.GetEnumerator(),
-                new int[] { 0, 4 }.GetEnumerator());
+                new long[] { 0x0000000000000010L, 0x0000000000000010L, 0x000000000000000L, 0x000000000000000L }.Cast<long>().GetEnumerator(),
+                new int[] { 0, 4 }.AsEnumerable().GetEnumerator());
         }
 
         [Test]
@@ -459,39 +452,66 @@ namespace Lucene.Net.Util
 		public void  TestSplitLongRange()
 		{
 			// a hard-coded "standard" range
-			AssertLongRangeSplit(- 5000L, 9500L, 4, true, new System.Collections.ArrayList(new System.Int64[]{0x7fffffffffffec78L, 0x7fffffffffffec7fL, unchecked((long) (0x8000000000002510L)), unchecked((long) (0x800000000000251cL)), 0x7fffffffffffec8L, 0x7fffffffffffecfL, 0x800000000000250L, 0x800000000000250L, 0x7fffffffffffedL, 0x7fffffffffffefL, 0x80000000000020L, 0x80000000000024L, 0x7ffffffffffffL, 0x8000000000001L}).GetEnumerator(),new int[]{0,0,4,4,8,8,12}.GetEnumerator());
+            AssertLongRangeSplit(- 5000L, 9500L, 4, true,
+                                 new System.Int64[]
+                                     {
+                                         0x7fffffffffffec78L, 0x7fffffffffffec7fL, unchecked((long) (0x8000000000002510L)),
+                                         unchecked((long) (0x800000000000251cL)), 0x7fffffffffffec8L, 0x7fffffffffffecfL,
+                                         0x800000000000250L, 0x800000000000250L, 0x7fffffffffffedL, 0x7fffffffffffefL,
+                                         0x80000000000020L, 0x80000000000024L, 0x7ffffffffffffL, 0x8000000000001L
+                                     }.Cast<long>().GetEnumerator(), new int[] {0, 0, 4, 4, 8, 8, 12}.Cast<int>().GetEnumerator());
 			
 			// the same with no range splitting
-            AssertLongRangeSplit(-5000L, 9500L, 64, true, new System.Collections.ArrayList(new System.Int64[] { 0x7fffffffffffec78L, unchecked((long)(0x800000000000251cL)) }).GetEnumerator(), new int[] { 0 }.GetEnumerator());
+            AssertLongRangeSplit(-5000L, 9500L, 64, true,
+                                 new System.Int64[] {0x7fffffffffffec78L, unchecked((long) (0x800000000000251cL))}.Cast
+                                     <long>().GetEnumerator(), new int[] { 0 }.Cast<int>().GetEnumerator());
 			
 			// this tests optimized range splitting, if one of the inner bounds
 			// is also the bound of the next lower precision, it should be used completely
-            AssertLongRangeSplit(0L, 1024L + 63L, 4, true, new System.Collections.ArrayList(new System.Int64[] { 0x800000000000040L, 0x800000000000043L, 0x80000000000000L, 0x80000000000003L }).GetEnumerator(), new int[] {4,8}.GetEnumerator());
+            AssertLongRangeSplit(0L, 1024L + 63L, 4, true,
+                                 new System.Int64[]
+                                     {0x800000000000040L, 0x800000000000043L, 0x80000000000000L, 0x80000000000003L}.Cast
+                                     <long>().GetEnumerator(), new int[] { 4, 8 }.Cast<int>().GetEnumerator());
 			
 			// the full long range should only consist of a lowest precision range; no bitset testing here, as too much memory needed :-)
-            AssertLongRangeSplit(System.Int64.MinValue, System.Int64.MaxValue, 8, false, new System.Collections.ArrayList(new System.Int64[] { 0x00L, 0xffL }).GetEnumerator(), new int[] {56}.GetEnumerator());
+            AssertLongRangeSplit(System.Int64.MinValue, System.Int64.MaxValue, 8, false,
+                                 new System.Int64[] {0x00L, 0xffL}.Cast<long>().GetEnumerator(),
+                                 new int[] { 56 }.Cast<int>().GetEnumerator());
 			
 			// the same with precisionStep=4
-            AssertLongRangeSplit(System.Int64.MinValue, System.Int64.MaxValue, 4, false, new System.Collections.ArrayList(new System.Int64[] { 0x0L, 0xfL }).GetEnumerator(), new int[] {60}.GetEnumerator());
+            AssertLongRangeSplit(System.Int64.MinValue, System.Int64.MaxValue, 4, false,
+                                 new System.Int64[] {0x0L, 0xfL}.Cast<long>().GetEnumerator(),
+                                 new int[] { 60 }.Cast<int>().GetEnumerator());
 			
 			// the same with precisionStep=2
-            AssertLongRangeSplit(System.Int64.MinValue, System.Int64.MaxValue, 2, false, new System.Collections.ArrayList(new System.Int64[] { 0x0L, 0x3L }).GetEnumerator(), new int[] {62}.GetEnumerator());
+            AssertLongRangeSplit(System.Int64.MinValue, System.Int64.MaxValue, 2, false,
+                                 new System.Int64[] {0x0L, 0x3L}.Cast<long>().GetEnumerator(),
+                                 new int[] {62}.Cast<int>().GetEnumerator());
 			
 			// the same with precisionStep=1
-            AssertLongRangeSplit(System.Int64.MinValue, System.Int64.MaxValue, 1, false, new System.Collections.ArrayList(new System.Int64[] { 0x0L, 0x1L }).GetEnumerator(), new int[] {63}.GetEnumerator());
+            AssertLongRangeSplit(System.Int64.MinValue, System.Int64.MaxValue, 1, false,
+                                 new System.Int64[] {0x0L, 0x1L}.ToList().GetEnumerator(),
+                                 new int[] {63}.Cast<int>().GetEnumerator());
 			
 			// a inverse range should produce no sub-ranges
-            AssertLongRangeSplit(9500L, -5000L, 4, false, ((System.Collections.IList)System.Collections.ArrayList.ReadOnly(new System.Collections.ArrayList())).GetEnumerator(), new int[] { }.GetEnumerator());
+            AssertLongRangeSplit(9500L, -5000L, 4, false,
+                                 Enumerable.Empty<long>().GetEnumerator(),
+                                 new int[] {}.Cast<int>().GetEnumerator());
 			
 			// a 0-length range should reproduce the range itsself
-            AssertLongRangeSplit(9500L, 9500L, 4, false, new System.Collections.ArrayList(new System.Int64[] { unchecked((long)(0x800000000000251cL)), unchecked((long)(0x800000000000251cL)) }).GetEnumerator(), new int[] {0}.GetEnumerator());
+            AssertLongRangeSplit(9500L, 9500L, 4, false, new long[]
+                                                             {
+                                                                 unchecked((long) (0x800000000000251cL)),
+                                                                 unchecked((long) (0x800000000000251cL))
+                                                             }.Cast<long>().GetEnumerator(),
+                                 new int[] {0}.Cast<int>().GetEnumerator());
 		}
 		
 
 		/// <summary>Note: The neededBounds iterator must be unsigned (easier understanding what's happening) </summary>
 		protected internal virtual void  AssertIntRangeSplit(int lower, int upper, int precisionStep, bool useBitSet, System.Collections.IEnumerator neededBounds,System.Collections.IEnumerator neededShifts)
 		{
-			OpenBitSet bits = useBitSet?new OpenBitSet(upper - lower + 1):null;
+		    OpenBitSet bits = useBitSet ? new OpenBitSet(upper - lower + 1) : null;
 
             NumericUtils.SplitIntRange(new AnonymousClassIntRangeBuilder(lower, upper, useBitSet, bits, neededBounds, neededShifts,this), precisionStep, lower, upper);