formatting

This commit is contained in:
carm 2015-02-19 23:10:19 -05:00
parent 8d814d4feb
commit a1ca8ff831

View file

@ -30,9 +30,9 @@ module Array = struct
val empty : t val empty : t
val make: int -> elt -> t val make: int -> elt -> t
val length: t -> int val length: t -> int
val get: t -> int -> elt val get: t -> int -> elt
@ -42,12 +42,12 @@ module Array = struct
val copy : t -> t val copy : t -> t
val blit : t -> int -> t -> int -> int -> unit val blit : t -> int -> t -> int -> int -> unit
val iter : (elt -> unit) -> t -> unit val iter : (elt -> unit) -> t -> unit
end end
module ByteArray : module ByteArray :
S with type elt = char and type t = bytes = struct S with type elt = char and type t = bytes = struct
type elt = char type elt = char
include Bytes include Bytes
@ -203,13 +203,13 @@ struct
let copy b = let copy b =
{ b with buf=Array.copy b.buf; } { b with buf=Array.copy b.buf; }
(*$T (*$T
let b = ByteBuffer.create 3 in \ let b = ByteBuffer.create 3 in \
let s = Bytes.of_string "hello world" in \ let s = Bytes.of_string "hello world" in \
ByteBuffer.blit_from b s 0 (Bytes.length s); \ ByteBuffer.blit_from b s 0 (Bytes.length s); \
let b' = ByteBuffer.copy b in \ let b' = ByteBuffer.copy b in \
try ByteBuffer.iteri b (fun i c -> if ByteBuffer.get_front b' i <> c then raise Exit); true with Exit -> false try ByteBuffer.iteri b (fun i c -> if ByteBuffer.get_front b' i <> c then raise Exit); true with Exit -> false
*) *)
let capacity b = Array.length b.buf let capacity b = Array.length b.buf
@ -362,7 +362,7 @@ struct
(*$Q (*$Q
(Q.pair Q.printable_string Q.printable_string) (fun (s,s') -> \ (Q.pair Q.printable_string Q.printable_string) (fun (s,s') -> \
(let b = ByteBuffer.create 24 in ByteBuffer.blit_from b s 0 (Bytes.length s); (let b = ByteBuffer.create 24 in ByteBuffer.blit_from b s 0 (Bytes.length s);
ByteBuffer.blit_from b s' 0 (Bytes.length s'); \ ByteBuffer.blit_from b s' 0 (Bytes.length s'); \
ByteBuffer.blit_from b "hello world" 0 (Bytes.length "hello word"); (* big enough *) \ ByteBuffer.blit_from b "hello world" 0 (Bytes.length "hello word"); (* big enough *) \
let l = ByteBuffer.length b in let l' = l/2 in ByteBuffer.skip b l'; \ let l = ByteBuffer.length b in let l' = l/2 in ByteBuffer.skip b l'; \
ByteBuffer.length b + l' = l)) ByteBuffer.length b + l' = l))