9 let (//) = Filename.concat
11 let testdata = "tests" // "80_testdata" ;;
14 let diff = Bitstring_config.diff
17 let files = Sys.readdir "." in
18 let files = Array.to_list files in
19 let files = List.filter (
21 String.length filename > 3 &&
22 filename.[0] = 'r' && filename.[1] = 'n' && filename.[2] = 'd'
24 let files = List.map (
26 let n = String.sub filename 3 (String.length filename - 3) in
27 let n = int_of_string n in
28 let bits = bitstring_of_file filename in
29 (* 'bitstring_of_file' loads whole bytes. Truncate it to
30 * the real bit-length.
32 let bits = takebits n bits in
37 (* Hexdump the bits, then compare using external 'diff' program. *)
39 fun (filename, n, bits) ->
40 let output_filename = sprintf "hex%d.actual" n in
41 let chan = open_out output_filename in
42 hexdump_bitstring chan bits;
47 fun (filename, n, bits) ->
48 let actual_filename = sprintf "hex%d.actual" n in
49 let expected_filename = sprintf "hex%d.expected" n in
53 (Filename.quote expected_filename)
54 (Filename.quote actual_filename) in
55 if Sys.command cmd <> 0 then (