Skip to content

Commit

Permalink
Extra tests for Negative VLQ Longs
Browse files Browse the repository at this point in the history
  • Loading branch information
mikera committed Oct 7, 2024
1 parent 44615f5 commit 80c20b0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion convex-core/src/test/java/convex/core/data/FormatTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@
*/
public class FormatTest {

@Test public void testVLQEncoding() {
@Test public void testVLQLongs() {
checkVLQLong("00",0);
checkVLQLong("01",1);
checkVLQLong("3f",63);
checkVLQLong("8040",64); // first overflow into 2 bytes

checkVLQLong("7f",-1);
checkVLQLong("40",-64);
checkVLQLong("ff3f",-65);
checkVLQLong("ff00",-128);
checkVLQLong("fe7f",-129);

checkVLQLong("87ffffff7f",Integer.MAX_VALUE);
checkVLQLong("8880808000",Integer.MAX_VALUE+1l);
checkVLQLong("80ffffffffffffffff7f",Long.MAX_VALUE);
Expand Down

0 comments on commit 80c20b0

Please sign in to comment.