From 1be85cffbcb3e47543a6568024e7efee4ba3d526 Mon Sep 17 00:00:00 2001 From: Jan Midtgaard Date: Wed, 7 Aug 2024 17:28:32 +0200 Subject: [PATCH] Randomize cmd generation --- src/domain/dls_test.ml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/domain/dls_test.ml b/src/domain/dls_test.ml index 31bd382c..99239488 100644 --- a/src/domain/dls_test.ml +++ b/src/domain/dls_test.ml @@ -1,9 +1,6 @@ let length = 8 -type cmd = - | Get of int - -let cmds = [Get 0; Get 1; Get 2; Get 3; Get 7; Get 6; Get 5; Get 4; ] +type cmd = Get of int let init_sut () = List.init length (fun i -> Domain.DLS.new_key (fun () -> i)) @@ -16,9 +13,13 @@ let rec interp sut cs = match cs with let run n = for i = 1 to n do if i mod 100 = 0 then Printf.printf "#%!"; - Domain.spawn (fun () -> + let cmds = List.init 30 (fun _ -> Get (Random.int length)) in + (*[Get 0; Get 1; Get 2; Get 3; Get 7; Get 6; Get 5; Get 4; ]*) + Domain.spawn (fun () -> let sut = init_sut () in - interp sut (cmds@cmds@cmds)) |> Domain.join + interp sut cmds) |> Domain.join done -let _ = run 50_000 +let _ = + Random.self_init (); + run 50_000