You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2012/08/08 19:26:49 UTC
svn commit: r1370847 -
/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/codecs/blockpacked/TestForUtil.java
Author: jpountz
Date: Wed Aug 8 17:26:49 2012
New Revision: 1370847
URL: http://svn.apache.org/viewvc?rev=1370847&view=rev
Log:
Fix test.
Modified:
lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/codecs/blockpacked/TestForUtil.java
Modified: lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/codecs/blockpacked/TestForUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/codecs/blockpacked/TestForUtil.java?rev=1370847&r1=1370846&r2=1370847&view=diff
==============================================================================
--- lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/codecs/blockpacked/TestForUtil.java (original)
+++ lucene/dev/branches/pforcodec_3892/lucene/core/src/test/org/apache/lucene/codecs/blockpacked/TestForUtil.java Wed Aug 8 17:26:49 2012
@@ -39,7 +39,7 @@ public class TestForUtil extends LuceneT
public void testEncodeDecode() throws IOException {
final int iterations = RandomInts.randomIntBetween(random(), 1, 1000);
final float acceptableOverheadRatio = random().nextFloat();
- final int[] values = new int[iterations * BLOCK_SIZE + ForUtil.MIN_DATA_SIZE];
+ final int[] values = new int[(iterations - 1) * BLOCK_SIZE + ForUtil.MIN_DATA_SIZE];
for (int i = 0; i < iterations; ++i) {
final int bpv = random().nextInt(32);
if (bpv == 0) {
@@ -65,7 +65,7 @@ public class TestForUtil extends LuceneT
for (int i = 0; i < iterations; ++i) {
forUtil.writeBlock(
- Arrays.copyOfRange(values, iterations * BLOCK_SIZE, values.length),
+ Arrays.copyOfRange(values, i * BLOCK_SIZE, values.length),
new byte[MIN_ENCODED_SIZE], out);
}
endPointer = out.getFilePointer();
@@ -83,7 +83,7 @@ public class TestForUtil extends LuceneT
}
final int[] restored = new int[MIN_DATA_SIZE];
forUtil.readBlock(in, new byte[MIN_ENCODED_SIZE], restored);
- assertArrayEquals(Arrays.copyOfRange(values, iterations * BLOCK_SIZE, (iterations + 1) * BLOCK_SIZE),
+ assertArrayEquals(Arrays.copyOfRange(values, i * BLOCK_SIZE, (i + 1) * BLOCK_SIZE),
Arrays.copyOf(restored, BLOCK_SIZE));
}
assertEquals(endPointer, in.getFilePointer());