File: t_random.ml

package info (click to toggle)
ocaml-containers 3.15%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 2,412 kB
  • sloc: ml: 33,221; sh: 122; makefile: 32
file content (20 lines) | stat: -rw-r--r-- 516 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
open CCRandom
module T = (val Containers_testlib.make ~__FILE__ ())
include T;;

q Q.(list small_int) (fun l -> l = [] || List.mem (run (pick_list l)) l);;

q
  Q.(pair small_int small_int)
  (fun (i, j) ->
    let len, n = 2 + min i j, max i j in
    let l = QCheck.Gen.generate1 (split_list n ~len) in
    match l with
    | None -> true
    | Some l -> l <> [] && List.for_all (fun x -> x > 0) l)
;;

t @@ fun () ->
let open Containers in
ignore (List.random_choose [ 1; 2; 3 ] (Random.get_state ()) : int);
true