From 78407c495d79f4b275979619e1506ca01782a881 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Wed, 25 Oct 2023 09:56:56 -0400 Subject: [PATCH] more tests for WS_deque --- test/t_ws_deque.ml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/t_ws_deque.ml b/test/t_ws_deque.ml index 4a364166..73f1f6f5 100644 --- a/test/t_ws_deque.ml +++ b/test/t_ws_deque.ml @@ -92,8 +92,35 @@ let t_heavy () = 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@ () = Trace_tef.with_setup () in t_simple (); t_heavy (); + t_many (); ()