Codebase list ocaml-qcheck / 63d2123
New upstream version 0.12 Stephane Glondu authored 3 years ago Stéphane Glondu committed 3 years ago
7 changed file(s) with 23 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
00 # Changes
1
2 ## 0.12
3
4 - fix singleton list shrinking
5 - feat: add `Gen.char_range` and `Gen.(<$>)` (credit @spewspews)
16
27 ## 0.11
38
33 homepage: "https://github.com/c-cube/qcheck/"
44 synopsis: "Alcotest backend for qcheck"
55 doc: ["http://c-cube.github.io/qcheck/"]
6 version: "0.11"
6 version: "0.12"
77 tags: [
88 "test"
99 "quickcheck"
33 homepage: "https://github.com/c-cube/qcheck/"
44 synopsis: "Core qcheck library"
55 doc: ["http://c-cube.github.io/qcheck/"]
6 version: "0.11"
6 version: "0.12"
77 tags: [
88 "test"
99 "property"
33 homepage: "https://github.com/c-cube/qcheck/"
44 doc: ["http://c-cube.github.io/qcheck/"]
55 synopsis: "OUnit backend for qcheck"
6 version: "0.11"
6 version: "0.12"
77 tags: [
88 "qcheck"
99 "quickcheck"
33 synopsis: "Compatibility package for qcheck"
44 homepage: "https://github.com/c-cube/qcheck/"
55 doc: ["http://c-cube.github.io/qcheck/"]
6 version: "0.11"
6 version: "0.12"
77 tags: [
88 "test"
99 "property"
0
10 (*
21 QCheck: Random testing for OCaml
32 copyright (c) 2013-2017, Guillaume Bury, Simon Cruanes, Vincent Hugot, Jan Midtgaard
7473 let map2 f x y st = f (x st) (y st)
7574 let map3 f x y z st = f (x st) (y st) (z st)
7675 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)
7878
7979 let oneof l st = List.nth l (Random.State.int st (List.length l)) st
8080 let oneofl xs st = List.nth xs (Random.State.int st (List.length xs))
171171 if bool st
172172 then small_nat st
173173 else - (small_nat st)
174
175 let char_range a b = map Char.chr (Char.code a -- Char.code b)
174176
175177 let random_binary_string st length =
176178 (* 0b011101... *)
420422
421423 let list_spine l yield =
422424 let n = List.length l in
423 let chunk_size = ref (n/2) in
425 let chunk_size = ref ((n+1)/2) in
424426
425427 (* push the [n] first elements of [l] into [q], return the rest of the list *)
426428 let rec fill_queue n l q = match n,l with
162162 val (>|=) : 'a t -> ('a -> 'b) -> 'b t
163163 (** An infix synonym for {!map}. *)
164164
165 val (<$>) : ('a -> 'b) -> 'a t -> 'b t
166 (** An infix synonym for {!map}
167 @since NEXT_RELEASE *)
168
165169 val oneof : 'a t list -> 'a t
166170 (** Constructs a generator that selects among a given list of generators. *)
167171
313317 val printable : char t (** Generates printable characters. *)
314318
315319 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 *)
316325
317326 val string_size : ?gen:char t -> int t -> string t
318327 (** Builds a string generator from a (non-negative) size generator.