mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-15 07:16:09 -05:00
more tests for WS_deque
This commit is contained in:
parent
078adae786
commit
78407c495d
1 changed files with 27 additions and 0 deletions
|
|
@ -92,8 +92,35 @@ let t_heavy () =
|
||||||
assert (ref_sum = sum);
|
assert (ref_sum = sum);
|
||||||
()
|
()
|
||||||
|
|
||||||
|
let t_many () =
|
||||||
|
print_endline "pushing many elements";
|
||||||
|
let d = D.create () in
|
||||||
|
|
||||||
|
let push_and_pop count =
|
||||||
|
for i = 1 to count do
|
||||||
|
(* if i mod 100_000 = 0 then Printf.printf "push %d\n%!" i; *)
|
||||||
|
D.push d i
|
||||||
|
done;
|
||||||
|
let n = ref 0 in
|
||||||
|
|
||||||
|
let continue = ref true in
|
||||||
|
while !continue do
|
||||||
|
match D.pop d with
|
||||||
|
| None -> continue := false
|
||||||
|
| Some _ -> incr n
|
||||||
|
done;
|
||||||
|
assert (!n = count)
|
||||||
|
in
|
||||||
|
|
||||||
|
push_and_pop 10_000;
|
||||||
|
push_and_pop 100_000;
|
||||||
|
push_and_pop 100_000_000;
|
||||||
|
print_endline "pushing many elements: ok";
|
||||||
|
()
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
let@ () = Trace_tef.with_setup () in
|
let@ () = Trace_tef.with_setup () in
|
||||||
t_simple ();
|
t_simple ();
|
||||||
t_heavy ();
|
t_heavy ();
|
||||||
|
t_many ();
|
||||||
()
|
()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue