}
@Test
public void testCreateBlockWriter()
{
Block expectedBlock = VARCHAR.createBlockBuilder(new BlockBuilderStatus())
.appendSlice(Slices.utf8Slice("alice"))
.appendSlice(Slices.utf8Slice("alice"))
.appendSlice(Slices.utf8Slice("bob"))
.appendSlice(Slices.utf8Slice("bob"))
.appendSlice(Slices.utf8Slice("bob"))
.appendSlice(Slices.utf8Slice("bob"))
.appendSlice(Slices.utf8Slice("charlie"))
.appendSlice(Slices.utf8Slice("charlie"))
.appendSlice(Slices.utf8Slice("charlie"))
.appendSlice(Slices.utf8Slice("charlie"))
.appendSlice(Slices.utf8Slice("charlie"))
.appendSlice(Slices.utf8Slice("charlie"))
.build();
DynamicSliceOutput sliceOutput = new DynamicSliceOutput(1024);
BlockEncoding blockEncoding = new RunLengthEncoder(sliceOutput).append(expectedBlock).finish();
SliceInput sliceInput = sliceOutput.slice().getInput();
Block block = blockEncoding.readBlock(sliceInput);
assertInstanceOf(block, RunLengthEncodedBlock.class);
RunLengthEncodedBlock rleBlock = (RunLengthEncodedBlock) block;
assertTrue(rleBlock.equalTo(0, expectedBlock, 0));
assertEquals(rleBlock.getPositionCount(), 2);
assertEquals(rleBlock.getSlice(0).toStringUtf8(), "alice");