public void testVarcharSerializedSize()
{
BlockBuilder builder = VARCHAR.createBlockBuilder(new BlockBuilderStatus());
// empty page
Page page = new Page(builder.build());
int pageSize = serializedSize(ImmutableList.of(VARCHAR), page);
assertEquals(pageSize, 34); // page overhead
// page with one value
VARCHAR.writeString(builder, "alice");
page = new Page(builder.build());
int firstValueSize = serializedSize(ImmutableList.of(VARCHAR), page) - pageSize;
assertEquals(firstValueSize, 4 + 5 + 1); // length + "alice" + null
// page with two values
VARCHAR.writeString(builder, "bob");
page = new Page(builder.build());
int secondValueSize = serializedSize(ImmutableList.of(VARCHAR), page) - (pageSize + firstValueSize);
assertEquals(secondValueSize, 4 + 3); // length + "bob" (null shared with first entry)
}