@Test
public void testSanity() throws Exception
{
List<int[]> someInts = Arrays.asList(
new int[]{1, 2, 3, 4, 5},
new int[]{6, 7, 8, 9, 10},
new int[]{11, 12, 13, 14, 15, 16, 17, 18, 19, 20}
);
VSizeColumnarMultiInts indexed = VSizeColumnarMultiInts.fromIterable(
Iterables.transform(
someInts,
new Function<int[], VSizeColumnarInts>()
{
@Override
public VSizeColumnarInts apply(int[] input)
{
return VSizeColumnarInts.fromArray(input, 20);
}
}
)
);
assertSame(someInts, indexed);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
indexed.writeTo(Channels.newChannel(baos), null);
final byte[] bytes = baos.toByteArray();
Assert.assertEquals(indexed.getSerializedSize(), bytes.length);
VSizeColumnarMultiInts deserializedIndexed = VSizeColumnarMultiInts.readFromByteBuffer(ByteBuffer.wrap(bytes));
assertSame(someInts, deserializedIndexed);
}