File: 33_substring.ml

package info (click to toggle)
ocaml-bitstring 2.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,276 kB
  • ctags: 492
  • sloc: ml: 3,360; sh: 377; makefile: 324; ansic: 113
file content (20 lines) | stat: -rw-r--r-- 380 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(* Test subbitstring call.
 * $Id$
 *)

open Printf
open Bitstring

let () =
  let bits = make_bitstring 65 '\x5a' in
  for off = 0 to 65 do
    for len = 65-off to 0 do
      let sub = subbitstring bits off len in
      for i = 0 to len-1 do
	if get bits (off+i) <> get sub i then (
	  eprintf "33_substring: failed %d %d %d\n" off len i;
	  exit 1
	)
      done
    done
  done