Skip to content

Commit 8a75394

Browse files
less deadcode
1 parent cb85642 commit 8a75394

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

tests/gen_program.ml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,13 @@ module Function = struct
2424
(* Arbitrary function from int to bool *)
2525
type t = IntSet.t
2626

27-
let gen value_limit =
28-
List.init value_limit (fun i -> if Random.bool () then Some i else None)
29-
|> List.filter_map Fun.id |> IntSet.of_list
27+
let rec gen value_limit =
28+
let true_set =
29+
List.init value_limit (fun i -> if Random.bool () then Some i else None)
30+
|> List.filter_map Fun.id |> IntSet.of_list
31+
in
32+
let size = IntSet.cardinal true_set in
33+
if 0 < size && size < value_limit then true_set else gen value_limit
3034

3135
let eval t input = IntSet.mem input t
3236

@@ -140,7 +144,7 @@ module Step = struct
140144
in
141145
let fuel_a, fuel_b =
142146
let tmp = Random.int (max (fuel - func_count) 1) in
143-
(fuel - tmp, tmp)
147+
(tmp/2, tmp/2)
144148
in
145149

146150
let on_true = gen ~config ~fuel:fuel_a () in
@@ -202,9 +206,9 @@ let run config test_count =
202206
(* cmd *)
203207
let _ =
204208
let test_count = ref 100 in
205-
let globals_count = ref 6 in
206-
let value_limit = ref 5 in
207-
let operations_count = ref 3 in
209+
let globals_count = ref 3 in
210+
let value_limit = ref 3 in
211+
let operations_count = ref 6 in
208212
let thread_count = ref 3 in
209213
let generate_conditionals = ref true in
210214
let print_tests = ref false in

0 commit comments

Comments
 (0)