1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
(* Test concat and the bit get functions.
* $Id$
*)
let () =
for i = 0 to 33 do
for j = 0 to 33 do
for k = 0 to 33 do
let bits =
Bitstring.concat [
Bitstring.ones_bitstring i;
Bitstring.zeroes_bitstring j;
Bitstring.ones_bitstring k
] in
assert (Bitstring.bitstring_length bits = i+j+k);
for n = 0 to i-1 do
assert (Bitstring.is_set bits n)
done;
for n = i to i+j-1 do
assert (Bitstring.is_clear bits n)
done;
for n = i+j to i+j+k-1 do
assert (Bitstring.is_set bits n)
done
done
done
done
|