static final int[] limits = { 9, 12, 15 };
@Test
public void testReadWrite() {
for (int limit : limits) {
PositionedByteRange buff = new SimplePositionedByteRange(limit);
for (Order ord : new Order[] { Order.ASCENDING, Order.DESCENDING }) {
for (byte[] val : VALUES) {
buff.setPosition(0);
DataType<byte[]> type = new FixedLengthWrapper<byte[]>(new RawBytes(ord), limit);
assertEquals(limit, type.encode(buff, val));
byte[] expected = Arrays.copyOf(val, limit);
buff.setPosition(0);
byte[] actual = type.decode(buff);
assertArrayEquals(expected, actual);
buff.setPosition(0);
assertEquals(limit, type.skip(buff));
}
}
}
}