Skip to content

Commit

Permalink
Randomize cmd generation
Browse files Browse the repository at this point in the history
  • Loading branch information
jmid committed Aug 7, 2024
1 parent 88425d4 commit 1be85cf
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/domain/dls_test.ml
Original file line number Diff line number Diff line change
@@ -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))

Expand All @@ -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

0 comments on commit 1be85cf

Please sign in to comment.