@Test public void testChunkTooBig() throws Exception { for (int maxValue : MAX_VALUES) { final int maxChunkSize = CompressedVSizeIntsIndexedSupplier.maxIntsInBufferForValue(maxValue); try { setupLargeChunks(maxChunkSize + 1, 10 * (maxChunkSize + 1), maxValue); Assert.fail(); } catch (IllegalArgumentException e) { Assert.assertTrue("chunk too big for maxValue " + maxValue, true); } } }
@Test public void testLargeChunks() throws Exception { for (int maxValue : MAX_VALUES) { final int maxChunkSize = CompressedVSizeIntsIndexedSupplier.maxIntsInBufferForValue(maxValue); setupLargeChunks(maxChunkSize, 10 * maxChunkSize, maxValue); Assert.assertEquals(10, supplier.getBaseBuffers().size()); assertIndexMatchesVals(); setupLargeChunks(maxChunkSize, 10 * maxChunkSize + 1, maxValue); Assert.assertEquals(11, supplier.getBaseBuffers().size()); assertIndexMatchesVals(); setupLargeChunks(1, 0xFFFF, maxValue); Assert.assertEquals(0xFFFF, supplier.getBaseBuffers().size()); assertIndexMatchesVals(); setupLargeChunks(maxChunkSize / 2, 10 * (maxChunkSize / 2) + 1, maxValue); Assert.assertEquals(11, supplier.getBaseBuffers().size()); assertIndexMatchesVals(); } }