text
stringlengths
0
601k
let ( ) = let view_len = 8 in let xchg_len = 4 in let period = 1 . 0 in let fanout = 5 in let seen_len = 10 in let me = Node . init ( u64 100L ) in let group1 = Group . init ( u64 1000L ) in let view1 = View . add ( Node . init ( u64 110L ) ) ( View . add ( Node . init ( u64 120L ) ) ( View . add ( Node . init ( u64 13...
type flt_temp = [ ` FLT_TEMP of int ] int
type vec_temp = [ ` VEC_TEMP of int ] int
type any_temp = [ flt_temp | vec_temp ] vec_temp
let any1 : any_temp -> string = function | ` FLT_TEMP x -> sprintf " t % d : float " x | ` VEC_TEMP x -> sprintf " t % d : vector " x
let any2 : [ < any_temp ] any_temp -> string = function | ` FLT_TEMP x -> sprintf " t % d : float " x | ` VEC_TEMP x -> sprintf " t % d : vector " x
type operation = [ ` DIVISION of flt_temp * flt_temp ` | DOT_PRODUCT of vec_temp * vec_temp ]
let e2 : operation -> any_temp list = function | ` DIVISION ( DIVISIONa , b ) b -> [ ( a :> any_temp ) any_temp ; ( b :> any_temp ) any_temp ] | ` DOT_PRODUCT ( DOT_PRODUCTa , b ) b -> [ ( a :> any_temp ) any_temp ; ( b :> any_temp ) any_temp ]
type gen_operation = [ ` DIVISION of any_temp * any_temp ` | DOT_PRODUCT of any_temp * any_temp ]
let e3 ( x : operation ) operation = match ( x : operation :> gen_operation ) gen_operation with | ` DOT_PRODUCT ( DOT_PRODUCTa , b ) b | ` DIVISION ( DIVISIONa , b ) b -> [ a ; b ] b
module Records_we_can_handle = struct type ( ' a , ' b ) t = { not_first_class_tick_a : ' a ; b : ' a . ' b ; int : ' a . int ; either : ' a . ' a option ; polymorphic_variant : ' a . [ ` A of ' a | ` B of ' b | ` Int of int ] } [ @@ deriving_inline sexp_grammar ] let _ = fun ( _ : ( ' a , ' b ) t ) -> ( ) let ( t_sexp...
module Impossible_record = struct type t = { a : ' a . ' a } [ @@ deriving_inline sexp_grammar ] let _ = fun ( _ : t ) -> ( ) let ( t_sexp_grammar : Ppx_sexp_conv_lib . Sexp . Private . Raw_grammar . t ) = let ( _the_generic_group : Ppx_sexp_conv_lib . Sexp . Private . Raw_grammar . generic_group ) = { implicit_vars = ...
module Inline_record = struct type ' a t = | Non_poly of { a : ' a } | Poly of { a : ' a . ' a } [ @@ deriving_inline sexp_grammar ] let _ = fun ( _ : ' a t ) -> ( ) let ( t_sexp_grammar : Ppx_sexp_conv_lib . Sexp . Private . Raw_grammar . t ) = let ( _the_generic_group : Ppx_sexp_conv_lib . Sexp . Private . Raw_gramma...
module Nullary = struct type ' a t = [ ` A | ` B ] [ @@ deriving_inline sexp_grammar ] let _ = fun ( _ : ' a t ) -> ( ) let ( t_sexp_grammar : Ppx_sexp_conv_lib . Sexp . Private . Raw_grammar . t ) = let ( _the_generic_group : Ppx_sexp_conv_lib . Sexp . Private . Raw_grammar . generic_group ) = { implicit_vars = [ ] ; ...
module With_arguments = struct module With_sexp = struct type t = [ ` A of int * int | ` B of string ] [ @@ deriving sexp_of ] end type t = [ ` A of int * int | ` B of string ] [ @@ deriving_inline sexp_grammar ] let _ = fun ( _ : t ) -> ( ) let ( t_sexp_grammar : Ppx_sexp_conv_lib . Sexp . Private . Raw_grammar . t ) ...
module Sexp_list = struct module With_sexp = struct type t = [ ` Int of int | ` List of int list | ` Sexp_dot_list of int list [ @ sexp . list ] | ` Sexp_list of int sexp_list [ @ warning " - 3 " ] ] [ @@ deriving sexp ] end type t = [ ` Int of int | ` List of int list | ` Sexp_dot_list of int list [ @ sexp . list ] | ...
type ' a t = ' a Array_wrap . t
let write__1 write__a = ( Atdgen_runtime . Oj_run . write_list ( write__a ) )
let string_of__1 write__a ( ? len = 1024 ) x = let ob = Bi_outbuf . create len in write__1 write__a ob x ; Bi_outbuf . contents ob
let read__1 read__a = ( Atdgen_runtime . Oj_run . read_list ( read__a ) )
let _1_of_string read__a s = read__1 read__a ( Yojson . Safe . init_lexer ( ) ) ( Lexing . from_string s )
let write__2 write__a = ( fun ob x -> ( let x = ( Array_wrap . unwrap ) x in ( write__1 write__a ) ob x ) )
let string_of__2 write__a ( ? len = 1024 ) x = let ob = Bi_outbuf . create len in write__2 write__a ob x ; Bi_outbuf . contents ob
let read__2 read__a = ( fun p lb -> let x = ( read__1 read__a ) p lb in ( Array_wrap . wrap ) x )
let _2_of_string read__a s = read__2 read__a ( Yojson . Safe . init_lexer ( ) ) ( Lexing . from_string s )
let write_t write__a = ( write__2 write__a )
let string_of_t write__a ( ? len = 1024 ) x = let ob = Bi_outbuf . create len in write_t write__a ob x ; Bi_outbuf . contents ob
let read_t read__a = ( read__2 read__a )
let t_of_string read__a s = read_t read__a ( Yojson . Safe . init_lexer ( ) ) ( Lexing . from_string s )
( module struct module Hashtbl = Pooled_hashtbl . Make ( struct include Int let hash x = x end ) let % test_unit " growing test / copy test " = let n = 100_000 in let tbl = Hashtbl . create ~ size : 16 ( ) in for i = 0 to n - 1 do Hashtbl . set tbl ~ key : i ~ data : i done ; let first_n = ref 0 in for _ = 1 to 2 do le...
module Resource = struct let ht = Hashtbl . create 17 let c = ref 0 let create ( ) = if Random . int 4 = 0 then Lwt . return_error ( ) else begin c := succ ! c ; Hashtbl . add ht ! c ( ) ; Lwt . return_ok ! c end let free i = assert ( Hashtbl . mem ht i ) ; Hashtbl . remove ht i ; Lwt . return_unit end
let test_n n = let max_idle_size = Random . int 11 in let max_size = max 1 ( max_idle_size + Random . int 5 ) in let pool = Pool . create ~ max_idle_size ~ max_size Resource . create Resource . free in let wakers = Array . make n None in let wait_count = ref 0 in let wait_count_cond = Lwt_condition . create ( ) in let ...
let test _ ( ) = test_n 0 >>= fun ( ) -> test_n 1 >>= fun ( ) -> let rec loop n_it = if n_it = 0 then Lwt . return_unit else test_n ( Random . int ( 1 lsl Random . int 12 ) ) >>= fun ( ) -> loop ( n_it - 1 ) in loop 500
let test_cases = [ Alcotest_lwt . V1 . test_case " basic usage " ` Quick test ; ]
let test ~ op ~ op_name ~ to_string x = printf " % s % s = % d \ n " op_name ( to_string x ) ( op x ) let open Int64 in let numbers = [ 0L ; 1L ; 7L ; max_value ; min_value ; - 1L ] in let f = test ~ op : Ocaml_intrinsics . Int64 . count_set_bits ~ op_name " : popcnt " ~ to_string : Hex . to_string_hum in List . iter ~...
let test_int n bits = [ % test_result : int ] ( Int . popcount n ) ~ expect : bits
let test_int32 n bits = [ % test_result : int ] ( Int32 . popcount n ) ~ expect : bits
let test_int64 n bits = [ % test_result : int ] ( Int64 . popcount n ) ~ expect : bits
let test_nativeint n bits = [ % test_result : int ] ( Nativeint . popcount n ) ~ expect : bits for i = 0 to Int . num_bits - 1 do let n = 1 lsl i in test_int n 1 ; test_int ( lnot n ) ( Int . num_bits - 1 ) done ; ; for i = 0 to 31 do let n = Int32 . shift_left 1l i in test_int32 n 1 ; test_int32 ( Int32 . bit_not n ) ...
let does_not_allocate f = let test ( ) = let len = 100 in let inputs = ArrayLabels . init len ~ f ( : fun _ -> Random . bits ( ) ) in let minor_before = Gc . minor_words ( ) in for i = 0 to len - 1 do ignore ( f inputs . ( i ) : int ) done ; let minor_after = Gc . minor_words ( ) in [ % test_result : int ] ( minor_afte...
let cases = [ " " ; " . " ; " 1 . " ; " 12 . " ; " 123 . " ; " 1234 . " ; " 12345 . " ; " 123456 . " ; " . \ n " ; " \ n . " ; " \ n \ n \ n " ; " . . . xxxxx \ nxxxx . xxx . xxx \ n " ; " . . . . . " ; " " : ; " . . . . " : ; Printf . sprintf " %* s . " 40 " " ; Printf . sprintf " %* s . " 300 " " ; String . concat ( ...
let build_positions s = let builder = Positions . Builder . create ( ) in for i = 0 to String . length s - 1 do match s . [ i ] with | ' \ n ' -> Positions . Builder . add_newline builder ~ offset : i | ' . ' -> Positions . Builder . add builder ~ offset : i | ' ' : -> Positions . Builder . add_twice builder ~ offset :...
let build_positions_simple s = let rec loop i ( pos : Positions . pos ) = if i = String . length s then [ ] else ( let offset = pos . offset + 1 in match s . [ i ] with | ' \ n ' -> loop ( i + 1 ) { line = pos . line + 1 ; col = 0 ; offset } | ' . ' -> pos :: loop ( i + 1 ) { pos with offset ; col = pos . col + 1 } | '...
let check_all_subsexps_map_to_their_position s sexps positions = let check_subsexp subsexp = match Positions . find_sub_sexp_in_list_phys positions sexps ~ sub : subsexp with | None -> failwith " not found " | Some range -> assert ( Sexp . ( = ) ( Single . parse_string_exn ( String . sub s ~ pos : range . start_pos . o...
let cases_for_find_sub_sexp = [ " ( ( ( abc ) ( + 1 2 ) ) ) " ]
module Annotated = struct type t = | Atom of Positions . range * Sexp . t | List of Positions . range * Sexp . t * t list let of_sexp_and_positions = let rec loop ( sexp : Sexp . t ) ( positions : Positions . pos list ) = match sexp , positions with | Atom _ , start_pos :: last_pos :: rest -> Atom ( Positions . make_ra...
module Req = struct include Caqti_type . Std include Caqti_request . Infix end
let bad_select_req = Req . ( unit -->! unit @:- " SELECT not_defined " )
let test_error ( module C : Caqti_blocking . CONNECTION ) = ( match C . find bad_select_req ( ) with | Ok ( ) -> Alcotest . fail " unexpected ok from bad_select " | Error ( ` Request_failed { msg = Caqti_driver_postgresql . Result_error_msg { sqlstate ; _ } ; _ } ) -> assert ( sqlstate = " 42703 " ) | Error err -> Alco...
let test_cases_on_connection = [ " test_error " , ` Quick , test_error ; ]
let mk_test ( name , pool ) = let pass_conn ( name , speed , f ) = let f ' ( ) = Caqti_blocking . Pool . use ( fun c -> Ok ( f c ) ) pool |> function | Ok ( ) -> ( ) | Error err -> Alcotest . failf " % a " Caqti_error . pp err in ( name , speed , f ' ) in let test_cases = List . map pass_conn test_cases_on_connection i...
let mk_tests { uris ; tweaks_version } = let connect_pool uri = ( match Caqti_blocking . connect_pool uri ~ max_size : 1 ? tweaks_version with | Ok pool -> ( test_name_of_uri uri , pool ) | Error err -> raise ( Caqti_error . Exn err ) ) in let is_postgresql uri = Uri . scheme uri = Some " postgresql " in let pools = Li...
let ( ) = Alcotest_cli . run_with_args_dependency " test_postgresql " common_args mk_tests
let init_dbh dbh = let ( ) = [ % pgsql dbh " execute " " create temporary table employees ( userid serial primary key , name text not null , salary int not null , email text ) ] " in let ( ) = [ % pgsql dbh " execute " " DO $$ BEGIN CREATE DOMAIN cash_money AS float ; EXCEPTION WHEN duplicate_object THEN null ; END ] "...
module Userid : sig type t val to_string : t -> string val from_string : string -> t val to_int : t -> int type t = int let to_string = string_of_int let from_string = int_of_string let to_int x = x end
let employee_exists dbh ? email n = [ % pgsql dbh " SELECT EXISTS ( SELECT 1 FROM employees WHERE name = $ n AND email = $? email ) email ] "
let ( ) = let dbh = PGOCaml . connect ( ) in init_dbh dbh ; let insert name pay email = [ % pgsql dbh " insert into employees ( name , salary , email ) email values ( $ name , $ pay , $? email ) email ] " in insert " Ann " 10_000_l None ; insert " Bob " 45_000_l None ; insert " Jim " 20_000_l None ; insert " Mary " 30_...
module Unit = struct type t = unit [ @@ deriving compare , sexp_of ] end
module type T = sig type t [ @@ deriving compare , sexp_of ] end
let test ( type a ) ( module T : T with type t = a ) ordered = List . iteri ordered ~ f ( : fun i ti -> List . iteri ordered ~ f ( : fun j tj -> require [ % here ] ( Ordering . equal ( Ordering . of_int ( T . compare ti tj ) ) ( Ordering . of_int ( Int . compare i j ) ) ) ~ if_false_then_print_s ( : lazy [ % message " ...
module type Min_zero_max = sig include T val min_value : t val max_value : t val zero : t end
let test_min_zero_max ( type a ) ( module T : Min_zero_max with type t = a ) = test ( module T ) [ T . min_value ; T . zero ; T . max_value ] ; ; test_min_zero_max ( module Float ) ; test_min_zero_max ( module Int ) ; test_min_zero_max ( module Int32 ) ; test_min_zero_max ( module Int64 ) ; test_min_zero_max ( module N...
module type Sequence = sig type ' a t [ @@ deriving compare , sexp_of ] val of_list : ' a list -> ' a t end
let test_sequence ( module T : Sequence ) ordered = test ( module struct type t = int T . t [ @@ deriving compare , sexp_of ] end ) ( ordered |> List . map ~ f : T . of_list ) ; ; test_sequence ( module Array ) [ [ ] ; [ 1 ] ; [ 2 ] ; [ 1 ; 2 ] ; [ 2 ; 1 ] ] ; test_sequence ( module List ) [ [ ] ; [ 1 ] ; [ 1 ; 2 ] ; [...
let cmd_test_case ~ term ~ argv ~ expected ~ pprinter what = let info = Cmdliner . Term . info " cmd " in Alcotest . ( check ( of_pp pprinter ) ) what expected ( match Cmdliner . Term . eval ~ argv ( term , info ) with | ` Error msg -> assert false | ` Ok actual -> actual | ` Version -> assert false | ` Help -> assert ...
type common_types = { a1 : string ; b1 : int ; c1 : float ; d1 : string option ; e1 : string list ; f1 : int array ; g1 : int list ; h1 : bool ; i1 : bytes ; j1 : string list option ; k1 : int list option }
let simple ( ) = let argv = [ | " cmd " ; " -- a1 " ; " apple " ; " -- b1 " ; " 123 " ; " -- c1 " ; " 1 . 20 " ; " -- d1 " ; " yes " ; " -- e1 " ; " apple , banana , pear " ; " -- f1 " ; " 1 , 2 , 3 , 4 , 5 " ; " -- g1 " ; " 100 , 200 , 300 " ; " -- h1 " ; " -- i1 " ; " testing " ; " -- k1 " ; " 1 , 2 , 3 , 4 , 5 " ] |...
type default_types = { a1 : string [ @ default " apple " ] ; b1 : int [ @ default 10 ] ; c1 : float [ @ default 1 . 20 ] ; e1 : string list [ @ default [ ] ] ; f1 : int array [ @ default [ | 1 ; 2 ; 3 ] ] | ; g1 : int list [ @ default [ 1 ; 2 ; 3 ] ] ; h1 : bool [ @ default true ] }
let defaults ( ) = let argv = [ " | cmd " ] | in let expected = { a1 = " apple " ; b1 = 10 ; c1 = 1 . 20 ; e1 = [ ] ; f1 = [ | 1 ; 2 ; 3 ] | ; g1 = [ 1 ; 2 ; 3 ] ; h1 = true } in cmd_test_case " expected defaults to work " ~ term ( : default_types_cmdliner_term ( ) ) ~ argv ~ expected ~ pprinter : pp_default_types
type env_types = { a1 : string [ @ env " A_ONE_ENV " ] } [ @@ deriving cmdliner , show ]
let env ( ) = let argv = [ " | cmd " ] | in let expected = { a1 = " foobar " } in Unix . putenv " A_ONE_ENV " " foobar " ; cmd_test_case " expected env variables to work " ~ term ( : env_types_cmdliner_term ( ) ) ~ argv ~ expected ~ pprinter : pp_env_types
type list_sep_types = { a1 : int list [ @ sep ' ' ] ; @ b1 : string array [ @ sep ' ' ] } *
let list_sep ( ) = let argv = [ " | cmd " ; " -- a1 " ; " 1 @ 9 @ 3 @ 5 " ; " -- b1 " ; " foo * bar * baz " ] | in let expected = { a1 = [ 1 ; 9 ; 3 ; 5 ] ; b1 = [ " | foo " ; " bar " ; " baz " ] } | in cmd_test_case " expected custom list sep to work " ~ term ( : list_sep_types_cmdliner_term ( ) ) ~ argv ~ expected ~ ...
type pos_types = { a1 : string [ @ pos 1 ] ; b1 : int [ @ pos 0 ] }
let positional ( ) = let argv = [ " | cmd " ; " 1 " ; " second - pos " ] | in let expected = { a1 = " second - pos " ; b1 = 1 } in cmd_test_case " expected positional args to work " ~ term ( : pos_types_cmdliner_term ( ) ) ~ argv ~ expected ~ pprinter : pp_pos_types
type enum_types = { a1 : int list [ @ enum [ ( " one " , 1 ) ; ( " two " , 2 ) ; ( " three " , 3 ) ; ( " four " , 4 ) ] ] ; b1 : [ ` A | ` B | ` C ] [ @ enum [ ( " a " , ` A ) ; ( " b " , ` B ) ; ( " c " , ` C ) ] ] }
let enums ( ) = let argv = [ " | cmd " ; " -- a1 " ; " one , two " ; " -- b1 " ; " b " ] | in let expected = { a1 = [ 1 ; 2 ] ; b1 = ` B } in cmd_test_case " expected enum args to work " ~ term ( : enum_types_cmdliner_term ( ) ) ~ argv ~ expected ~ pprinter : pp_enum_types
module M = struct type t = int * int [ @@ deriving show ] let fst ( f , _ ) = f let snd ( _ , s ) = s let of_string s = try let sepi = String . index s ' ' | in let fst = String . sub s 0 sepi in let snd = String . sub s ( sepi + 1 ) ( String . length s - sepi - 1 ) in Result . Ok ( int_of_string fst , int_of_string sn...
type custom_types = { foo : M . t [ @ conv M . cmdliner_converter ] ; bar : M . t }
let customs ( ) = let argv = [ " | cmd " ; " -- foo " ; " 11 | 200 " ; " -- bar " ; " 0 | 13 " ] | in let expected = { foo = ( 11 , 200 ) ; bar = ( 0 , 13 ) } in cmd_test_case " expected custom type converter to work " ~ term ( : custom_types_cmdliner_term ( ) ) ~ argv ~ expected ~ pprinter : pp_custom_types
type opt_all_types = { foo : string list [ @ opt_all ] } [ @@ deriving cmdliner , show ]
let opt_all ( ) = let argv = [ " | cmd " ; " -- foo " ; " test " ; " -- foo " ; " foo " ] | in let expected = { foo = [ " test " ; " foo " ] } in cmd_test_case " expected opt_all list to work " ~ term ( : opt_all_types_cmdliner_term ( ) ) ~ argv ~ expected ~ pprinter : pp_opt_all_types
type foo = { a1 : string ; b1 : string } [ @@ deriving cmdliner , show ]
type terms_types = { foo : foo [ @ term foo_cmdliner_term ( ) ] }
let terms ( ) = let argv = [ " | cmd " ; " -- a1 " ; " apple " ; " -- b1 " ; " pie " ] | in let expected = { foo = { a1 = " apple " ; b1 = " pie " } } in cmd_test_case " expected custom @ term to work " ~ term ( : terms_types_cmdliner_term ( ) ) ~ argv ~ expected ~ pprinter : pp_terms_types
type misc_types = { a1 : string [ @ name " renamed " ] ; b1 : bool [ @ enum [ ( " true " , true ) ; ( " false " , false ) ] ] ; c1 : bool [ @ enum [ ( " true " , true ) ; ( " false " , false ) ] ] [ @ default true ] ; d1 : bool [ @ enum [ ( " true " , true ) ; ( " false " , false ) ] ] [ @ default true ] ; e1 : string ...
let miscs ( ) = let argv = [ | " cmd " ; " -- renamed " ; " test " ; " -- b1 " ; " true " ; " -- d1 " ; " false " ; " -- e1 " ; " a , b " ; " -- f1 " ; " a , b , 1 " ; " -- g1 " ; " 1 . 1 , bar , 100 , c " ] | in let expected = { a1 = " test " ; b1 = true ; c1 = true ; d1 = false ; e1 = ( " a " , " b " ) ; f1 = ( " a "...
let test_set = [ ( " simple types " , ` Quick , simple ) ; ( " default types " , ` Quick , defaults ) ; ( " ENV types " , ` Quick , env ) ; ( " list sep types " , ` Quick , list_sep ) ; ( " positional types " , ` Quick , positional ) ; ( " enum types " , ` Quick , enums ) ; ( " custom types " , ` Quick , customs ) ; ( ...
let ( ) = Alcotest . run " Ppx_deriving_cmdliner " [ ( " " , **** test_set ) ]
module Helpers = struct module type S = sig type t val quickcheck_generator : t Generator . t val quickcheck_observer : t Observer . t val quickcheck_shrinker : t Shrinker . t end let test ( type a ) ? config ? cr ? generator ? observer ? shrinker q m = let ( module Q : S with type t = a ) = q in test_generator ? confi...
module Nonrec_reference = Nonrec_reference test ~ shrinker ` : atomic ( module Simple_reference ) m_bool ; [ % expect { | ( generator exhaustive ) ( observer transparent ) ( shrinker atomic ) } ] ; | test ~ shrinker ` : atomic ( module Dotted_reference ) m_bool ; [ % expect { | ( generator exhaustive ) ( observer trans...
module Application_of_polymorphic_type = Application_of_polymorphic_type test ( module Application_of_polymorphic_type ) ( m_option m_bool ) ; [ % expect { | ( generator exhaustive ) ( observer transparent ) ( shrinker ( ( ( false ) => ( ) ) ( ( true ) => ( ) ) ) ) } ] | ; ;
module Tuple = Tuple test ( module Tuple ) ( m_pair m_bool ( m_option m_unit ) ) ; [ % expect { | ( generator exhaustive ) ( observer transparent ) ( shrinker ( ( ( false ( ( ) ) ) => ( false ( ) ) ) ( ( true ( ( ) ) ) => ( true ( ) ) ) ) ) } ] | ; ;
module Inherit_poly_variant = Inherit_poly_variant let module Poly_variant ' = struct type t = [ ` A | ` B | ` C of bool | ` D of bool | ` E of bool * unit option | ` F of bool * unit option ] [ @@ deriving compare , enumerate , sexp_of ] end in test ( module Poly_variant ) ( m_all ( module Poly_variant ' ) ) ; [ % exp...
module Record_type = Record_type let module Record_type ' = struct type t = Record_type . t = { x : bool ; y : unit option } [ @@ deriving compare , enumerate , sexp_of ] end in test ( module Record_type ) ( m_all ( module Record_type ' ) ) ; [ % expect { | ( generator exhaustive ) ( observer transparent ) ( shrinker (...
module Binary_and_record_variant = Binary_and_record_variant let module Nullary_and_unary_variant ' = struct type t = Nullary_and_unary_variant . t = | A | B | C of unit | D of unit [ @@ deriving compare , enumerate , sexp_of ] end in test ~ shrinker ` : atomic ( module Nullary_and_unary_variant ) ( m_all ( module Null...
module Curried_arrow = Curried_arrow let config = { Test . default_config with test_count = 1_000 } in let test ? cr ( ? config = config ) m = test ? cr ~ config ~ shrinker ` : atomic m in test ( module Simple_arrow ) ( m_arrow ( m_option m_unit ) m_bool ) ; [ % expect { | ( generator exhaustive ) ( observer transparen...
module Optional_higher_order = Optional_higher_order let config = { Test . default_config with test_count = 100 } in let test m = test ~ config ~ shrinker ` : atomic m in test ( module Simple_higher_order ) ( m_arrow ( m_arrow ( m_option m_unit ) ( m_option m_bool ) ) m_bool ) ; [ % expect { | ( generator " generated 5...
module Instance_with_phantom = Instance_with_phantom test ( module Instance_of_unary ) ( m_list m_bool ) ; [ % expect { | ( generator " generated 2_248 distinct values in 10_000 iterations " ) ( observer transparent ) ( shrinker ( ( ( false ) => ( ) ) ( ( true ) => ( ) ) ( ( false true ) => ( true ) ) ( ( false true ) ...
module Recursive = Recursive let module Recursive ' = struct type t = Recursive . t = | Leaf | Node of t * t [ @@ deriving compare , hash , sexp_of ] let rec create = function | 0 -> Leaf | n -> let t = create ( n - 1 ) in Node ( t , t ) ; ; let examples = List . init 3 ~ f : create end in test ~ shrinker ` : atomic ( ...