add CCVector.append_gen

This commit is contained in:
Simon Cruanes 2016-09-25 19:38:03 +02:00
parent 3e50420ce8
commit e4c6752b6b
2 changed files with 18 additions and 0 deletions

View file

@ -226,6 +226,20 @@ let append_list a b = match b with
length v = List.length l1 + List.length l2)
*)
let rec append_gen a b = match b() with
| None -> ()
| Some x -> push a x; append_gen a b
(*$Q
Q.(pair (list int)(list int)) (fun (l1,l2) -> \
let v = of_list l1 in append_gen v (Gen.of_list l2); \
to_list v = (l1 @ l2))
Q.(pair (list int)(list int)) (fun (l1,l2) -> \
let v = of_list l1 in append_gen v (Gen.of_list l2); \
length v = List.length l1 + List.length l2)
*)
(*$inject
let gen x =
let small = length in

View file

@ -84,6 +84,10 @@ val append_list : ('a, rw) t -> 'a list -> unit
(** Append content of list
@since 0.14 *)
val append_gen : ('a, rw) t -> 'a gen -> unit
(** Append content of generator
@since NEXT_RELEASE *)
val equal : 'a equal -> ('a,_) t equal
val compare : 'a ord -> ('a,_) t ord