mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2026-05-05 17:04:25 -04:00
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:
parent
f020127725
commit
1b756c30b2
1 changed files with 10 additions and 3 deletions
|
|
@ -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
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue