Skip to content

Commit 90974b1

Browse files
committed
fix(tests): stop using deprecated QCheck2 generators
1 parent e0c8322 commit 90974b1

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

test/lib/gen.ml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616

1717
let csexp =
1818
let open QCheck2.Gen in
19-
let atom = small_string ~gen:printable |> map Yocaml.Sexp.atom in
20-
let node self n = small_list (self (n / 10)) |> map Yocaml.Sexp.node in
19+
let atom = string_small |> map Yocaml.Sexp.atom in
20+
let node self n = list_small (self (n / 10)) |> map Yocaml.Sexp.node in
2121
fix (fun self -> function
2222
| 0 -> atom
23-
| n -> frequency [ (1, atom); (5, node self n) ])
23+
| n -> oneof_weighted [ (1, atom); (5, node self n) ])
2424
|> sized
2525

2626
let alphanumeric =
@@ -32,20 +32,20 @@ let sexp =
3232
let atom =
3333
string_size ~gen:alphanumeric (int_range 1 100) |> map Yocaml.Sexp.atom
3434
in
35-
let node self n = small_list (self (n / 10)) |> map Yocaml.Sexp.node in
35+
let node self n = list_small (self (n / 10)) |> map Yocaml.Sexp.node in
3636
fix (fun self -> function
3737
| 0 -> atom
38-
| n -> frequency [ (1, atom); (5, node self n) ])
38+
| n -> oneof_weighted [ (1, atom); (5, node self n) ])
3939
|> sized
4040

4141
let path =
4242
let open QCheck2.Gen in
4343
let fragment =
44-
string_size ~gen:(char_range 'a' 'z') (int_range 1 10) |> small_list
44+
string_size ~gen:(char_range 'a' 'z') (int_range 1 10) |> list_small
4545
in
4646
let rel = fragment |> map Yocaml.Path.rel in
4747
let abs = fragment |> map Yocaml.Path.abs in
48-
frequency [ (5, rel); (5, abs) ]
48+
oneof_weighted [ (5, rel); (5, abs) ]
4949

5050
let deps =
5151
let open QCheck2.Gen in
@@ -56,8 +56,8 @@ let cache_entry =
5656
map3
5757
(fun last_build_date hash deps ->
5858
Yocaml.Cache.entry ?last_build_date hash deps)
59-
(opt int)
60-
(small_string ~gen:printable)
59+
(option int)
60+
string_small
6161
deps
6262

6363
let cache =
@@ -67,4 +67,4 @@ let cache =
6767
let+ k = path in
6868
(k, v)
6969
in
70-
line |> small_list |> map Yocaml.Cache.from_list
70+
line |> list_small |> map Yocaml.Cache.from_list

0 commit comments

Comments
 (0)