From c8fb5b38d5469762c3a606fda099ef459c975e26 Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Wed, 8 Aug 2012 17:26:49 +0000 Subject: [PATCH] Fix test. git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/pforcodec_3892@1370847 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/lucene/codecs/blockpacked/TestForUtil.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lucene/core/src/test/org/apache/lucene/codecs/blockpacked/TestForUtil.java b/lucene/core/src/test/org/apache/lucene/codecs/blockpacked/TestForUtil.java index 834e8fbab87..158328fb024 100644 --- a/lucene/core/src/test/org/apache/lucene/codecs/blockpacked/TestForUtil.java +++ b/lucene/core/src/test/org/apache/lucene/codecs/blockpacked/TestForUtil.java @@ -39,7 +39,7 @@ public class TestForUtil extends LuceneTestCase { 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 LuceneTestCase { 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 LuceneTestCase { } 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());