You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by mh...@apache.org on 2014/07/21 20:14:10 UTC

[2/7] git commit: Changing Check into an internal class, adding interfaces IAccountable, IAttribute, IBits. Adding and testing MarkAllBits and MarkNoBits. Adding initial placeholder for porting guidance.

Changing Check into an internal class, adding interfaces IAccountable, IAttribute, IBits. Adding and testing MarkAllBits and MarkNoBits. Adding initial placeholder for porting guidance.


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/ca04ae4f
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/ca04ae4f
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/ca04ae4f

Branch: refs/heads/pcl
Commit: ca04ae4f0f43c5d92099cfb13bca73fda38ec494
Parents: d416bcc
Author: Michael Herndon <mh...@michaelherndon.com>
Authored: Sun Jul 20 16:38:04 2014 -0400
Committer: Michael Herndon <mh...@michaelherndon.com>
Committed: Sun Jul 20 16:38:04 2014 -0400

----------------------------------------------------------------------
 docs/porting-guidance.md                        | 133 +++++++++++++++++++
 src/Lucene.Net.Core/Check.cs                    |  16 ++-
 src/Lucene.Net.Core/Lucene.Net.Core.csproj      |   4 +
 src/Lucene.Net.Core/Lucene.Net.Core.kproj       |   4 +
 src/Lucene.Net.Core/Util/Bits.cs                | 117 ++++++++++++++++
 src/Lucene.Net.Core/Util/IAccountable.cs        |  35 +++++
 src/Lucene.Net.Core/Util/IAttribute.cs          |  31 +++++
 src/Lucene.Net.Core/Util/IBits.cs               |  45 +++++++
 src/Lucene.Net.Core/Util/Version.cs             |  10 +-
 .../Lucene.Net.Core.Tests.csproj                |   1 +
 .../Lucene.Net.Core.Tests.kproj                 |   1 +
 test/Lucene.Net.Core.Tests/Util/TestBits.cs     |  90 +++++++++++++
 test/Lucene.Net.Core.Tests/Util/TestVersion.cs  |   4 +-
 13 files changed, 482 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ca04ae4f/docs/porting-guidance.md
----------------------------------------------------------------------
diff --git a/docs/porting-guidance.md b/docs/porting-guidance.md
new file mode 100644
index 0000000..d7fdcfa
--- /dev/null
+++ b/docs/porting-guidance.md
@@ -0,0 +1,133 @@
+# Porting Guidance
+
+(work in progress)
+
+There are differences between C# and Java at the language level and there are differences at the framework level.
+
+
+## Language Level Differences
+
+
+### Flexible interfaces and enums.
+
+Java allows classes in interfaces and methods inside of enums.  In C#, both these cases are illegal and will lead to compile errors.
+
+```java
+
+/**
+ * interface with nested class
+ */
+public interface Bits
+{
+    public boolean get(int index);
+
+    public int length();
+
+
+    public class MatchAllBits: Bits
+    {   
+        final int len;
+
+        public MatchAllBits(int len) {
+            this.len = len;
+        }
+
+        @Override
+        public boolean get(int index) {
+          return true;
+        }
+
+        @Override
+        public int length() {
+          return len;
+        }
+    }
+}
+
+
+/**
+ *
+ */
+public enum Version {
+    
+    @Deprecated
+    LUCENE_4_10,
+
+    LUCENE_5_0,
+
+    @Deprecated
+    LUCENE_CURRENT
+
+    public boolean onOrAfter(Version other) {
+        return compareTo(other) >= 0;
+    }
+  
+    public static Version parseLeniently(String version) {
+        final String parsedMatchVersion = version
+            .toUpperCase(Locale.ROOT)
+            .replaceFirst("^(\\d+)\\.(\\d+)$", "LUCENE_$1_$2")
+            .replaceFirst("^LUCENE_(\\d)(\\d)$", "LUCENE_$1_$2");
+        return Version.valueOf(parsedMatchVersion);
+    }
+} 
+
+```
+
+When porting the above code in C#, the methods and classes need to extracted. For example, extract the interface into IBits. Extract the methods from the enum into its own static Util class.  
+
+```c#
+public interface IBits
+{
+    bool this[int index];
+
+    int Length { get; set; }
+}
+
+public class Bits
+{
+    public class MatchAllBits: Bits
+    {   
+        final int len;
+
+        public MatchAllBits(int len) {
+            this.len = len;
+        }
+
+        @Override
+        public boolean get(int index) {
+          return true;
+        }
+
+        @Override
+        public int length() {
+          return len;
+        }
+    }
+}
+
+
+public enum Version {
+    
+    @Deprecated
+    LUCENE_4_10,
+
+    LUCENE_5_0,
+
+    @Deprecated
+    LUCENE_CURRENT;
+} 
+
+public static class VersionUtil
+{
+    public static boolean OnOrAfter(Version current, Version other) 
+    {
+        return current.CompareTo(other) >= 0;
+    }
+  
+    public static Version ParseLeniently(String version) 
+    {
+        throw new NotImplementedException();
+    }
+}
+
+```
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ca04ae4f/src/Lucene.Net.Core/Check.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Check.cs b/src/Lucene.Net.Core/Check.cs
index 462d4cf..176a31b 100644
--- a/src/Lucene.Net.Core/Check.cs
+++ b/src/Lucene.Net.Core/Check.cs
@@ -25,12 +25,24 @@ namespace Lucene.Net
     using System.Diagnostics;
 
     /// <summary>
