mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
add more tests
This commit is contained in:
parent
65d7c6d3ae
commit
ada364ae3a
2 changed files with 16 additions and 3 deletions
|
|
@ -559,6 +559,19 @@ module Make(W : WORD) = struct
|
|||
let t = S.of_list l in \
|
||||
S.check_invariants t)
|
||||
*)
|
||||
|
||||
(*$Q & ~small:List.length ~count:30
|
||||
Q.(list_of_size Gen.(1 -- 20) (pair printable_string small_int)) \
|
||||
(fun l -> let t = String.of_list l in \
|
||||
List.for_all (fun (k,_) -> \
|
||||
String.above k t |> Sequence.for_all (fun (k',v) -> k' >= k)) \
|
||||
l)
|
||||
Q.(list_of_size Gen.(1 -- 20) (pair printable_string small_int)) \
|
||||
(fun l -> let t = String.of_list l in \
|
||||
List.for_all (fun (k,_) -> \
|
||||
String.below k t |> Sequence.for_all (fun (k',v) -> k' <= k)) \
|
||||
l)
|
||||
*)
|
||||
end
|
||||
|
||||
module type ORDERED = sig
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ let parse_string s : t or_error =
|
|||
(*$inject
|
||||
let sexp_gen =
|
||||
let mkatom a = `Atom a and mklist l = `List l in
|
||||
let atom = Q.Gen.(map mkatom (string_size (int_range 1 30))) in
|
||||
let atom = Q.Gen.(map mkatom (string_size ~gen:printable (1 -- 30))) in
|
||||
let gen = Q.Gen.(
|
||||
sized (fix
|
||||
(fun self n st -> match n with
|
||||
|
|
@ -343,7 +343,7 @@ let parse_string s : t or_error =
|
|||
| _ ->
|
||||
frequency
|
||||
[ 1, atom
|
||||
; 2, map mklist (list_size (int_bound 10) (self (n/10)))
|
||||
; 2, map mklist (list_size (0 -- 10) (self (n/10)))
|
||||
] st
|
||||
)
|
||||
)) in
|
||||
|
|
@ -365,7 +365,7 @@ let parse_string s : t or_error =
|
|||
| `List l -> List.for_all sexp_valid l
|
||||
*)
|
||||
|
||||
(*$Q & ~count:30
|
||||
(*$Q & ~count:100
|
||||
sexp_gen (fun s -> sexp_valid s ==> (to_string s |> parse_string = `Ok s))
|
||||
*)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue