Skip to content

Commit 61317f1

Browse files
committed
Reuse power_of_2s for both generation and postcond_tear
1 parent 28e142a commit 61317f1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/array/stm_tests.ml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,11 @@ struct
5151
type state = elem list
5252
type sut = elem Array.t
5353

54+
let power_of_2s = Array.init 63 (fun i -> 1 lsl i)
55+
5456
let arb_cmd s =
5557
let int_gen = Gen.(frequency [1,small_nat; 5,int_bound (List.length s - 1)]) in
56-
let elem_gen = Gen.(map (fun sh -> 1 lsl sh) (int_bound 62)) in
58+
let elem_gen = Gen.oneofa power_of_2s in
5759
QCheck.make ~print:show_cmd (*~shrink:shrink_cmd*)
5860
Gen.(oneof
5961
[ return Length;
@@ -160,7 +162,6 @@ struct
160162
| To_seq, Res ((Seq Elem,_),r) -> Seq.equal (=) r (List.to_seq s)
161163
| _, _ -> false
162164

163-
let power_of_2s = Array.init 63 (fun i -> 1 lsl i)
164165
let is_power_of_2 i = Array.mem i power_of_2s
165166

166167
let postcond_tear c (s:int list) res = match c, res with

0 commit comments

Comments
 (0)