You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by sy...@apache.org on 2016/10/02 10:16:38 UTC
[07/49] lucenenet git commit: Ported Core.Util.Packed.TestPackedInts
Ported Core.Util.Packed.TestPackedInts
Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/5effb005
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/5effb005
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/5effb005
Branch: refs/heads/master
Commit: 5effb005955f357825cb9447f186b221a8d63cb7
Parents: 3da18fb
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Wed Sep 7 02:01:26 2016 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Sep 8 06:40:48 2016 +0700
----------------------------------------------------------------------
src/Lucene.Net.Tests/Lucene.Net.Tests.csproj | 1 +
.../core/Util/Packed/TestPackedInts.cs | 66 ++++++++++----------
2 files changed, 35 insertions(+), 32 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5effb005/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
index f030b0d..955d5bc 100644
--- a/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
+++ b/src/Lucene.Net.Tests/Lucene.Net.Tests.csproj
@@ -469,6 +469,7 @@
<Compile Include="core\Util\Packed\TestEliasFanoSequence.cs">
<SubType>Code</SubType>
</Compile>
+ <Compile Include="core\Util\Packed\TestPackedInts.cs" />
<Compile Include="core\Util\Test2BPagedBytes.cs">
<SubType>Code</SubType>
</Compile>
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5effb005/src/Lucene.Net.Tests/core/Util/Packed/TestPackedInts.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Util/Packed/TestPackedInts.cs b/src/Lucene.Net.Tests/core/Util/Packed/TestPackedInts.cs
index 0807aa5..3294f82 100644
--- a/src/Lucene.Net.Tests/core/Util/Packed/TestPackedInts.cs
+++ b/src/Lucene.Net.Tests/core/Util/Packed/TestPackedInts.cs
@@ -8,7 +8,6 @@ using NUnit.Framework;
namespace Lucene.Net.Util.Packed
{
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -26,7 +25,6 @@ namespace Lucene.Net.Util.Packed
* limitations under the License.
*/
-
using CodecUtil = Lucene.Net.Codecs.CodecUtil;
using ByteArrayDataInput = Lucene.Net.Store.ByteArrayDataInput;
using DataInput = Lucene.Net.Store.DataInput;
@@ -984,6 +982,7 @@ namespace Lucene.Net.Util.Packed
}
[Test]
+ [Ignore("LUCENENET TODO: LongBuffer and the method AsLongBuffer are not yet ported, so we cannot currently run this test without porting or finding an alternative way to compare the data.")]
public virtual void TestEncodeDecode()
{
foreach (PackedInts.Format format in PackedInts.Format.Values())
@@ -1060,35 +1059,38 @@ namespace Lucene.Net.Util.Packed
Assert.AreEqual(blocks2, blocks3, msg);
}
- // 4. byte[] decoding
- sbyte[] byteBlocks = new sbyte[8 * blocks.Length];
- ByteBuffer.Wrap((byte[])(Array)byteBlocks).AsLongBuffer().Put(blocks);
- long[] values2 = new long[valuesOffset + longIterations * longValueCount];
- decoder.Decode(byteBlocks, blocksOffset * 8, values2, valuesOffset, byteIterations);
- foreach (long value in values2)
- {
- Assert.IsTrue(value <= PackedInts.MaxValue(bpv), msg);
- }
- Assert.AreEqual(values, values2, msg);
- // test decoding to int[]
- if (bpv <= 32)
- {
- int[] intValues2 = new int[values2.Length];
- decoder.Decode(byteBlocks, blocksOffset * 8, intValues2, valuesOffset, byteIterations);
- Assert.IsTrue(Equals(intValues2, values2), msg);
- }
-
- // 5. byte[] encoding
- sbyte[] blocks3_ = new sbyte[8 * (blocksOffset2 + blocksLen)];
- encoder.Encode(values, valuesOffset, blocks3_, 8 * blocksOffset2, byteIterations);
- Assert.AreEqual(msg, LongBuffer.Wrap(blocks2), ByteBuffer.Wrap((byte[])(Array)blocks3_).AsLongBuffer());
- // test encoding from int[]
- if (bpv <= 32)
- {
- sbyte[] blocks4 = new sbyte[blocks3_.Length];
- encoder.Encode(intValues, valuesOffset, blocks4, 8 * blocksOffset2, byteIterations);
- Assert.AreEqual(blocks3_, blocks4, msg);
- }
+ // LUCENENET TODO: LongBuffer and the method AsLongBuffer are not yet ported, so we
+ // cannot currently run the following tests.
+
+ //// 4. byte[] decoding
+ //byte[] byteBlocks = new byte[8 * blocks.Length];
+ //ByteBuffer.Wrap(byteBlocks).AsLongBuffer().Put(blocks);
+ //long[] values2 = new long[valuesOffset + longIterations * longValueCount];
+ //decoder.Decode(byteBlocks, blocksOffset * 8, values2, valuesOffset, byteIterations);
+ //foreach (long value in values2)
+ //{
+ // Assert.IsTrue(value <= PackedInts.MaxValue(bpv), msg);
+ //}
+ //Assert.AreEqual(values, values2, msg);
+ //// test decoding to int[]
+ //if (bpv <= 32)
+ //{
+ // int[] intValues2 = new int[values2.Length];
+ // decoder.Decode(byteBlocks, blocksOffset * 8, intValues2, valuesOffset, byteIterations);
+ // Assert.IsTrue(Equals(intValues2, values2), msg);
+ //}
+
+ //// 5. byte[] encoding
+ //byte[] blocks3_ = new byte[8 * (blocksOffset2 + blocksLen)];
+ //encoder.Encode(values, valuesOffset, blocks3_, 8 * blocksOffset2, byteIterations);
+ //assertEquals(msg, LongBuffer.Wrap(blocks2), ByteBuffer.Wrap(blocks3_).AsLongBuffer());
+ //// test encoding from int[]
+ //if (bpv <= 32)
+ //{
+ // byte[] blocks4 = new byte[blocks3_.Length];
+ // encoder.Encode(intValues, valuesOffset, blocks4, 8 * blocksOffset2, byteIterations);
+ // Assert.AreEqual(blocks3_, blocks4, msg);
+ //}
}
}
}
@@ -1337,7 +1339,7 @@ namespace Lucene.Net.Util.Packed
@out.Dispose();
IndexInput in1 = dir.OpenInput("out.bin", IOContext.DEFAULT);
- sbyte[] buf = new sbyte[(int)fp];
+ byte[] buf = new byte[(int)fp];
in1.ReadBytes(buf, 0, (int)fp);
in1.Seek(0L);
ByteArrayDataInput in2 = new ByteArrayDataInput((byte[])(Array)buf);