(*let () = Bitmatch.debug := true*)
-let bits = Bitmatch.bitstring_of_file "tests/ext3_sb"
+let bits = Bitmatch.bitstring_of_file "ext3_sb"
(* The structure is straight from /usr/include/linux/ext3_fs.h *)
+++ /dev/null
-(* Test the hexdump function.
- * $Id: 03_hexdump.ml,v 1.1 2008-04-01 10:06:12 rjones Exp $
- *)
-
-open Printf
-
-let bits = Bitmatch.make_bitstring (32*8) '\x5a'
-
-let () =
- Bitmatch.hexdump_bitstring stdout bits;
-
- let data, off, len = bits in
- let bits = data, off+1, len-1 in
- Bitmatch.hexdump_bitstring stdout bits;
-
- let data, off, len = bits in
- let bits = data, off+1, len-1 in
- Bitmatch.hexdump_bitstring stdout bits
+++ /dev/null
-(* Extract bits.
- * $Id: 05_bits.ml,v 1.3 2008-04-25 11:08:43 rjones Exp $
- *)
-
-let bits = Bitmatch.make_bitstring 24 '\x5a' (* makes the string 0x5a5a5a *)
-
-let () =
- bitmatch bits with
- | { b0 : 1; b1 : 1; b2 : 1; b3 : 1; b4 : 1; b5 : 1; b6 : 1; b7 : 1;
- b8 : 1; b9 : 1; b10 : 1; b11 : 1; b12 : 1; b13 : 1; b14 : 1; b15 : 1;
- b16 : 1; b17 : 1; b18 : 1; b19 : 1; b20 : 1; b21 : 1; b22 : 1; b23 : 1;
- rest : -1 : bitstring } ->
- assert (not b0 && b1 && not b2 && b3 && (* 0x5 *)
- b4 && not b5 && b6 && not b7); (* 0xA *)
- assert (not b8 && b9 && not b10 && b11 && (* 0x5 *)
- b12 && not b13 && b14 && not b15); (* 0xA *)
- assert (not b16 && b17 && not b18 && b19 && (* 0x5 *)
- b20 && not b21 && b22 && not b23); (* 0xA *)
- let _, off, len = rest in
- assert (off = 24 && len = 0) (* no further data *)
-
- | { _ } ->
- failwith "error: did not match\n"
+++ /dev/null
-(* Extract some simple integers.
- * $Id: 06_ints1.ml,v 1.2 2008-04-25 11:08:43 rjones Exp $
- *)
-
-let bits = Bitmatch.make_bitstring 16 '\xcf' (* makes the string 0xcfcf *)
-
-let () =
- bitmatch bits with
- | { n0 : 4; n1 : 4; n2 : 4; n3 : 4;
- rest : -1 : bitstring } ->
- assert (n0 = 0xc);
- assert (n1 = 0xf);
- assert (n2 = 0xc);
- assert (n3 = 0xf);
-
- let _, off, len = rest in
- assert (off = 16 && len = 0) (* no further data *)
-
- | { _ } ->
- failwith "error: did not match\n"
+++ /dev/null
-(* Extract some simple integers.
- * $Id: 06_ints2.ml,v 1.2 2008-04-25 11:08:43 rjones Exp $
- *)
-
-let bits = Bitmatch.make_bitstring 16 '\xcf' (* makes the string 0xcfcf *)
-
-let () =
- bitmatch bits with
- | { n0 : 2; n1 : 2; n2 : 2; n3 : 2; n4 : 2; n5 : 2; n6 : 2; n7 : 2;
- rest : -1 : bitstring } ->
- assert (n0 = 0x3); (* 0xc *)
- assert (n1 = 0x0);
- assert (n2 = 0x3); (* 0xf *)
- assert (n3 = 0x3);
- assert (n4 = 0x3); (* 0xc *)
- assert (n5 = 0x0);
- assert (n6 = 0x3); (* 0xf *)
- assert (n7 = 0x3);
-
- let _, off, len = rest in
- assert (off = 16 && len = 0) (* no further data *)
-
- | { _ } ->
- failwith "error: did not match\n"
+++ /dev/null
-(* Extract some simple integers.
- * $Id: 06_ints3.ml,v 1.2 2008-04-25 11:08:43 rjones Exp $
- *)
-
-let bits = Bitmatch.make_bitstring 16 '\xcf' (* makes the string 0xcfcf *)
-
-let () =
- bitmatch bits with
- | { n0 : 3; n1 : 3; n2 : 3; n3 : 3; n4 : 3; n5 : 1;
- rest : -1 : bitstring } ->
- assert (n0 = 0b110);
- assert (n1 = 0b011);
- assert (n2 = 0b111);
- assert (n3 = 0b100);
- assert (n4 = 0b111);
- assert (n5);
-
- let _, off, len = rest in
- assert (off = 16 && len = 0) (* no further data *)
-
- | { _ } ->
- failwith "error: did not match\n"
+++ /dev/null
-(* Test a simple constructor.
- * $Id: 10_constr1.ml,v 1.2 2008-04-25 11:08:43 rjones Exp $
- *)
-
-let bits = BITSTRING { 0xc : 4; 0xf : 4; 0xc : 4; 0xf : 4 } ;;
-
-assert (bits = Bitmatch.make_bitstring 16 '\xcf') ;;
-
-let () =
- bitmatch bits with
- | { n0 : 4; n1 : 4; n2 : 4; n3 : 4;
- rest : -1 : bitstring } ->
- assert (n0 = 0xc);
- assert (n1 = 0xf);
- assert (n2 = 0xc);
- assert (n3 = 0xf);
-
- let _, off, len = rest in
- assert (off = 16 && len = 0) (* no further data *)
-
- | { _ } ->
- failwith "error: did not match\n"
+++ /dev/null
-(* Test a simple constructor.
- * $Id: 10_constr2.ml,v 1.2 2008-04-25 11:08:43 rjones Exp $
- *)
-
-let version = 1 ;;
-let data = 10 ;;
-let bits =
- BITSTRING
- { version : 4;
- data : 12 } ;;
-
-Bitmatch.hexdump_bitstring stdout bits ;;