Skip to content

Commit b2dbfc7

Browse files
committed
Refine Out_channel string/bytes generator
1 parent fa3f668 commit b2dbfc7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/io/stm_tests.ml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,12 @@ struct
6060
let int64_gen = Gen.(map Int64.of_int small_int) in
6161
let char_gen = Gen.printable in
6262
let byte_gen = Gen.small_int in
63-
let string_gen = Gen.small_string in
64-
let bytes_gen = Gen.bytes_small in
63+
let size_gen =
64+
Gen.(map2 (fun pos size_adj ->
65+
let res = 1 lsl (pos-1) in
66+
if size_adj < res then res-size_adj else res) (int_bound 18) (int_bound 10)) in
67+
let string_gen = Gen.(string_size (oneof [small_nat; size_gen])) in
68+
let bytes_gen = Gen.(bytes_size (oneof [small_nat; size_gen])) in
6569
QCheck.make ~print:show_cmd (*~shrink:shrink_cmd*)
6670
(match s with
6771
| Closed ->

0 commit comments

Comments
 (0)