-    /// Summary description for Check
+    /// Checks for code for issues that causes an error. Think of it as the replacement for Guard.
     /// </summary>
-    public static class Check
+    internal static class Check
     {
 
         [DebuggerStepThrough]
+        public static void InRangeOfLength(string argument, int value, int length) 
+        {
+            if (value < 0 || value >= length)
+            {
+                var message = string.Format("{0} must not be less than 0 or "+
+                    "greater than or equal to the Length, {1}. {0} was {2}", argument, length, value);
+
+                throw new IndexOutOfRangeException(message);
+            }
+        }
+
+        [DebuggerStepThrough]
         public static T NotNull<T>(string argument, T value, bool reference = false)
         {
             if (value == null)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ca04ae4f/src/Lucene.Net.Core/Lucene.Net.Core.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Lucene.Net.Core.csproj b/src/Lucene.Net.Core/Lucene.Net.Core.csproj
index e18f5fc..045c848 100644
--- a/src/Lucene.Net.Core/Lucene.Net.Core.csproj
+++ b/src/Lucene.Net.Core/Lucene.Net.Core.csproj
@@ -66,6 +66,10 @@
     <Compile Include="Support\ShallowCloneNotSupportedException.cs" />
     <Compile Include="Support\StringExtensionMethods.cs" />
     <Compile Include="Support\SupportExtensionMethods.cs" />
+    <Compile Include="Util\Bits.cs" />
+    <Compile Include="Util\IAccountable.cs" />
+    <Compile Include="Util\IAttribute.cs" />
+    <Compile Include="Util\IBits.cs" />
     <Compile Include="Util\Version.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ca04ae4f/src/Lucene.Net.Core/Lucene.Net.Core.kproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Lucene.Net.Core.kproj b/src/Lucene.Net.Core/Lucene.Net.Core.kproj
index 8ba0ccd..c9f8e62 100644
--- a/src/Lucene.Net.Core/Lucene.Net.Core.kproj
+++ b/src/Lucene.Net.Core/Lucene.Net.Core.kproj
@@ -59,6 +59,10 @@
     <Compile Include="Support\ShallowCloneNotSupportedException.cs" />
     <Compile Include="Support\StringExtensionMethods.cs" />
     <Compile Include="Support\SupportExtensionMethods.cs" />
+    <Compile Include="Util\Bits.cs" />
+    <Compile Include="Util\IAccountable.cs" />
+    <Compile Include="Util\IAttribute.cs" />
+    <Compile Include="Util\IBits.cs" />
     <Compile Include="Util\Version.cs" />
   </ItemGroup>
   <Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ca04ae4f/src/Lucene.Net.Core/Util/Bits.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Bits.cs b/src/Lucene.Net.Core/Util/Bits.cs
new file mode 100644
index 0000000..9c5b9d7
--- /dev/null
+++ b/src/Lucene.Net.Core/Util/Bits.cs
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+namespace Lucene.Net.Util
+{
+    /// <summary>
+    /// Bits contains the classes for <see cref="MatchAllBits"/> and  <see cref="MatchNoBits"/> and the value of an empty array of <see cref="IBits"/>.
+    /// </summary>
+    /// <remarks>
+    ///     <para>
+    ///         Java <see href="https://github.com/apache/lucene-solr/blob/trunk/lucene/core/src/test/org/apache/lucene/util/Bits.java">Source</see>
+    ///         .NET does not support classes in interfaces, so the interface was refactored to <seealso cref="IBits"/>
+    ///     </para>
+    /// </remarks>
+    /// <seealso cref="IBits"/>
+    public static class Bits
+    {
+        public static readonly IBits[] EMPTY_ARRAY = new IBits[0];
+
+        /// <summary>
+        /// Returns true for all bits.
+        /// </summary>
+        public class MatchAllBits : IBits
+        {
+            private readonly int length;
+
+            /// <summary>
+            /// Initializes a new instance of <see cref="MatchAllBits"/>
+            /// </summary>
+            /// <param name="length">The number of bits in the set.</param>
+            public MatchAllBits(int length)
+            {
+                this.length = length;
+            }
+
+            /// <summary>
+            /// Gets the value of the bit at the specified index.
+            /// </summary>
+            /// <param name="index">Zero based index position.  The index value should be non-negative</param>
+            /// <returns>True, if the bit is set, otherwise, false.</returns>
+            /// <exception cref="System.IndexOutOfRangeException">Throws when the index is negative or exceeds the length</exception>
+            public bool this[int index]
+            {
+                get
+                {
+                    Check.InRangeOfLength("index", index, this.Length);
+
+                    return true;
+                }
+            }
+
+            /// <summary>
+            /// Returns the number of bits in the set.
+            /// </summary>
+            public int Length
+            {
+                get { return this.length; }
+            }
+        }
+
+        /// <summary>
+        /// Returns false for all bits.
+        /// </summary>
+        public class MatchNoBits : IBits
+        {
+            private readonly int length;
+
+            /// <summary>
+            /// Initializes a new instance of <see cref="MatchAllBits"/>
+            /// </summary>
+            /// <param name="length">The number of bits in the set.</param>
+            public MatchNoBits(int length)
+            {
+                this.length = length;
+            }
+
+            /// <summary>
+            /// Gets the value of the bit at the specified index.
+            /// </summary>
+            /// <param name="index">Zero based index position.  The index value should be non-negative</param>
+            /// <returns>True, if the bit is set, otherwise, false.</returns>
+            /// <exception cref="System.IndexOutOfRangeException">Throws when the index is negative or exceeds the length</exception>
+            public bool this[int index]
+            {
+                get
+                {
+                    Check.InRangeOfLength("index", index, this.Length);
+
+                    return true;
+                }
+            }
+
+            /// <summary>
+            /// Returns the number of bits in the set.
+            /// </summary>
+            public int Length
+            {
+                get { return this.length; }
+            }
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ca04ae4f/src/Lucene.Net.Core/Util/IAccountable.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/IAccountable.cs b/src/Lucene.Net.Core/Util/IAccountable.cs
new file mode 100644
index 0000000..527b0cc
--- /dev/null
+++ b/src/Lucene.Net.Core/Util/IAccountable.cs
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Lucene.Net.Util
+{
+    /// <summary>
+    /// An object whose RAM usage can be computed. For internal use only.
+    /// </summary>
+    /// <remarks>
+    ///     <para>
+    ///         Java <see href="https://github.com/apache/lucene-solr/blob/trunk/lucene/core/src/test/org/apache/lucene/util/Accountable.java">Source</see>
+    ///     </para>
+    /// </remarks>
+    public interface IAccountable
+    {
+        /// <summary>
+        /// Gets the memory usage of the object in bytes.  Negative values are illegal
+        /// </summary>
+	    long RamBytesUsed { get; }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ca04ae4f/src/Lucene.Net.Core/Util/IAttribute.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/IAttribute.cs b/src/Lucene.Net.Core/Util/IAttribute.cs
new file mode 100644
index 0000000..f7f1ca5
--- /dev/null
+++ b/src/Lucene.Net.Core/Util/IAttribute.cs
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Lucene.Net.Util
+{
+    /// <summary>
+    /// Base interface for attributes
+    /// </summary>
+    /// <remarks>
+    ///     <para>
+    ///         Java <see href="https://github.com/apache/lucene-solr/blob/trunk/lucene/core/src/test/org/apache/lucene/util/Attribute.java">Source</see>
+    ///     </para>
+    /// </remarks>
+    public interface IAttribute
+    { 
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ca04ae4f/src/Lucene.Net.Core/Util/IBits.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/IBits.cs b/src/Lucene.Net.Core/Util/IBits.cs
new file mode 100644
index 0000000..366691e
--- /dev/null
+++ b/src/Lucene.Net.Core/Util/IBits.cs
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Lucene.Net.Util
+{
+    /// <summary>
+    /// Interface for Bitset-like structures.
+    /// </summary>
+    /// <remarks>
+    ///     <para>
+    ///         Java <see href="https://github.com/apache/lucene-solr/blob/trunk/lucene/core/src/test/org/apache/lucene/util/Bits.java">Source</see>
+    ///         .NET does not support classes in interfaces, so the nested classes have been split off into it's own class <seealso cref="Bits"/>
+    ///     </para>
+    /// </remarks>
+    /// <seealso cref="Bits"/>
+    public interface IBits
+    {
+        /// <summary>
+        /// Returns the number of bits in the set.
+        /// </summary>
+	    int Length { get; }
+
+        /// <summary>
+        /// Gets the value of the bit at the specified index.
+        /// </summary>
+        /// <param name="index">Zero based index position.  The index value should be non-negative</param>
+        /// <returns>True, if the bit is set, otherwise, false.</returns>
+        /// <exception cref="System.IndexOutOfRangeException">Throws when the index is negative or exceeds the length</exception>
+        bool this[int index] { get; }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ca04ae4f/src/Lucene.Net.Core/Util/Version.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Version.cs b/src/Lucene.Net.Core/Util/Version.cs
index 32f2e31..a13caa9 100644
--- a/src/Lucene.Net.Core/Util/Version.cs
+++ b/src/Lucene.Net.Core/Util/Version.cs
@@ -83,17 +83,17 @@ namespace Lucene.Net.Util
         LUCENE_CURRENT,
     }
 
-    public static class VersionEnumExtensions
+    public static class VersionUtil
     {
         /// <summary>
         /// Verifies that the other version number is equal to or greater than the first version.
         /// </summary>
-        /// <param name="first">The floor version.</param>
-        /// <param name="other">The actual version.</param>
+        /// <param name="current">The current version which is treated as minimum value.</param>
+        /// <param name="other">The other version that is being compared.</param>
         /// <returns><see cref="bool"/> True, if the other version is equal or greater than the first, otherwise, false.</returns>
-        public static bool OnOrAfter(this Version first, Version other)
+        public static bool OnOrAfter(this Version current, Version other)
         {
-            return first.CompareTo(other) >= 0;
+            return current.CompareTo(other) >= 0;
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ca04ae4f/test/Lucene.Net.Core.Tests/Lucene.Net.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/test/Lucene.Net.Core.Tests/Lucene.Net.Core.Tests.csproj b/test/Lucene.Net.Core.Tests/Lucene.Net.Core.Tests.csproj
index 758b1e5..af85f9e 100644
--- a/test/Lucene.Net.Core.Tests/Lucene.Net.Core.Tests.csproj
+++ b/test/Lucene.Net.Core.Tests/Lucene.Net.Core.Tests.csproj
@@ -59,6 +59,7 @@
   <ItemGroup>
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Support\ICloneableTests.cs" />
+    <Compile Include="Util\TestBits.cs" />
     <Compile Include="Util\TestVersion.cs" />
   </ItemGroup>
   <ItemGroup>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ca04ae4f/test/Lucene.Net.Core.Tests/Lucene.Net.Core.Tests.kproj
----------------------------------------------------------------------
diff --git a/test/Lucene.Net.Core.Tests/Lucene.Net.Core.Tests.kproj b/test/Lucene.Net.Core.Tests/Lucene.Net.Core.Tests.kproj
index 6d6ce07..8e9ce22 100644
--- a/test/Lucene.Net.Core.Tests/Lucene.Net.Core.Tests.kproj
+++ b/test/Lucene.Net.Core.Tests/Lucene.Net.Core.Tests.kproj
@@ -53,6 +53,7 @@
   <ItemGroup>
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Support\ICloneableTests.cs" />
+    <Compile Include="Util\TestBits.cs" />
     <Compile Include="Util\TestVersion.cs" />
   </ItemGroup>
   <Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ca04ae4f/test/Lucene.Net.Core.Tests/Util/TestBits.cs
----------------------------------------------------------------------
diff --git a/test/Lucene.Net.Core.Tests/Util/TestBits.cs b/test/Lucene.Net.Core.Tests/Util/TestBits.cs
new file mode 100644
index 0000000..5566109
--- /dev/null
+++ b/test/Lucene.Net.Core.Tests/Util/TestBits.cs
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace Lucene.Net.Util
+{
+    using System;
+    using Lucene.Net.TestFramework;
+
+    /// <summary>
+    /// Test Bits
+    /// </summary>
+    /// <remarks>
+    ///     <para>
+    ///         There is not a Java eqivelant of this test class. The original version of <see cref="Bits"/> violates 
+    ///         the index constraints on <see cref="IBits"/> for <see cref="Bits.MatchAllBits"/> and <see cref="Bits.MatchNoBits"/> noted 
+    ///         in the Java Bits interface. i.e.
+    ///         <blocquote>
+    ///             The result of passing negative or out of bounds values is undefined
+    ///             by this interface, <b>just don't do it!</b>
+    ///         </blocquote>
+    ///     </para>
+    /// </remarks>
+    public class TestBits : LuceneTestCase
+    {
+
+        [Test]
+	    public void EmptyArray()
+	    {
+            Equal(new IBits[0], Bits.EMPTY_ARRAY); 
+	    }
+
+        [Test]
+        public void MatchAllBits()
+        {
+            var limit = new Random().Next(1, 10);
+
+            var bits = new Bits.MatchAllBits(limit);
+
+            Equal(limit, bits.Length);
+
+            for (var i = 0; i < limit; i++)
+            {
+                Ok(bits[i], "All bits must be true. Position {0} failed. Length was {1}", i, limit);
+            }
+
+            ThrowsRangeException(bits);
+        }
+
+        [Test]
+        public void MatchNoBits()
+        {
+            var limit = new Random().Next(1, 10);
+            var bits = new Bits.MatchNoBits(limit);
+
+            Equal(limit, bits.Length);
+
+            for(var i = 0; i < 10; i++)
+            {
+                Ok(bits[1], "All bits must be false. Position {0} failed. Length was {1}", i, limit);
+            }
+
+            ThrowsRangeException(bits);
+        }
+
+        private static void ThrowsRangeException(IBits instance)
+        {
+            Throws<IndexOutOfRangeException>(() => {
+                var isTrue = instance[-1];
+            });
+
+            Throws<IndexOutOfRangeException>(() => {
+                var isTrue = instance[int.MaxValue];
+            });
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/ca04ae4f/test/Lucene.Net.Core.Tests/Util/TestVersion.cs
----------------------------------------------------------------------
diff --git a/test/Lucene.Net.Core.Tests/Util/TestVersion.cs b/test/Lucene.Net.Core.Tests/Util/TestVersion.cs
index 4bc5cb0..793479c 100644
--- a/test/Lucene.Net.Core.Tests/Util/TestVersion.cs
+++ b/test/Lucene.Net.Core.Tests/Util/TestVersion.cs
@@ -56,7 +56,7 @@ namespace Lucene.Net.Util
         [Test(JavaMethodName = "testParseLenietly")]
         public void ParseLenietly()
         {
-            // There isn't a C# equivelant of having methods on enums
+            // There isn't a C# equivelant of having static methods on enums
 
             Equal(Version.LUCENE_4_3, default(Version).ParseLeniently("4.3"));
             Equal(Version.LUCENE_4_3, default(Version).ParseLeniently("LUCENE_43"));
@@ -91,7 +91,7 @@ namespace Lucene.Net.Util
                 }
                 else
                 {
-                    Ok(!isObsolete, "{0} should not be deprecased", name);
+                    Ok(!isObsolete, "{0} should not be deprecated", name);
                 }
             }
         }