From: Richard W.M. Jones Date: Sun, 18 May 2008 19:21:59 +0000 (+0000) Subject: Removed obsolete tests, and moved some tests into examples. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=9598ebddee3b74b88aefcd3b47af8cf32dd8e096;p=ocaml-bitstring.git Removed obsolete tests, and moved some tests into examples. --- diff --git a/tests/ext3_sb b/examples/ext3_sb similarity index 100% rename from tests/ext3_sb rename to examples/ext3_sb diff --git a/tests/70_ext3_sb.ml b/examples/ext3_superblock.ml similarity index 98% rename from tests/70_ext3_sb.ml rename to examples/ext3_superblock.ml index 8ff5096..0dfb77e 100644 --- a/tests/70_ext3_sb.ml +++ b/examples/ext3_superblock.ml @@ -6,7 +6,7 @@ open Printf (*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 *) diff --git a/tests/ipv4.ping b/examples/ipv4.ping similarity index 100% rename from tests/ipv4.ping rename to examples/ipv4.ping diff --git a/tests/ipv6.ping b/examples/ipv6.ping similarity index 100% rename from tests/ipv6.ping rename to examples/ipv6.ping diff --git a/tests/60_ping.ml b/examples/ping.ml similarity index 100% rename from tests/60_ping.ml rename to examples/ping.ml diff --git a/tests/03_hexdump.ml b/tests/03_hexdump.ml deleted file mode 100644 index 793f92a..0000000 --- a/tests/03_hexdump.ml +++ /dev/null @@ -1,18 +0,0 @@ -(* 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 diff --git a/tests/05_bits.ml b/tests/05_bits.ml deleted file mode 100644 index 829643c..0000000 --- a/tests/05_bits.ml +++ /dev/null @@ -1,23 +0,0 @@ -(* 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" diff --git a/tests/06_ints1.ml b/tests/06_ints1.ml deleted file mode 100644 index 962f83e..0000000 --- a/tests/06_ints1.ml +++ /dev/null @@ -1,20 +0,0 @@ -(* 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" diff --git a/tests/06_ints2.ml b/tests/06_ints2.ml deleted file mode 100644 index 3587b4a..0000000 --- a/tests/06_ints2.ml +++ /dev/null @@ -1,24 +0,0 @@ -(* 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" diff --git a/tests/06_ints3.ml b/tests/06_ints3.ml deleted file mode 100644 index 850dd04..0000000 --- a/tests/06_ints3.ml +++ /dev/null @@ -1,22 +0,0 @@ -(* 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" diff --git a/tests/10_constr1.ml b/tests/10_constr1.ml deleted file mode 100644 index 0a14928..0000000 --- a/tests/10_constr1.ml +++ /dev/null @@ -1,22 +0,0 @@ -(* 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" diff --git a/tests/10_constr2.ml b/tests/10_constr2.ml deleted file mode 100644 index 92b1470..0000000 --- a/tests/10_constr2.ml +++ /dev/null @@ -1,12 +0,0 @@ -(* 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 ;;