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/11/09 23:07:50 UTC

[6/7] lucenenet git commit: Separated Java Compatability code into its own project, updating the readme as this branch is on hiatus as I work on extending xunit.net to handle Junit TestRules and Carrot Search's randomization.

Separated Java Compatability code into its own project, updating the readme as this branch is on hiatus as I work on extending xunit.net to handle Junit TestRules and Carrot Search's randomization.


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

Branch: refs/heads/pcl
Commit: d90ecf3f6690fddd60f021a91b6cac30066c71a6
Parents: 4b4d4d9
Author: Michael Herndon <mh...@michaelherndon.com>
Authored: Sun Nov 9 17:03:45 2014 -0500
Committer: Michael Herndon <mh...@michaelherndon.com>
Committed: Sun Nov 9 17:03:45 2014 -0500

----------------------------------------------------------------------
 Lucene.vs2013.sln.GhostDoc.user.dic             |  2 +
 README.md                                       |  8 ++
 docs/sorting.md                                 |  2 +-
 src/Lucene.Net.Java/Lang/Long.cs                | 92 ++++++++++++++++++--
 src/Lucene.Net.Java/Lucene.Net.Java.csproj      | 11 +++
 src/Lucene.Net.Java/Util/DualPivotQuicksort.cs  | 40 +++++++++
 src/Lucene.Net.Java/Util/InsertionSort.cs       | 57 +++++++++++-
 test/Lucene.Net.Java.Tests/Lang/LongTests.cs    | 46 ++++++++++
 .../Lucene.Net.Java.Tests.csproj                |  1 +
 .../Lucene.Net.TestFramework.Core.csproj        |  9 ++
 10 files changed, 255 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d90ecf3f/Lucene.vs2013.sln.GhostDoc.user.dic
----------------------------------------------------------------------
diff --git a/Lucene.vs2013.sln.GhostDoc.user.dic b/Lucene.vs2013.sln.GhostDoc.user.dic
index 7da4c3e..28ec1a0 100644
--- a/Lucene.vs2013.sln.GhostDoc.user.dic
+++ b/Lucene.vs2013.sln.GhostDoc.user.dic
@@ -1,3 +1,5 @@
+const
+csharp
 indices
 init
 Quicksort

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d90ecf3f/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index d2ad9f4..829d82a 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,13 @@ Apache Lucene.Net is compiled against Microsoft .NET Framework 4.0
 The Apache Lucene.Net web site is at:
   http://lucenenet.apache.org
 
+## NOTICE
+This branch is on hiatus as I'm currently working on extending Xunit.Net to have similar functionality to JUnit for TestRules and to enable randomization testing from carrot search.  I'm also working on making the story for running tests quickly from the command line.  
+
+I've also started separate code that provides the same apis found in Java but .Net into a separate library in hopes that it will make it easier for others to port code from Java.  
+
+- Michael
+
 ## Getting Started
 
 ### Windows Users
@@ -68,6 +75,7 @@ $ k test
  * Implement a ci server, possibly appveyor
  * Generate Code Documentation.
  * Port core, test-framework, and tests for core. 
