VIntPayloadCodec codec = new VIntPayloadCodec();
@Test
public void testSimpleVInt()
throws Exception {
IntsRef ints = new IntsRef(new int[] { 12,43 }, 0, 2);
int pos = 256;
BytesRef bytes = codec.encode(ints, pos);
codec.decode(bytes);
IntsRef node = codec.getNode();
assertEquals(ints.ints[0], node.ints[node.offset]);
assertEquals(ints.ints[1], node.ints[node.offset + 1]);
assertEquals(pos, codec.getPosition());
ints = new IntsRef(new int[] { 3, 2 }, 0, 2);
pos = 2;
bytes = codec.encode(ints, pos);
codec.decode(bytes);
node = codec.getNode();
assertEquals(ints.ints[0], node.ints[node.offset]);
assertEquals(ints.ints[1], node.ints[node.offset + 1]);
assertEquals(pos, codec.getPosition());
ints = new IntsRef(new int[] { 0, 1 }, 0, 2);
pos = 0;
bytes = codec.encode(ints, pos);
codec.decode(bytes);
node = codec.getNode();