git.annexia.org
/
ocaml-bitstring.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update coverage report.
[ocaml-bitstring.git]
/
tests
/
11_match_ints.ml
diff --git
a/tests/11_match_ints.ml
b/tests/11_match_ints.ml
index
c2a2b8b
..
c9ffd1a
100644
(file)
--- a/
tests/11_match_ints.ml
+++ b/
tests/11_match_ints.ml
@@
-21,12
+21,12
@@
let () =
Random.int64 (Int64.sub (Int64.shift_left 1L bitlen) 1L))
(range 0 (len-1)) in
Random.int64 (Int64.sub (Int64.shift_left 1L bitlen) 1L))
(range 0 (len-1)) in
- let bits = Bit
match
.Buffer.create () in
+ let bits = Bit
string
.Buffer.create () in
List.iter (fun i ->
List.iter (fun i ->
- Bit
match
.construct_int64_be_unsigned bits i bitlen
+ Bit
string
.construct_int64_be_unsigned bits i bitlen
(Failure "constructing string"))
expected;
(Failure "constructing string"))
expected;
- let bits = Bit
match
.Buffer.contents bits in
+ let bits = Bit
string
.Buffer.contents bits in
(* Now read the bitstring as integers.
* In each case check the result against what we generated ('expected').
(* Now read the bitstring as integers.
* In each case check the result against what we generated ('expected').
@@
-34,17
+34,16
@@
let () =
let actual =
let rec loop bits =
bitmatch bits with
let actual =
let rec loop bits =
bitmatch bits with
- | { i : bitlen; rest : -1 : bitstring } ->
- if Bitmatch.bitstring_length rest > 0 then
- i :: loop rest
- else
- [i]
+ | { i : bitlen; rest : -1 : bitstring }
+ when Bitstring.bitstring_length rest = 0 -> [i]
+ | { i : bitlen; rest : -1 : bitstring } -> i :: loop rest
| { _ } ->
failwith (sprintf "loop failed with len = %d, bitlen = %d"
len bitlen)
in
loop bits in
if actual <> expected then
| { _ } ->
failwith (sprintf "loop failed with len = %d, bitlen = %d"
len bitlen)
in
loop bits in
if actual <> expected then
- failwith (sprintf "match bits: failed on 1 bit test, len = %d" len)
+ failwith (sprintf "match ints: failed on test, len = %d, bitlen = %d"
+ len bitlen)
done
done
done
done