+  * 
 
 ## Notes
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d90ecf3f/docs/sorting.md
----------------------------------------------------------------------
diff --git a/docs/sorting.md b/docs/sorting.md
index 1b26773..7581a3b 100644
--- a/docs/sorting.md
+++ b/docs/sorting.md
@@ -4,7 +4,7 @@ The system libraries in Java and C# have differences in the default sorting mech
 
 [Array.Sort](http://msdn.microsoft.com/en-us/library/kwx6zbd4\(v=vs.110\).aspx)in C# uses [Quick Sort](http://algs4.cs.princeton.edu/23quicksort) as the default algorithm for soring.
 
-[Array.sort](http://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html#sort(T\[\],%20java.util.Comparator) in in Java uses the [Tim Sort](http://svn.python.org/projects/python/trunk/Objects/listsort.txt) as the default sorting algorithm as of Java 7.
+[Array.sort](http://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html#sort(T\[\],%20java.util.Comparator) in in Java uses the [Tim Sort](http://svn.python.org/projects/python/trunk/Objects/listsort.txt) as the default sorting algorithm as of Java 7 for Object arrays and using the Dual Pivot Quick Sort (unstable) for primitive typed arrays.
 
 The differences in sorting methods could account for the discrepencies between running ported tests for the various sorting algorithms in Lucene core.
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d90ecf3f/src/Lucene.Net.Java/Lang/Long.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Java/Lang/Long.cs b/src/Lucene.Net.Java/Lang/Long.cs
index c532c84..e0b261e 100644
--- a/src/Lucene.Net.Java/Lang/Long.cs
+++ b/src/Lucene.Net.Java/Lang/Long.cs
@@ -36,8 +36,12 @@ namespace Java.Lang
             public static int Position(long value)
             {
                 var v = value;
+                // TODO: find a better way of handling negative indices for DeBruijn64.Position
+                var index =  ((v & -v)*0x022fdd63cc95386d >> 58);
+                if (0 > index)
+                    index = 64 + index;
 
-                return POSITIONS[(v & -v) * 0x022fdd63cc95386d >> 58];
+                return POSITIONS[index]; 
             }
         }
 
@@ -46,20 +50,45 @@ namespace Java.Lang
 
 
         /// <summary>
-        /// Returns the leading zeros from the value.
+        /// Returns the leading zeros from the binary expression of the value.
         /// </summary>
+        /// <remarks>
+        ///     <para>
+        ///      A long is 64 bits. Each bit is either a one or a zero.
+        ///     <see cref="NumberOfLeadingZeros(long)"/> will count zeros from the left most bit towards the right
+        ///     till it reaches the first bit that has a value of one.  Binary is often
+        ///     written as 
+        ///     <a href="http://simple.wikipedia.org/wiki/Hexadecimal_numeral_system">hexadecimal literal or hex digit</a> in code.    
+        ///     </para>
+        ///     <example>
+        ///     <code lang="csharp"> 
+        ///     // The counting stops at the first bit that has a one value starting from the left side.
+        ///     // In the case below, the first bit with a value of one is in the 16th position.
+        ///     //
+        ///     // hex value, long value
+        ///     // 0x1F00F0f00F111L = (Long)545422443606289;
+        ///     //
+        ///     // this is the binary form of the long value being tested:
+        ///     // |                 | 15 zeros 
+        ///     // 0000 0000 0000 0001 1111 0000 0000 1111 0000 1111 0000 0000 1111 0001 0001 0001
+        ///     const long value2 = 0x1F00F0f00F111L;
+        ///     Assert.Equal(15, Long.NumberOfLeadingZeros(value2), "The number of leading zeros must be 15");
+        ///     </code>
+        ///     </example>
+        /// </remarks>
         /// <param name="value">The value.</param>
-        /// <returns>System.Int32.</returns>
+        /// <returns>The number of leading zeros.</returns>
         public static int NumberOfLeadingZeros(long value)
         {
             return (int)NumberOfLeadingZeros((ulong)value);
         }
 
         /// <summary>
-        /// Returns the leading zeros from the value.
+        /// Returns the leading zeros from the binary expression of the value.  
         /// </summary>
+        /// <seealso cref="NumberOfLeadingZeros(long)"/>
         /// <param name="value">The value.</param>
-        /// <returns>System.UInt32.</returns>
+        /// <returns>The number of leading zeros.</returns>
         [CLSCompliant(false)]
         public static uint NumberOfLeadingZeros(ulong value)
         {
@@ -105,18 +134,39 @@ namespace Java.Lang
 
         // ReSharper disable once CSharpWarnings::CS1584
         /// <summary>
-        /// Returns the number of trailing zeros. i.e 100 has two trailing zeros.
+        /// Returns the number of trailing zeros from the binary value.
         /// </summary>
         /// <param name="value">The value to be inspected for trailing zeros.</param>
         /// <remarks>
         ///     <para>
-        ///         We're using the De Bruijn sequences based upon the various bit twiddling hacks found in 
-
+        ///      A long is 64 bits. Each bit is either a one or a zero.
+        ///     <see cref="NumberOfTrailingZeros(long)"/> will count zeros from the right most bit towards the left
+        ///     till it reaches the first bit that has a value of one.  Binary is often
+        ///     written as 
+        ///     <a href="http://simple.wikipedia.org/wiki/Hexadecimal_numeral_system">hexadecimal literal or hex digit</a> in code.    
+        ///     </para>
+        ///     <example>
+        ///     <code lang="csharp"> 
+        ///     // The counting stops at the first bit that has a one value starting from the right side.
+        ///     // In the case below, the first bit with a value of one is in the 16th position.
+        ///     //
+        ///     // hex value, long value
+        ///     // 0x80000L = (Long) 524288;
+        ///     //
+        ///     // this is the binary form of the long value being tested:
+        ///     //                                                        |                      | 19 zeros 
+        ///     // 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 1000 0000 0000 0000 0000
+        ///     const long value3 = 0x80000L;
+        ///     Assert.Equal(19, Long.NumberOfTrailingZeros(value3), "The number of trailing zeros must be 19");
+        ///     </code>
+        ///     </example>
+        ///     <para>
+        ///         We're using the De Bruijn sequences based upon the various bit twiddling hacks found in
         ///         an online paper stanford <see href="https://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightMultLookup" />
         ///     </para>
         ///     <para>
         ///          It should be faster than Java's native 
-        ///          <see href="http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/java/lang/Integer.java#Integer.numberOfTrailingZeros%28int%29">
+        ///          <see href="http://docs.oracle.com/javase/7/docs/api/java/lang/Long.html#numberOfTrailingZeros(long)">
         ///          Long.numberOfTrailingZeros
         ///          </see> which uses the binary search method of finding trailing zeros.  
         ///     </para>
@@ -127,11 +177,23 @@ namespace Java.Lang
             return DeBruijn64.Position(value);
         }
 
+        /// <summary>
+        /// Rotates the left.
+        /// </summary>
+        /// <param name="value">The value.</param>
+        /// <param name="shift">The shift.</param>
+        /// <returns>System.Int64.</returns>
         public static long RotateLeft(long value, int shift)
         {
             return (long)RotateLeft((ulong) value, shift);
         }
 
+        /// <summary>
+        /// Rotates the left.
+        /// </summary>
+        /// <param name="value">The value.</param>
+        /// <param name="shift">The shift.</param>
+        /// <returns>System.UInt64.</returns>
         [CLSCompliant(false)]
         public static ulong RotateLeft(ulong value, int shift)
         {
@@ -139,11 +201,23 @@ namespace Java.Lang
         }
 
 
+        /// <summary>
+        /// Rotates the right.
+        /// </summary>
+        /// <param name="value">The value.</param>
+        /// <param name="shift">The shift.</param>
+        /// <returns>System.Int64.</returns>
         public static long RotateRight(long value, int shift)
         {
             return (long)RotateRight((ulong) value, shift);
         }
 
+        /// <summary>
+        /// Rotates the right.
+        /// </summary>
+        /// <param name="value">The value.</param>
+        /// <param name="shift">The shift.</param>
+        /// <returns>System.UInt64.</returns>
         [CLSCompliant(false)]
         public static ulong RotateRight(ulong value, int shift)
         {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d90ecf3f/src/Lucene.Net.Java/Lucene.Net.Java.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Java/Lucene.Net.Java.csproj b/src/Lucene.Net.Java/Lucene.Net.Java.csproj
index 2a13128..c07d0ae 100644
--- a/src/Lucene.Net.Java/Lucene.Net.Java.csproj
+++ b/src/Lucene.Net.Java/Lucene.Net.Java.csproj
@@ -15,6 +15,8 @@
     <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
     <TargetFrameworkProfile>Profile259</TargetFrameworkProfile>
     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+    <RestorePackages>true</RestorePackages>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
@@ -24,6 +26,7 @@
     <DefineConstants>DEBUG;TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <DocumentationFile>bin\Debug\Lucene.Net.Java.XML</DocumentationFile>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <DebugType>pdbonly</DebugType>
@@ -32,6 +35,7 @@
     <DefineConstants>TRACE</DefineConstants>
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
+    <DocumentationFile>bin\Release\Lucene.Net.Java.XML</DocumentationFile>
   </PropertyGroup>
   <ItemGroup>
     <!-- A reference to the entire .NET Framework is automatically included -->
@@ -50,6 +54,13 @@
     <None Include="Readme.md" />
   </ItemGroup>
   <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
+  <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
+  </Target>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
   <Target Name="BeforeBuild">

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d90ecf3f/src/Lucene.Net.Java/Util/DualPivotQuicksort.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Java/Util/DualPivotQuicksort.cs b/src/Lucene.Net.Java/Util/DualPivotQuicksort.cs
index d880c1a..c08e169 100644
--- a/src/Lucene.Net.Java/Util/DualPivotQuicksort.cs
+++ b/src/Lucene.Net.Java/Util/DualPivotQuicksort.cs
@@ -732,6 +732,11 @@ namespace Java.Util
             PerformSort(array, less, great);
         }
 
+        /// <summary>
+        /// Sorts the specified array.
+        /// </summary>
+        /// <param name="array">The array.</param>
+        /// <returns>System.Int64[].</returns>
         public static long[] Sort(long[] array)
         {
             Check.NotNull("array", array);
@@ -739,6 +744,13 @@ namespace Java.Util
             return array;
         }
 
+        /// <summary>
+        /// Sorts the specified array.
+        /// </summary>
+        /// <param name="array">The array.</param>
+        /// <param name="start">The start.</param>
+        /// <param name="count">The count.</param>
+        /// <returns>System.Int64[].</returns>
         public static long[] Sort(long[] array, int start, int count)
         {
             Check.NotNull("array", array);
@@ -908,17 +920,37 @@ namespace Java.Util
             return left.CompareTo(right) < 0;
         }
 
+        /// <summary>
+        /// Greaters the than.
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="left">The left.</param>
+        /// <param name="right">The right.</param>
+        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
         private static bool GreaterThan<T>(T left, T right) where T : IComparable<T>
         {
             return left.CompareTo(right) > 0;
         }
 
+        /// <summary>
+        /// Greaters the than or equal to.
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="left">The left.</param>
+        /// <param name="right">The right.</param>
+        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
         private static bool GreaterThanOrEqualTo<T>(T left, T right) where T : IComparable<T>
         {
             var compare = left.CompareTo(right);
             return compare > 0 || compare == 0;
         }
 
+        /// <summary>
+        /// Sorts the specified list.
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="list">The list.</param>
+        /// <returns>IList&lt;T&gt;.</returns>
         public static IList<T> Sort<T>(IList<T> list) where T: IComparable<T>
         {
             Check.NotNull("array", list);
@@ -927,6 +959,14 @@ namespace Java.Util
             return list;
         }
 
+        /// <summary>
+        /// Sorts the specified list.
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="list">The list.</param>
+        /// <param name="start">The start.</param>
+        /// <param name="count">The count.</param>
+        /// <returns>IList&lt;T&gt;.</returns>
         public static IList<T> Sort<T>(IList<T> list, int start, int count)  where T: IComparable<T> 
         {
             Check.NotNull("array", list);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d90ecf3f/src/Lucene.Net.Java/Util/InsertionSort.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Java/Util/InsertionSort.cs b/src/Lucene.Net.Java/Util/InsertionSort.cs
index 5e27c58..5346d03 100644
--- a/src/Lucene.Net.Java/Util/InsertionSort.cs
+++ b/src/Lucene.Net.Java/Util/InsertionSort.cs
@@ -20,11 +20,20 @@ namespace Java.Util
     using System;
     using System.Collections.Generic;
 
+    // ReSharper disable CSharpWarnings::CS1574
+    /// <summary>
+    /// An efficient simple <strong>stable</strong> sort for really small data sets.
+    /// </summary>
     public static class InsertionSort
     {
 
-      
-
+        /// <summary>
+        /// Swaps the values for the left and right indices in the specified list.
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="list">The list.</param>
+        /// <param name="left">The left.</param>
+        /// <param name="right">The right.</param>
         private static void Swap<T>(IList<T> list,int left , int right )
         {
             var reference = list[left];
@@ -35,6 +44,13 @@ namespace Java.Util
 
 
 
+        /// <summary>
+        /// Sorts the specified list.
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="list">The list.</param>
+        /// <returns>The sorted <see cref="System.Collections.Generic.IList{T}"/>.</returns>
+        /// <exception cref="ArgumentNullException">Thrown when the <paramref name="list"/> is null.</exception>
         public static IList<T> Sort<T>(IList<T> list) where T : IComparable<T>
         {
             Check.NotNull("list", list);
@@ -42,6 +58,20 @@ namespace Java.Util
             return PerformSort(list, 0, list.Count);
         }
 
+        /// <summary>
+        /// Sorts the specified list.
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="list">The list.</param>
+        /// <param name="start">The start.</param>
+        /// <param name="count">The count.</param>
+        /// <returns>The sorted <see cref="System.Collections.Generic.IList{T}"/>.</returns>
+        /// <exception cref="ArgumentNullException">Thrown when the <paramref name="list"/> is null.</exception>
+        /// <exception cref="ArgumentOutOfRangeException">
+        ///     Thrown when the start is less than 0 or greater than length, count is less than 0 or greater than
+        ///     <c><paramref name="list"/>.Count</c>, or when the sum of start and count is greater than 
+        ///     <c><paramref name="list"/>.Count</c>.
+        /// </exception>
         public static IList<T> Sort<T>(IList<T> list, int start, int count)where T: IComparable<T>
         {
             Check.NotNull("list", list);
@@ -50,11 +80,18 @@ namespace Java.Util
             return PerformSort(list, start, count);
         }
 
+        /// <summary>
+        /// Performs the sort.
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="list">The list.</param>
+        /// <param name="start">The start.</param>
+        /// <param name="count">The count.</param>
+        /// <returns>The sorted <see cref="System.Collections.Generic.IList{T}"/></returns>
         internal static IList<T> PerformSort<T>(IList<T> list, int start, int count) where T: IComparable<T>
         {
             for (var i = start + 1; i < count; i++)
             {
-               
                 for (var j = i; j > start && list[j - 1].CompareTo(list[j]) >= 0; j--)
                 {
                     // swap
@@ -64,5 +101,19 @@ namespace Java.Util
 
             return list;
         }
+
+        internal static IList<T> PerformSort<T>(IList<T> list, int start, int count, Comparison<T> comparison)
+        {
+            for (var i = start + 1; i < count; i++)
+            {
+                for (var j = i; j > start && comparison(list[j - 1], list[j]) >= 0; j--)
+                {
+                    // swap
+                    Swap(list, j - 1, j);
+                }
+            }
+
+            return list;
+        }
     }
 }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d90ecf3f/test/Lucene.Net.Java.Tests/Lang/LongTests.cs
----------------------------------------------------------------------
diff --git a/test/Lucene.Net.Java.Tests/Lang/LongTests.cs b/test/Lucene.Net.Java.Tests/Lang/LongTests.cs
new file mode 100644
index 0000000..019797a
--- /dev/null
+++ b/test/Lucene.Net.Java.Tests/Lang/LongTests.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Lucene.Net.Java.Lang
+{
+    using global::Java.Lang;
+
+    public class LongTests : TestClass
+    {
+        [Test]
+        public void NumberOfLeadingZeros()
+        {
+            // 0x1FL = (Long) 31
+            // 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0001 1111
+            const long value1 = 0x1FL;
+            Equal(59, Long.NumberOfLeadingZeros(value1), "The number of leading zeros must be 59");
+
+            // 0x1F00F0f00F111L = (Long)545422443606289;
+            // 0000 0000 0000 0001 1111 0000 0000 1111 0000 1111 0000 0000 1111 0001 0001 0001
+            const long value2 = 0x1F00F0f00F111L;
+            Equal(15, Long.NumberOfLeadingZeros(value2), "The number of leading zeros must be 15");
+        }
+
+        [Test]
+        public void NumberOfTrailingZeros()
+        {
+            // 0x8000L = (Long) 32768;
+            // 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 1000 0000 0000 0000
+            const long value1 = 0x8000L;
+            Equal(15, Long.NumberOfTrailingZeros(value1), "The number of trailing zeros must be 15");
+
+            // 0x1F00F0F00F100L = (Long)545422443606272
+            // 0000 0000 0000 0001 1111 0000 0000 1111 0000 1111 0000 0000 1111 0001 0000 0000
+            const long value2 = 0x1F00F0F00F100L;
+            Equal(8, Long.NumberOfTrailingZeros(value2), "The number of trailing zeros must be 8");
+
+            // 0x80000L = (Long) 524288
+            // 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 1000 0000 0000 0000 0000
+            const long value3 = 0x80000L;
+            Equal(19, Long.NumberOfTrailingZeros(value3), "The number of trailing zeros must be 19");
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d90ecf3f/test/Lucene.Net.Java.Tests/Lucene.Net.Java.Tests.csproj
----------------------------------------------------------------------
diff --git a/test/Lucene.Net.Java.Tests/Lucene.Net.Java.Tests.csproj b/test/Lucene.Net.Java.Tests/Lucene.Net.Java.Tests.csproj
index f1114ce..812a7f7 100644
--- a/test/Lucene.Net.Java.Tests/Lucene.Net.Java.Tests.csproj
+++ b/test/Lucene.Net.Java.Tests/Lucene.Net.Java.Tests.csproj
@@ -40,6 +40,7 @@
     <None Include="packages.config" />
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Lang\LongTests.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Util\InsertionSortTests.cs" />
     <Compile Include="Util\SortTestClass.cs" />

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/d90ecf3f/test/Lucene.Net.TestFramework.Core/Lucene.Net.TestFramework.Core.csproj
----------------------------------------------------------------------
diff --git a/test/Lucene.Net.TestFramework.Core/Lucene.Net.TestFramework.Core.csproj b/test/Lucene.Net.TestFramework.Core/Lucene.Net.TestFramework.Core.csproj
index 3e66773..569c3f8 100644
--- a/test/Lucene.Net.TestFramework.Core/Lucene.Net.TestFramework.Core.csproj
+++ b/test/Lucene.Net.TestFramework.Core/Lucene.Net.TestFramework.Core.csproj
@@ -15,6 +15,8 @@
     <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
     <TargetFrameworkProfile>Profile111</TargetFrameworkProfile>
     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
+    <RestorePackages>true</RestorePackages>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
@@ -61,6 +63,13 @@
     </Reference>
   </ItemGroup>
   <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
+  <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
+  </Target>
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
   <Target Name="BeforeBuild">