Fix svnignore in the examples subdirectory.
[ocaml-bitstring.git] / tests / 06_ints3.ml
1 (* Extract some simple integers.
2  * $Id: 06_ints3.ml,v 1.2 2008-04-25 11:08:43 rjones Exp $
3  *)
4
5 let bits = Bitmatch.make_bitstring 16 '\xcf' (* makes the string 0xcfcf *)
6
7 let () =
8   bitmatch bits with
9   | { n0 : 3; n1 : 3; n2 : 3; n3 : 3; n4 : 3; n5 : 1;
10       rest : -1 : bitstring } ->
11       assert (n0 = 0b110);
12       assert (n1 = 0b011);
13       assert (n2 = 0b111);
14       assert (n3 = 0b100);
15       assert (n4 = 0b111);
16       assert (n5);
17
18       let _, off, len = rest in
19       assert (off = 16 && len = 0) (* no further data *)
20
21   | { _ } ->
22       failwith "error: did not match\n"