Skip to content

Commit 91cc585

Browse files
authored
fix (#485)
1 parent bcfa092 commit 91cc585

38 files changed

+284
-289
lines changed

containers-data.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ depends: [
1212
"dune" {>= "3.0"}
1313
"ocaml" {>= "4.08"}
1414
"containers" {= version}
15-
"qcheck-core" {>= "0.18" & with-test}
15+
"qcheck-core" {>= "0.91" & with-test}
1616
"iter" {with-test}
1717
"gen" {with-test}
1818
"mdx" {with-test}

containers.opam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ depends: [
1414
"ocaml" {>= "4.08"}
1515
"either"
1616
"dune-configurator"
17-
"qcheck-core" {>= "0.18" & with-test}
17+
"qcheck-core" {>= "0.91" & with-test}
1818
"yojson" {with-test}
1919
"iter" {with-test}
2020
"gen" {with-test}

dune-project

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
dune-configurator
3131
(qcheck-core
3232
(and
33-
(>= 0.18)
33+
(>= 0.91)
3434
:with-test))
3535
(yojson :with-test)
3636
(iter :with-test)
@@ -52,7 +52,7 @@
5252
(= :version))
5353
(qcheck-core
5454
(and
55-
(>= 0.18)
55+
(>= 0.91)
5656
:with-test))
5757
(iter :with-test)
5858
(gen :with-test)

tests/core/t_IO.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ true
1515
;;
1616

1717
q
18-
Q.(list_of_size Gen.(0 -- 40) printable_string)
18+
Q.(list_size Gen.(0 -- 40) string_printable)
1919
(fun l ->
2020
let l' = ref [] in
2121
File.with_temp ~prefix:"test_containers" ~suffix:"" (fun name ->
@@ -27,7 +27,7 @@ q
2727
;;
2828

2929
q
30-
Q.(list_of_size Gen.(0 -- 40) printable_string)
30+
Q.(list_size Gen.(0 -- 40) string_printable)
3131
(fun l ->
3232
let l' = ref [] in
3333
File.with_temp ~prefix:"test_containers" ~suffix:"" (fun name ->
@@ -39,7 +39,7 @@ q
3939
;;
4040

4141
q
42-
Q.(list_of_size Gen.(0 -- 40) printable_string)
42+
Q.(list_size Gen.(0 -- 40) string_printable)
4343
(fun l ->
4444
let s = ref "" in
4545
File.with_temp ~prefix:"test_containers1" ~suffix:"" (fun name1 ->

tests/core/t_array.ml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ eq ~cmp:( = )
108108
;;
109109

110110
q
111-
Q.(array_of_size Gen.(0 -- 30) printable_string)
111+
Q.(array_size Gen.(0 -- 30) string_printable)
112112
(fun a ->
113113
let b = sort_indices String.compare a in
114114
sorted String.compare a = Array.map (Array.get a) b)
@@ -127,18 +127,18 @@ eq ~cmp:( = )
127127
;;
128128

129129
q
130-
Q.(array_of_size Gen.(0 -- 50) printable_string)
130+
Q.(array_size Gen.(0 -- 50) string_printable)
131131
(fun a ->
132132
let b = sort_ranking String.compare a in
133133
let a_sorted = sorted String.compare a in
134134
a = Array.map (Array.get a_sorted) b)
135135
;;
136136

137-
q Q.(array small_int) (fun a -> rev (rev a) = a);;
137+
q Q.(array nat_small) (fun a -> rev (rev a) = a);;
138138
t @@ fun () -> rev [| 1; 2; 3 |] = [| 3; 2; 1 |];;
139139
t @@ fun () -> rev [| 1; 2 |] = [| 2; 1 |];;
140140
t @@ fun () -> rev [||] = [||];;
141-
q Q.(array small_int) (fun a -> mem 1 a = Array.mem 1 a);;
141+
q Q.(array nat_small) (fun a -> mem 1 a = Array.mem 1 a);;
142142
eq (Some 3) (max Stdlib.compare [| 1; 2; 3 |]);;
143143
eq (Some 4) (max Stdlib.compare [| 4; -1; 2; 3 |]);;
144144
eq None (max Stdlib.compare [||]);;
@@ -217,17 +217,17 @@ t @@ fun () -> 4 -- 1 |> Array.to_list = [ 4; 3; 2; 1 ];;
217217
t @@ fun () -> 0 -- 0 |> Array.to_list = [ 0 ];;
218218

219219
q
220-
Q.(pair small_int small_int)
220+
Q.(pair nat_small nat_small)
221221
(fun (a, b) -> a -- b |> Array.to_list = CCList.(a -- b))
222222
;;
223223

224224
q
225-
Q.(pair small_int small_int)
225+
Q.(pair nat_small nat_small)
226226
(fun (a, b) -> a --^ b |> Array.to_list = CCList.(a --^ b))
227227
;;
228228

229229
q
230-
Q.(pair (array small_int) (array small_int))
230+
Q.(pair (array nat_small) (array nat_small))
231231
(fun (a, b) -> equal ( = ) a b = equal ( = ) b a)
232232
;;
233233

@@ -250,7 +250,7 @@ a = [| 3; 2; 1 |]
250250
;;
251251

252252
q
253-
Q.(array_of_size Gen.(0 -- 100) small_int)
253+
Q.(array_size Gen.(0 -- 100) nat_small)
254254
(fun a ->
255255
let b = Array.copy a in
256256
for i = 0 to Array.length a - 1 do
@@ -294,7 +294,7 @@ module IA = struct
294294
type t = int array
295295
end
296296

297-
let gen_arr = Q.Gen.(array_size (1 -- 100) small_int)
297+
let gen_arr = Q.Gen.(array_size (1 -- 100) nat_small)
298298

299299
let arr_arbitrary =
300300
Q.make

tests/core/t_bencode.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ let g_rand_b =
2525
match n with
2626
| 0 -> oneof base
2727
| n ->
28-
frequency
28+
oneof_weighted
2929
@@ List.map (fun x -> 2, x) base
3030
@ [
3131
1, list_size (0 -- 10) (self (n - 1)) >|= B.list;

tests/core/t_byte_buffer.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ let gen_op size : (_ * _) Gen.t =
5959
else
6060
[]
6161
in
62-
frequency
62+
oneof_weighted
6363
(base
6464
@ [
6565
1, return (Get_contents, size);

tests/core/t_canonical_sexp.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ let sexp_gen =
2828
match n with
2929
| 0 -> atom st
3030
| _ ->
31-
frequency
31+
oneof_weighted
3232
[
3333
1, atom; 2, map mklist (list_size (0 -- 10) (self (n / 10)));
3434
]

tests/core/t_cbor.ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ let gen_c : Cbor.t Q.Gen.t =
2626
let+ f = float in
2727
`Float f );
2828
( 2,
29-
let* n = frequency [ 20, 0 -- 150; 1, 151 -- 100_000 ] in
29+
let* n = oneof_weighted [ 20, 0 -- 150; 1, 151 -- 100_000 ] in
3030
let+ s = string_size ~gen:printable (return n) in
3131
`Text s );
3232
( 2,
33-
let* n = frequency [ 20, 0 -- 150; 1, 151 -- 100_000 ] in
33+
let* n = oneof_weighted [ 20, 0 -- 150; 1, 151 -- 100_000 ] in
3434
let+ s = string_size ~gen:char (return n) in
3535
`Bytes s );
3636
]
3737
in
38-
let g_base = frequency base in
38+
let g_base = oneof_weighted base in
3939
let rec_ =
4040
[
4141
( 2,
@@ -59,7 +59,7 @@ let gen_c : Cbor.t Q.Gen.t =
5959
`Tag (i, sub) );
6060
]
6161
in
62-
frequency
62+
oneof_weighted
6363
(if size > 0 then
6464
base @ rec_
6565
else

tests/core/t_char.ml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@ include T;;
44

55
eq (Some 'a') (of_int (to_int 'a'));;
66
eq None (of_int 257);;
7-
8-
q
9-
(Q.string_of_size (Q.Gen.return 1))
10-
(fun s -> Stdlib.( = ) (to_string s.[0]) s)
11-
;;
12-
7+
q (Q.string_size (Q.Gen.return 1)) (fun s -> Stdlib.( = ) (to_string s.[0]) s);;
138
q (Q.int_range 65 90 |> Q.map Char.chr) CCChar.is_uppercase_ascii;;
149

1510
q

0 commit comments

Comments
 (0)