mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-07 11:45:31 -05:00
optimize a bit the tests
This commit is contained in:
parent
ed31060d7d
commit
f296e77f63
3 changed files with 7 additions and 6 deletions
|
|
@ -292,7 +292,7 @@ let nth i q =
|
||||||
try Some (nth_exn i q)
|
try Some (nth_exn i q)
|
||||||
with Failure _ -> None
|
with Failure _ -> None
|
||||||
|
|
||||||
(*$Q
|
(*$Q & ~count:30
|
||||||
(Q.list Q.int) (fun l -> \
|
(Q.list Q.int) (fun l -> \
|
||||||
let len = List.length l in let idx = CCList.(0 -- (len - 1)) in \
|
let len = List.length l in let idx = CCList.(0 -- (len - 1)) in \
|
||||||
let q = of_list l in \
|
let q = of_list l in \
|
||||||
|
|
|
||||||
|
|
@ -352,7 +352,7 @@ module Make(E : ELT) : S with type elt = E.t = struct
|
||||||
else hashcons_ (N (p2, m2, l2, union r2 a))
|
else hashcons_ (N (p2, m2, l2, union r2 a))
|
||||||
else join_ a p1 b p2
|
else join_ a p1 b p2
|
||||||
|
|
||||||
(*$Q
|
(*$Q & ~count:50
|
||||||
Q.(list int) (fun l -> \
|
Q.(list int) (fun l -> \
|
||||||
let module S = Make(CCInt) in \
|
let module S = Make(CCInt) in \
|
||||||
let s = S.of_list l in S.equal s (S.union s s))
|
let s = S.of_list l in S.equal s (S.union s s))
|
||||||
|
|
@ -462,7 +462,7 @@ module Make(E : ELT) : S with type elt = E.t = struct
|
||||||
|
|
||||||
let to_list t = fold (fun x l -> x:: l) t []
|
let to_list t = fold (fun x l -> x:: l) t []
|
||||||
|
|
||||||
(*$Q
|
(*$Q & ~count:50
|
||||||
Q.(list int) (fun l -> \
|
Q.(list int) (fun l -> \
|
||||||
let module S = Make(CCInt) in \
|
let module S = Make(CCInt) in \
|
||||||
S.of_list l |> S.cardinal = List.length l)
|
S.of_list l |> S.cardinal = List.length l)
|
||||||
|
|
|
||||||
|
|
@ -451,12 +451,13 @@ let sleep time = make (fun () -> Thread.delay time)
|
||||||
|
|
||||||
(*$R
|
(*$R
|
||||||
let start = Unix.gettimeofday () in
|
let start = Unix.gettimeofday () in
|
||||||
let l = CCList.(1 -- 10)
|
let pause = 0.2 and n = 10 in
|
||||||
|> List.map (fun _ -> make (fun () -> Thread.delay 0.5))
|
let l = CCList.(1 -- n)
|
||||||
|
|> List.map (fun _ -> make (fun () -> Thread.delay pause))
|
||||||
in
|
in
|
||||||
List.iter get l;
|
List.iter get l;
|
||||||
let stop = Unix.gettimeofday () in
|
let stop = Unix.gettimeofday () in
|
||||||
OUnit.assert_bool "some_parallelism" (stop -. start < 10. *. 0.5);
|
OUnit.assert_bool "some_parallelism" (stop -. start < float_of_int n *. pause);
|
||||||
*)
|
*)
|
||||||
|
|
||||||
(** {2 Event timer} *)
|
(** {2 Event timer} *)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue