Improved test.
[ocaml-bitstring.git] / tests / 70_check_and_bind.ml
1 (* Test check() and bind().
2  * $Id$
3  *)
4
5 open Printf
6 open Bitmatch
7
8 let bits = (BITSTRING { 101 : 16; 202 : 16 })
9
10 let () =
11   bitmatch bits with
12   | { i : 16 : check (i = 101), bind (i*4);
13       j : 16 : check (j = 202) } ->
14       if i <> 404 || j <> 202 then
15         failwith (sprintf "70_check_and_bind: failed: %d %d" i j)
16   | { _ } ->
17       failwith "70_check_and_bind: match failed"