Make skip test more useful

Test skipping through multiple values of different sizes (1, 3, and 2 bytes)
instead of redundantly testing skip on a single 0L value
This commit is contained in:
Simon Cruanes 2026-02-10 02:12:06 +00:00
parent f020127725
commit 1b756c30b2
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4

View file

@ -133,10 +133,17 @@ true
t @@ fun () -> t @@ fun () ->
let buf = Buf.create () in let buf = Buf.create () in
Leb128.Encode.i64 buf 0L; Leb128.Encode.u64 buf 127L;
Leb128.Encode.u64 buf 16384L;
Leb128.Encode.u64 buf 300L;
let slice = Buf.to_slice buf in let slice = Buf.to_slice buf in
let skip = Leb128.Decode.skip slice 0 in let n1 = Leb128.Decode.skip slice 0 in
assert_equal ~printer:string_of_int 1 skip; let n2 = Leb128.Decode.skip slice n1 in
let n3 = Leb128.Decode.skip slice (n1 + n2) in
assert_equal ~printer:string_of_int 1 n1;
assert_equal ~printer:string_of_int 3 n2;
assert_equal ~printer:string_of_int 2 n3;
assert_equal ~printer:string_of_int 6 (n1 + n2 + n3);
true true
;; ;;