text
stringlengths
0
601k
let rec reference_compare_comparable : type a . a comparable_ty -> a -> a -> int = fun ty x y -> match ( ty , x , y ) with | ( Unit_key , ( ) , ( ) ) -> 0 | ( Never_key , _ , _ ) -> . | ( Signature_key , x , y ) -> normalize_compare @@ Script_signature . compare x y | ( String_key , x , y ) -> normalize_compare @@ Scri...
type ex_comparable_data = | Ex_comparable_data : ' a comparable_ty * ' a -> ex_comparable_data
type ex_comparable_data_2 = | Ex_comparable_data_2 : ' a comparable_ty * ' a * ' a -> ex_comparable_data_2
type ex_comparable_data_3 = | Ex_comparable_data_3 : ' a comparable_ty * ' a * ' a * ' a -> ex_comparable_data_3
module Parameters = struct let atom_size_range : Tezos_benchmark . Base_samplers . range = { min = 0 ; max = 10 } let other_size : Tezos_benchmark . Base_samplers . range = { min = 0 ; max = 100 } let parameters : Michelson_samplers . parameters = { base_parameters = { int_size = atom_size_range ; string_size = atom_si...
module Crypto_samplers = let size = 1000 let algo = ` Default end )
module Samplers : Michelson_samplers . S = Michelson_samplers . Make ( Parameters ) ( Crypto_samplers )
let ex_comparable_data_sampler : ex_comparable_data Tezos_benchmark . Base_samplers . sampler = fun random_state -> let size = Tezos_benchmark . Base_samplers . sample_in_interval ~ range { : min = 1 ; max = 20 } random_state in let ( Ex_comparable_ty ty ) = Samplers . Random_type . m_comparable_type ~ size random_stat...
let ex_comparable_data_2_sampler : ex_comparable_data_2 Tezos_benchmark . Base_samplers . sampler = fun random_state -> let size = Tezos_benchmark . Base_samplers . sample_in_interval ~ range { : min = 1 ; max = 20 } random_state in let ( Ex_comparable_ty ty ) = Samplers . Random_type . m_comparable_type ~ size random_...
let ex_comparable_data_3_sampler : ex_comparable_data_3 Tezos_benchmark . Base_samplers . sampler = fun random_state -> let size = Tezos_benchmark . Base_samplers . sample_in_interval ~ range { : min = 1 ; max = 20 } random_state in let ( Ex_comparable_ty ty ) = Samplers . Random_type . m_comparable_type ~ size random_...
let comparable_data_generator : ex_comparable_data QCheck . Gen . t = ex_comparable_data_sampler
let comparable_data_2_generator : ex_comparable_data_2 QCheck . Gen . t = ex_comparable_data_2_sampler
let comparable_data_3_generator : ex_comparable_data_3 QCheck . Gen . t = ex_comparable_data_3_sampler
let comparable_data_arbitrary : ex_comparable_data QCheck . arbitrary = QCheck . make comparable_data_generator
let comparable_data_2_arbitrary : ex_comparable_data_2 QCheck . arbitrary = QCheck . make comparable_data_2_generator
let comparable_data_3_arbitrary : ex_comparable_data_3 QCheck . arbitrary = QCheck . make comparable_data_3_generator
let assert_ok = function Ok x -> x | Error _ -> assert false
let assert_return x = assert_ok ( Lwt_main . run x )
let ctxt = assert_return ( Context . init 3 >>=? fun ( b , _cs ) -> Incremental . begin_construction b >>=? fun v -> return ( Incremental . alpha_ctxt v ) )
let unparse_comparable_ty ty = Micheline . strip_locations ( fst ( assert_ok Script_ir_translator . ( unparse_ty ~ loc ( ) : ctxt ( ty_of_comparable_ty ty ) ) ) )
let unparse_comparable_data ty x = Micheline . strip_locations ( fst ( assert_return Script_ir_translator . ( unparse_data ctxt Readable ( ty_of_comparable_ty ty ) x ) ) )
let pack_comparable_data ty x = fst ( assert_return Script_ir_translator . ( pack_data ctxt ( ty_of_comparable_ty ty ) x ) )
let unpack_comparable_data ty bytes = let ty = Script_ir_translator . ty_of_comparable_ty ty in fst ( assert_return ( Script_interpreter_defs . unpack ctxt ~ ty ~ bytes ) )
let pp_comparable_ty fmt ty = Michelson_v1_printer . print_expr fmt ( unparse_comparable_ty ty )
let pp_comparable_data ty fmt x = Michelson_v1_printer . print_expr fmt ( unparse_comparable_data ty x )
let pp ty x y pp_c fmt c = Format . fprintf fmt " Compare ( ty =% a , % a , % a ) = % a " pp_comparable_ty ty ( pp_comparable_data ty ) x ( pp_comparable_data ty ) y pp_c c
let compare_through_pack ty x y = Bytes . compare ( pack_comparable_data ty x ) ( pack_comparable_data ty y ) = 0
let qcheck_compare_comparable ~ expected ty x y = qcheck_eq ~ pp ( : pp ty x y Format . pp_print_int ) expected ( Script_comparable . compare_comparable ty x y )
let qcheck_compare_comparable_eq ~ expected ty x y = qcheck_eq ~ pp ( : pp ty x y Format . pp_print_bool ) expected ( Script_comparable . compare_comparable ty x y = 0 )
let test_compatible_with_reference = QCheck . Test . make ~ name " : compatible_with_reference " comparable_data_2_arbitrary ( fun ( Ex_comparable_data_2 ( ty , x , y ) ) -> qcheck_compare_comparable ~ expected ( : reference_compare_comparable ty x y ) ty x y )
let test_compatible_with_packing = QCheck . Test . make ~ name " : compatible_with_packing " comparable_data_2_arbitrary ( fun ( Ex_comparable_data_2 ( ty , x , y ) ) -> qcheck_compare_comparable_eq ~ expected ( : compare_through_pack ty x y ) ty x y )
let test_reflexivity = QCheck . Test . make ~ name " : reflexivity " comparable_data_arbitrary ( fun ( Ex_comparable_data ( ty , x ) ) -> qcheck_compare_comparable ~ expected : 0 ty x x )
let test_symmetry = QCheck . Test . make ~ name " : symmetry " comparable_data_2_arbitrary ( fun ( Ex_comparable_data_2 ( ty , x , y ) ) -> qcheck_compare_comparable ~ expected ( :- Script_comparable . compare_comparable ty x y ) ty y x )
let test_transitivity = QCheck . Test . make ~ name " : transitivity " comparable_data_3_arbitrary ( fun ( Ex_comparable_data_3 ( ty , x , y , z ) ) -> let cxy = Script_comparable . compare_comparable ty x y in let cyz = Script_comparable . compare_comparable ty y z in match ( cxy , cyz ) with | ( 0 , n ) | ( n , 0 ) -...
let test_pack_unpack = QCheck . Test . make ~ count : 100_000 ~ name " : pack_unpack " comparable_data_arbitrary ( fun ( Ex_comparable_data ( ty , x ) ) -> let oty = match option_key ( - 1 ) ty with Ok ty -> ty | Error _ -> assert false in qcheck_eq ~ cmp ( : Script_comparable . compare_comparable oty ) ~ pp ( : pp_com...
let ( ) = Alcotest . run " Script_comparison " [ ( " compatible_with_reference " , qcheck_wrap [ test_compatible_with_reference ] ) ; ( " compatible_with_packing " , qcheck_wrap [ test_compatible_with_packing ] ) ; ( " reflexivity " , qcheck_wrap [ test_reflexivity ] ) ; ( " symmetry " , qcheck_wrap [ test_symmetry ] )...
let err x = Exn ( Script_typed_ir_test_error x )
let wrap e = Lwt . return ( Environment . wrap_tzresult e )
let iter_n_es n f = let rec aux k = if k = n then return ( ) else f k >>=? fun ( ) -> aux ( k + 1 ) in aux 0
module Samplers = struct let size = { Tezos_benchmark . Base_samplers . min = 4 ; max = 32 } module Crypto_samplers = Tezos_benchmark . Crypto_samplers . Make_finite_key_pool ( struct let size = 10 let algo = ` Default end ) include Michelson_samplers . Make ( struct let parameters : Michelson_samplers . parameters = {...
module Printers = struct let string_of_something f = Lwt_main . run ( let accounts = Account . generate_accounts 1 in Block . alpha_context accounts >>=? fun ctxt -> f ctxt >>= wrap >>=? fun node -> let printable = Micheline_printer . printable Protocol . Michelson_v1_primitives . string_of_prim node in let b = Buffer ...
module Tests = struct let footprint v = 8 * Obj . ( reachable_words ( repr v ) ) let stats = Stdlib . Hashtbl . create 13 let remember what vsize rsize = Stdlib . Hashtbl . add stats what ( vsize , rsize ) let check_good_approximation kind ratio what vsize x = let rsize = footprint x in let vsize = Saturation_repr . to...
let tests = let open Tztest in Tests . [ tztest " lambda size is a good approximation ( fast ) " ` Quick ( fun ( ) -> lambda_size 50 ) ; tztest " ty size is a good approximation ( fast ) " ` Quick ( fun ( ) -> ty_size 50 ) ; tztest " value size is a good approximation ( fast ) " ` Quick ( fun ( ) -> value_size 50 ) ; t...
let err x = Exn ( Sc_rollup_test_error x )
let test_disable_feature_flag ( ) = Context . init 1 >>=? fun ( b , contracts ) -> let contract = WithExceptions . Option . get ~ loc : __LOC__ @@ List . nth contracts 0 in Incremental . begin_construction b >>=? fun i -> let kind = Sc_rollup . Kind . Example_arith in let boot_sector = Sc_rollup . PVM . boot_sector_of_...
let test_sc_rollups_all_well_defined ( ) = let all_contains_all_constructors ( ) = let tickets = ref [ " Example_arith " ] in let burn x = tickets := List . filter ( ( <> ) x ) ! tickets in let pick = function | Sc_rollup . Kind . Example_arith -> burn " Example_arith " in List . iter pick Sc_rollups . all ; if ! ticke...
let tests = [ Tztest . tztest " check effect of disabled feature flag " ` Quick test_disable_feature_flag ; Tztest . tztest " check that all rollup kinds are correctly enumerated " ` Quick test_sc_rollups_all_well_defined ; ]
let add_byte b = Bytes . concat ( Bytes . of_string ) " " [ b ; Bytes . of_string " \ x00 ] "
let test_equal_keys ctxt = let sk = Bytes . of_string ( String . make ( Secret_box . key_size ) key_size ' A ' ) ' A ' in let sk ' = Bytes . of_string ( " B " ^ ( String . make ( Secret_box . key_size - 1 ) 1 ' A ' ) ' A ' ) ' A ' in let sk ' ' = Bytes . of_string ( ( String . make ( Secret_box . key_size - 1 ) 1 ' A '...
let test_permute ctxt = let k = Secret_box . random_key ( ) in assert_raises ( Size_mismatch " Secret_box . to_key ) " ( fun ( ) -> ( Secret_box . Bytes . to_key ( add_byte ( Secret_box . Bytes . of_key k ) k ) k ) k ) k
let test_nonce_operations ctxt = let n = Bytes . of_string ( String . make Secret_box . nonce_size ' \ x00 ' ) x00 ' in let n ' = Bytes . of_string ( ( String . make ( Secret_box . nonce_size - 1 ) 1 ' \ x00 ' ) x00 ' ^ " \ x01 ) " in let n ' ' = Bytes . of_string ( ( String . make ( Secret_box . nonce_size - 1 ) 1 ' \...
let setup ( ) = Secret_box . random_key ( ) , Bytes . of_string " wild wild fox " , Secret_box . random_nonce ( )
let test_secret_box ctxt = let k , msg , nonce = setup ( ) in let cmsg = Secret_box . Bytes . secret_box k msg nonce in let msg ' = Secret_box . Bytes . secret_box_open k cmsg nonce in assert_equal msg msg '
let test_secret_box_fail_permute ctxt = let k , msg , nonce = setup ( ) in let cmsg = Secret_box . Bytes . secret_box k msg nonce in Bytes . set cmsg 10 ' a ' ; assert_raises Verification_failure ( fun ( ) -> ignore ( Secret_box . Bytes . secret_box_open k cmsg nonce ) nonce ) nonce
let test_secret_box_fail_key ctxt = let k , msg , nonce = setup ( ) in let k ' = Secret_box . random_key ( ) in let cmsg = Secret_box . Bytes . secret_box k msg nonce in assert_raises Verification_failure ( fun ( ) -> ignore ( Secret_box . Bytes . secret_box_open k ' cmsg nonce ) nonce ) nonce
let suite = " Secret_box " >::: [ " test_equal_keys " >:: test_equal_keys ; " test_nonce_operations " >:: test_nonce_operations ; " test_permute " >:: test_permute ; " test_secret_box " >:: test_secret_box ; " test_secret_box_fail_permute " >:: test_secret_box_fail_permute ; " test_secret_box_fail_key " >:: test_secret...
let test_no_commitment ( ) = Context . init ~ consensus_threshold : 0 5 >>=? fun ( b , _ ) -> Context . get_constants ( B b ) >>=? fun { parametric = { blocks_per_commitment ; _ } ; _ } -> let blocks_per_commitment = Int32 . to_int blocks_per_commitment in Block . bake_n ( blocks_per_commitment - 2 ) b >>=? fun b -> Bl...
let test_revelation_early_wrong_right_twice ( ) = let open Assert in Context . init ~ consensus_threshold : 0 5 >>=? fun ( b , _ ) -> Context . get_constants ( B b ) >>=? fun csts -> let tip = csts . parametric . seed_nonce_revelation_tip in let blocks_per_commitment = Int32 . to_int csts . parametric . blocks_per_comm...
let test_revelation_missing_and_late ( ) = let open Context in let open Assert in Context . init ~ consensus_threshold : 0 5 >>=? fun ( b , _ ) -> get_constants ( B b ) >>=? fun csts -> let blocks_per_commitment = Int32 . to_int csts . parametric . blocks_per_commitment in Block . bake_n ( blocks_per_commitment - 2 ) b...
let wrap e = e >|= Environment . wrap_tzresult
let test_unrevealed ( ) = let open Alpha_context in let constants = { Default_parameters . constants_test with endorsing_reward_per_slot = Tez . one_mutez ; baking_reward_bonus_per_slot = Tez . zero ; baking_reward_fixed_portion = Tez . zero ; seed_nonce_revelation_tip = Tez . zero ; consensus_threshold = 0 ; minimal_p...
let tests = [ Tztest . tztest " no commitment " ` Quick test_no_commitment ; Tztest . tztest " revelation_early_wrong_right_twice " ` Quick test_revelation_early_wrong_right_twice ; Tztest . tztest " revelation_missing_and_late " ` Quick test_revelation_missing_and_late ; Tztest . tztest " test unrevealed " ` Quick tes...
let show_all ( ) = print_s [ % sexp ( Frame . window_list ( ) : Window . t list ) ]
let show ( ) = print_s [ % sexp ( get ( ) : Window . t ) ] show ( ) ; [ % expect { | " #< window 1 on * scratch " *> } ] ; | return ( ) ; ; Current_buffer . set_temporarily_to_temp_buffer Sync ( fun ( ) -> Blocking . switch_to_buffer ( Current_buffer . get ( ) ) ; show ( ) ) ; [ % expect { | " #< window 1 on * temp - b...
let window1 , window4 = match Frame . window_list ( ) with | [ x ; y ] -> x , y | [ w ] -> w , w | _ -> raise_s [ % message [ % here ] ] ; ; show ( ) ; [ % expect { | " #< window 1 on * scratch " *> } ] ; | set window4 ; show ( ) ; [ % expect { | " #< window 4 on * scratch " *> } ] ; | return ( ) ; ; show ( ) ; [ % exp...
let valids , invalids , sorted = let json = Yojson . Basic . from_file " fixtures . json " in let open Yojson . Basic . Util in let read_list key = json |> member key |> to_list |> List . map to_string in read_list " valid " , read_list " invalid " , read_list " compare "
let test_valids ( ) = let assert_iso v = match of_string v with | Some v ' -> assert_equal ( to_string v ' ) v ; assert_equal ( Format . asprintf " % a " Semver . pp v ' ) v | None -> assert_failure ( " valid version detected as invalid : " ^ v ) in List . iter assert_iso valids
let test_invalids ( ) = List . iter ( fun v -> assert_bool ( v ^ " is invalid " ) ( not ( is_valid v ) ) ) invalids
let test_compare ( ) = let rec of_string_list parsed raw = match raw with | [ ] -> parsed | hd :: tl -> match of_string hd with | Some v -> of_string_list ( v :: parsed ) tl | None -> of_string_list parsed tl in let list_printer lst = " \ n [ \ n " ^ ( lst |> List . map ( fun s -> " " ^ s ^ " ; \ n " ) |> String . conc...
let test_from_parts ( ) = let is_success = function | None -> false | Some _ -> true in assert_bool " negative version rejected " ( not ( is_success ( from_parts ( - 1 ) 0 2 [ ] [ ] ) ) ) ; assert_bool " invalid prerelease rejected " ( not ( is_success ( from_parts 1 0 0 [ " 03 " ] [ ] ) ) ) ; assert_bool " invalid bui...
let suite = " semver suite " >::: [ " test valids " >:: test_valids ; " test invalids " >:: test_invalids ; " test compare " >:: test_compare ; " test from_parts " >:: test_from_parts ]
let _ = run_test_tt_main suite
let romain_calascibetta = let open Mrmime in let open Mailbox in Local . [ w " romain " ; w " calascibetta " ] @ Domain . ( domain , [ a " gmail " ; a " com " ] )
let anil = let open Mrmime in let open Mailbox in Local . [ w " anil " ] @ Domain . ( domain , [ a " recoil " ; a " org " ] )
module Unix_scheduler = Colombe . Sigs . Make ( struct type ' a t = ' a end )
let unix = { Colombe . Sigs . bind = ( fun x f -> let open Unix_scheduler in f ( prj x ) ) ; return = ( fun x -> Unix_scheduler . inj x ) ; }
let put_crlf x = x ^ " \ r \ n "
let rdwr_from_flows inputs outputs = let inputs = ref ( List . map put_crlf inputs ) in let outputs = ref ( List . map put_crlf outputs ) in let read ( ) bytes off len = match ! inputs with | [ ] -> Unix_scheduler . inj ` End | x :: r -> let len = min ( String . length x ) len in Bytes . blit_string x 0 bytes off len ;...
let test_0 ( ) = Alcotest . test_case " usual without authentication " ` Quick @@ fun ( ) -> let ctx = Colombe . State . Context . make ( ) in let rdwr , is_empty = rdwr_from_flows [ " 220 smtp . gmail . com ESTMP - gsmtp " ; " 250 - smtp . gmail . com at your service , [ 8 . 8 . 8 . 8 ] " ; " 250 AUTH LOGIN PLAIN " ; ...
let test_1 ( ) = Alcotest . test_case " usual with authentication " ` Quick @@ fun ( ) -> let ctx = Colombe . State . Context . make ( ) in let rdwr , is_empty = rdwr_from_flows [ " 220 smtp . gmail . com ESTMP - gsmtp " ; " 250 - smtp . gmail . com at your service , [ 8 . 8 . 8 . 8 ] " ; " 250 AUTH LOGIN PLAIN " ; " 3...
let test_2 ( ) = Alcotest . test_case " bad authentication " ` Quick @@ fun ( ) -> let ctx = Colombe . State . Context . make ( ) in let rdwr , is_empty = rdwr_from_flows [ " 220 smtp . gmail . com ESMTP - gsmtp " ; " 250 - smtp . gmail . com at your service , [ 8 . 8 . 8 . 8 ] " ; " 250 - SIZE 0 " ; " 250 - AUTH LOGIN...
let test_3 ( ) = Alcotest . test_case " PLAIN mechanism unavailable " ` Quick @@ fun ( ) -> let ctx = Colombe . State . Context . make ( ) in let rdwr , is_empty = rdwr_from_flows [ " 220 smtp . gmail . com ESMTP - gsmtp " ; " 250 - smtp . gmail . com at your service , [ 8 . 8 . 8 . 8 ] " ; " 250 AUTH LOGIN " ; " 504 U...
let test_4 ( ) = Alcotest . test_case " authentication required " ` Quick @@ fun ( ) -> let ctx = Colombe . State . Context . make ( ) in let rdwr , _is_empty = rdwr_from_flows [ " 220 smtp . gmail . com ESMTP - gsmtp " ; " 250 - smtp . gmail . com at your service , [ 8 . 8 . 8 . 8 ] " ; " 250 AUTH LOGIN " ; " 530 Auth...
let test_5 ( ) = Alcotest . test_case " 8BITMIME " ` Quick @@ fun ( ) -> let ctx = Colombe . State . Context . make ( ) in let rdwr , is_empty = rdwr_from_flows [ " 220 smtp . gmail . com ESTMP - gsmtp " ; " 250 - smtp . gmail . com at your service , [ 8 . 8 . 8 . 8 ] " ; " 250 - AUTH LOGIN PLAIN " ; " 250 8BITMIME " ;...
let test_6 ( ) = Alcotest . test_case " spam " ` Quick @@ fun ( ) -> let ctx = Colombe . State . Context . make ( ) in let rdwr , is_empty = rdwr_from_flows [ " 220 smtp . gmail . com ESTMP - gsmtp " ; " 250 - smtp . gmail . com at your service , [ 8 . 8 . 8 . 8 ] " ; " 250 - AUTH LOGIN PLAIN " ; " 250 8BITMIME " ; " 5...
let test_7 ( ) = Alcotest . test_case " ethereal " ` Quick @@ fun ( ) -> let ctx = Colombe . State . Context . make ( ) in let rdwr , is_empty = rdwr_from_flows [ " 220 smtp . gmail . com ESTMP - gsmtp " ; " 250 - smtp . gmail . com at your service , [ 8 . 8 . 8 . 8 ] " ; " 250 AUTH LOGIN PLAIN " ; " 250 < romain . cal...
let stream_of_string str = let once = ref false in fun ( ) -> if ! once then None else ( once := true ; Some ( str , 0 , String . length str ) )
let stream_of_strings vs = let vs = ref vs in fun ( ) -> match ! vs with | [ ] -> None | hd :: tl -> vs := tl ; Some ( hd , 0 , String . length hd )
let _78_a_with_dot_rw = [ String . make 78 ' a ' ^ " \ r \ n " ; " . " ^ String . make 77 ' a ' ]
let _75_a_with_dot_qp = String . make 75 ' a ' ^ " . " ^ String . make 74 ' a '
let test_8 ( ) = Alcotest . test_case " dot " ` Quick @@ fun ( ) -> let ctx = Colombe . State . Context . make ( ) in let mail = let open Mrmime in let subject = Unstructured . Craft . ( compile [ v " Simple " ; sp 1 ; v " Mail " ] ) in let hd0 = let content0 = Content_type . ( make ` Text ( Subtype . v ` Text " plain ...
let test_9 ( ) = Alcotest . test_case " base64 " ` Quick @@ fun ( ) -> let ctx = Colombe . State . Context . make ( ) in let rdwr , is_empty = rdwr_from_flows [ " 220 smtp . gmail . com ESTMP - gsmtp " ; " 250 - smtp . gmail . com at your service , [ 8 . 8 . 8 . 8 ] " ; " 250 - AUTH LOGIN PLAIN " ; " 250 8BITMIME " ; "...
let test_10 ( ) = Alcotest . test_case " unproperly quit " ` Quick @@ fun ( ) -> let ctx = Colombe . State . Context . make ( ) in let rdwr , is_empty = rdwr_from_flows [ " 220 smtp . gmail . com ESMTP - gsmtp " ; " 250 - smtp . gmail . com at your service , [ 8 . 8 . 8 . 8 ] " ; " 250 - SIZE 0 " ; " 250 - AUTH LOGIN P...
let ( ) = Alcotest . run " sendmail " [ ( " mock " , [ test_0 ( ) ; test_1 ( ) ; test_2 ( ) ; test_3 ( ) ; test_4 ( ) ; test_5 ( ) ; test_6 ( ) ; test_7 ( ) ; test_8 ( ) ; test_9 ( ) ; test_10 ( ) ; ] ) ; ]
module String_sequence = GLib . Sequence . Make ( struct type t = char let t_typ = char end )
let test_empty_sequence test_ctxt = let s = String_sequence . create ( fun _ -> ( ) ) in let len = String_sequence . length s in let ( ) = assert_equal_uint ( Unsigned . UInt . zero ) len in let is_empty = String_sequence . is_empty s in assert_equal_boolean true is_empty
let tests = " GLib2 sequence module tests " >::: [ " Test empty sequence " >:: test_empty_sequence ; ]
let ( >>== ) p v = Lwt_main . run ( Lwt . map ( ( = ) v ) p )
let ( ) = let open Support . Lib . Seq in assert ( first empty = None ) ; assert ( first ( return 0 ) = Some 0 ) ; assert ( first ( cons 0 empty ) = Some 0 ) ; assert ( first ( append empty empty ) = None ) ; assert ( List . of_seq empty = [ ] ) ; assert ( List . of_seq ( return 0 ) = [ 0 ] ) ; assert ( List . of_seq (...
let ( ) = let open Support . Lib . Seq_e in assert ( first empty = None ) ; assert ( first ( return 0 ) = Some ( Ok 0 ) ) ; assert ( first ( return_e ( Ok 0 ) ) = Some ( Ok 0 ) ) ; assert ( first ( return_e ( Error ( ) ) ) = Some ( Error ( ) ) ) ; assert ( first ( interrupted ( ) ) = Some ( Error ( ) ) ) ; assert ( fir...