New upstream version 0.12
Stephane Glondu authored 3 years ago
Stéphane Glondu committed 3 years ago
0 | 0 |
# Changes
|
|
1 |
|
|
2 |
## 0.12
|
|
3 |
|
|
4 |
- fix singleton list shrinking
|
|
5 |
- feat: add `Gen.char_range` and `Gen.(<$>)` (credit @spewspews)
|
1 | 6 |
|
2 | 7 |
## 0.11
|
3 | 8 |
|
3 | 3 |
homepage: "https://github.com/c-cube/qcheck/"
|
4 | 4 |
synopsis: "Alcotest backend for qcheck"
|
5 | 5 |
doc: ["http://c-cube.github.io/qcheck/"]
|
6 | |
version: "0.11"
|
|
6 |
version: "0.12"
|
7 | 7 |
tags: [
|
8 | 8 |
"test"
|
9 | 9 |
"quickcheck"
|
3 | 3 |
homepage: "https://github.com/c-cube/qcheck/"
|
4 | 4 |
synopsis: "Core qcheck library"
|
5 | 5 |
doc: ["http://c-cube.github.io/qcheck/"]
|
6 | |
version: "0.11"
|
|
6 |
version: "0.12"
|
7 | 7 |
tags: [
|
8 | 8 |
"test"
|
9 | 9 |
"property"
|
3 | 3 |
homepage: "https://github.com/c-cube/qcheck/"
|
4 | 4 |
doc: ["http://c-cube.github.io/qcheck/"]
|
5 | 5 |
synopsis: "OUnit backend for qcheck"
|
6 | |
version: "0.11"
|
|
6 |
version: "0.12"
|
7 | 7 |
tags: [
|
8 | 8 |
"qcheck"
|
9 | 9 |
"quickcheck"
|
3 | 3 |
synopsis: "Compatibility package for qcheck"
|
4 | 4 |
homepage: "https://github.com/c-cube/qcheck/"
|
5 | 5 |
doc: ["http://c-cube.github.io/qcheck/"]
|
6 | |
version: "0.11"
|
|
6 |
version: "0.12"
|
7 | 7 |
tags: [
|
8 | 8 |
"test"
|
9 | 9 |
"property"
|
0 | |
|
1 | 0 |
(*
|
2 | 1 |
QCheck: Random testing for OCaml
|
3 | 2 |
copyright (c) 2013-2017, Guillaume Bury, Simon Cruanes, Vincent Hugot, Jan Midtgaard
|
|
74 | 73 |
let map2 f x y st = f (x st) (y st)
|
75 | 74 |
let map3 f x y z st = f (x st) (y st) (z st)
|
76 | 75 |
let map_keep_input f gen st = let x = gen st in x, f x
|
77 | |
let (>|=) x f = map f x
|
|
76 |
let (>|=) x f st = f (x st)
|
|
77 |
let (<$>) f x st = f (x st)
|
78 | 78 |
|
79 | 79 |
let oneof l st = List.nth l (Random.State.int st (List.length l)) st
|
80 | 80 |
let oneofl xs st = List.nth xs (Random.State.int st (List.length xs))
|
|
171 | 171 |
if bool st
|
172 | 172 |
then small_nat st
|
173 | 173 |
else - (small_nat st)
|
|
174 |
|
|
175 |
let char_range a b = map Char.chr (Char.code a -- Char.code b)
|
174 | 176 |
|
175 | 177 |
let random_binary_string st length =
|
176 | 178 |
(* 0b011101... *)
|
|
420 | 422 |
|
421 | 423 |
let list_spine l yield =
|
422 | 424 |
let n = List.length l in
|
423 | |
let chunk_size = ref (n/2) in
|
|
425 |
let chunk_size = ref ((n+1)/2) in
|
424 | 426 |
|
425 | 427 |
(* push the [n] first elements of [l] into [q], return the rest of the list *)
|
426 | 428 |
let rec fill_queue n l q = match n,l with
|
162 | 162 |
val (>|=) : 'a t -> ('a -> 'b) -> 'b t
|
163 | 163 |
(** An infix synonym for {!map}. *)
|
164 | 164 |
|
|
165 |
val (<$>) : ('a -> 'b) -> 'a t -> 'b t
|
|
166 |
(** An infix synonym for {!map}
|
|
167 |
@since NEXT_RELEASE *)
|
|
168 |
|
165 | 169 |
val oneof : 'a t list -> 'a t
|
166 | 170 |
(** Constructs a generator that selects among a given list of generators. *)
|
167 | 171 |
|
|
313 | 317 |
val printable : char t (** Generates printable characters. *)
|
314 | 318 |
|
315 | 319 |
val numeral : char t (** Generates numeral characters. *)
|
|
320 |
|
|
321 |
val char_range : char -> char -> char t
|
|
322 |
(** Generates chars between the two bounds, inclusive.
|
|
323 |
Example: [char_range 'a' 'z'] for all lower case ascii letters.
|
|
324 |
@since NEXT_RELEASE *)
|
316 | 325 |
|
317 | 326 |
val string_size : ?gen:char t -> int t -> string t
|
318 | 327 |
(** Builds a string generator from a (non-negative) size generator.
|