}
@Test
public void pReadUnsignedVarLong_void() throws Exception {
try {
Stream stream = new Stream();
stream.writeBit(1);
int max = (int )(Math.pow(2, RT.INT62) * Byte.SIZE - 2);
for (NumWithInfo nwi : genNumWithInfos(max)) {
if (nwi.getBits() < max) {
if (nwi.isOverflow() || nwi.isUnderflow()) {
continue;
}
}
stream.writeUnsignedVarLong(nwi.getNumber().longValue());
}
stream.writeBit(1);
stream.readBit();
for (NumWithInfo nwi : genNumWithInfos(max)) {
if (nwi.getBits() < max) {
if (nwi.isOverflow() || nwi.isUnderflow()) {
continue;
}
}
BigInteger mask = BigInteger.valueOf(2).pow(nwi.getVarLongBits(false)).subtract(BigInteger.ONE);
BigInteger left = nwi.getNumber();
BigInteger right = BigInteger.valueOf(stream.readUnsignedVarLong());
left = left.and(mask);
assertEquals(left, right);
}
assertEquals(1, stream.getData().readable());
} finally {
}
}