Skip to content

Commit

Permalink
Restore readUnsignedLeb128 method as requested in #710
Browse files Browse the repository at this point in the history
  • Loading branch information
zhicwu committed Oct 10, 2021
1 parent 7e3fc8f commit a8ac5b2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ public List<ClickHouseColumnInfo> getColumns() {
return this.columns;
}

public int readUnsignedLeb128() throws IOException {
return Utils.readUnsignedLeb128(in);
}

public void readBytes(byte[] bytes) throws IOException {
readBytes(bytes, 0, bytes.length);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ public void testFixedString() throws Exception {
assertEquals(inputZeroPaddedString.readFixedString(10), "hello\0\0\0\0\0");
}

@Test(groups = "unit")
public void testUnsignedLeb128() throws Exception {
ClickHouseRowBinaryInputStream input = prepareStream(new byte[] { -128, -62, -41, 47 });
assertEquals(input.readUnsignedLeb128(), 100000000);
}

@Test(groups = "unit")
public void testOne() throws Exception {
ClickHouseRowBinaryInputStream input = prepareStream(new byte[]{5, 97, 46, 98, 46, 99, 123, 20, -82, 71, -31, 26, 69, 64, 34, 87, -13, 88, 120, 67, 48, 116, -13, 88});
Expand Down

0 comments on commit a8ac5b2

Please sign in to comment.