text stringlengths 0 601k |
|---|
let most_positive_fixnum_value = eval_int_var " most - positive - fixnum " |
let most_positive_fixnum = Value . emacs_max_int print_s [ % sexp ( most_negative_fixnum_value : Value . t ) ] ; [ % expect { | - 2305843009213693952 } ] ; | print_s [ % sexp ( most_negative_fixnum : int ) ] ; [ % expect { | - 2_305_843_009_213_693_952 } ] ; | print_s [ % sexp ( most_positive_fixnum_value : Value . t )... |
let of_ints = List . map ~ f : of_int_exn |
let examples = of_ints [ - 1 ; 0 ; 1 ; 2 ; 3 ; 4 ; 5 ; 7 ; 8 ; 9 ; 63 ; 64 ; 65 ] |
let examples_64_bit = [ min_value ; succ min_value ; pred max_value ; max_value ] |
let print_for ints f = List . iter ints ~ f ( : fun i -> print_s [ % message " " ~ _ ( : i : int32 ) ~ _ ( : Or_error . try_with ( fun ( ) -> f i ) : int Or_error . t ) ] ) ; ; print_for examples floor_log2 ; [ % expect { | ( - 1 ( Error ( " [ Int32 . floor_log2 ] got invalid input " - 1 ) ) ) ( 0 ( Error ( " [ Int32 .... |
check_int_hash_coherence [ % here ] ( module Int63 ) ; [ % expect { | } ] | ; ; [ % test_result : t ] min_value ~ expect ( : of_int64_exn ( - 4611686018427387904L ) ) ; ; [ % test_result : t ] ( of_int32_exn Int32 . min_value ) ~ expect ( : of_int32 Int32 . min_value ) ; ; [ % test_result : t ] ( of_int32_exn Int32 . m... |
check_int_hash_coherence [ % here ] ( module Int64 ) ; [ % expect { | } ] | ; ; |
let numbers = [ 0x0000_0000_0000_1020L ; 0x0000_0000_0011_2233L ; 0x0000_0000_1122_3344L ; 0x0000_0011_2233_4455L ; 0x0000_1122_3344_5566L ; 0x0011_2233_4455_6677L ; 0x1122_3344_5566_7788L ] ; ; |
let test = test_conversion ~ to_string : Int64 . Hex . to_string_hum List . iter numbers ~ f ( : test bswap16 ) ; [ % expect { | 0x1020 --> 0x2010 0x11_2233 --> 0x3322 0x1122_3344 --> 0x4433 0x11_2233_4455 --> 0x5544 0x1122_3344_5566 --> 0x6655 0x11_2233_4455_6677 --> 0x7766 0x1122_3344_5566_7788 --> 0x8877 } ] | ; ; L... |
let examples = [ - 1L ; 0L ; 1L ; 2L ; 3L ; 4L ; 5L ; 7L ; 8L ; 9L ; 63L ; 64L ; 65L ] |
let examples_64_bit = [ min_value ; succ min_value ; pred max_value ; max_value ] |
let print_for ints f = List . iter ints ~ f ( : fun i -> print_s [ % message " " ~ _ ( : i : int64 ) ~ _ ( : Or_error . try_with ( fun ( ) -> f i ) : int Or_error . t ) ] ) ; ; print_for examples floor_log2 ; [ % expect { | ( - 1 ( Error ( " [ Int64 . floor_log2 ] got invalid input " - 1 ) ) ) ( 0 ( Error ( " [ Int64 .... |
module Common_tests ( S : Cstubs . FOREIGN with type ' a result = ' a and type ' a return = ' a ) = struct module M = Functions . Stubs ( S ) open M let test_max_caml_int _ = assert_equal max_int ( max_caml_int ( ) ) ~ printer : string_of_int end |
let test_uint64_of_int _ = begin assert_equal max_int ( UInt64 . to_int ( UInt64 . of_int max_int ) ) ~ printer : string_of_int end |
let test_store_caml_int _ = begin let p = allocate camlint max_int in assert_equal max_int !@ p ~ printer : string_of_int end |
let suite = " Integer tests " >::: [ " UInt64 . of_int " >:: test_uint64_of_int ; " max_caml_int ( foreign ) " >:: Foreign_tests . test_max_caml_int ; " max_caml_int ( stubs ) " >:: Stub_tests . test_max_caml_int ; " storing camlint " >:: test_store_caml_int ; ] |
let _ = run_test_tt_main suite |
let tests = [ ( " integration . xml " >:: fun _ -> " <? xml version ' = 1 . 0 ' encoding ' = windows - 1252 ' ?>< root >\ xa0 </ root >< a ></ a " > |> string |> parse_xml |> signals |> write_xml |> to_string |> assert_equal ( " <? xml version " =\ 1 . 0 " \ encoding " =\ windows - 1252 " " \?> ^ " < root >\ xc2 \ xa0 ... |
module Interface ( R : Idl . RPC ) RPC = struct open R let int_p = Idl . Param . mk Rpc . Types . int let string_p = Idl . Param . mk Rpc . Types . string let int_p_named_1 = Idl . Param . mk ~ name " : int1 " ~ description [ : " first int param " ] Rpc . Types . int let int_p_named_2 = Idl . Param . mk ~ name " : int2... |
let asexp = { ( ( | matrix ( ( Wub ( Doj 0 . 2uf Doj_min ) ) 0 . 017678127290832395 ) ( ( Wub ( Doj 0 . 2uf Doj_roral ) ) 0 . 0048403389770755555 ) ( ( Wub ( Doj 0 . 5uf Doj_min ) ) 0 . 014466863493201646 ) ( ( Wub ( Doj 0 . 5uf Doj_roral ) ) 0 . 0032743622425625684 ) ( ( Wub ( Doj 1uf Doj_min ) ) 0 . 00629118788281229... |
let bsexp = { ( ( | matrix ( ( Wub ( Doj 0 . 2uf Doj_min ) ) 0 . 018567212015996211 ) ( ( Wub ( Doj 0 . 2uf Doj_roral ) ) 0 . 018367577773486032 ) ( ( Wub ( Doj 0 . 5uf Doj_min ) ) 0 . 010881217012225865 ) ( ( Wub ( Doj 0 . 5uf Doj_roral ) ) 0 . 020752124708078318 ) ( ( Wub ( Doj 1uf Doj_min ) ) 0 . 0082337954818188109... |
type test_config = { ml_port : int ; sclang_path : string ; sc_port : int ; sc_script_path : string ; } |
let ping_sclang config packet = let open Osc . Types in let open Osc_unix . Udp in let localhost = Unix . inet_addr_of_string " 127 . 0 . 0 . 1 " in let ml_addr = Unix . ADDR_INET ( localhost , config . ml_port ) in let sc_addr = Unix . ADDR_INET ( localhost , config . sc_port ) in let sent_packet = match packet with |... |
let test_ping_sclang config = " test_ping_sclang " >::: ( List . map ( fun ( name , packet ) -> name >:: ( fun ( ) -> ping_sclang config packet ) ) Test_common . test_packets_sclang ) |
let test_interop_sclang config = " test_interop_sclang " >::: [ test_ping_sclang config ; ] |
let write_ml_port ml_port = let data_file_path = " test . data " in let chan = open_out data_file_path in begin try output_binary_int chan ml_port ; with e -> close_out chan ; raise e end ; close_out chan |
let usage ( ) = Printf . printf " Usage :\ n " ; %! Printf . printf " % s < ml - port > < sclang - path > < sc - port > < sc - script - path >\ n " %! Sys . executable_name |
let ( ) = match Sys . argv with | [ | _ ; ml_port_string ; sclang_path ; sc_port_string ; sc_script_path ] | -> begin try let ml_port = int_of_string ml_port_string in let sc_port = int_of_string sc_port_string in write_ml_port ml_port ; print_endline " -------- SuperCollider interoperability tests " ; -------- let con... |
let test_context ( ) = Context . init 3 >>=? fun ( b , _cs ) -> Incremental . begin_construction b >>=? fun v -> return ( Incremental . alpha_ctxt v ) |
let logger = Script_typed_ir . { log_interp = ( fun _ _ _ _ _ -> ( ) ) ; log_entry = ( fun _ _ _ _ _ -> ( ) ) ; log_exit = ( fun _ _ _ _ _ -> ( ) ) ; log_control = ( fun _ -> ( ) ) ; get_log = ( fun ( ) -> Lwt . return ( Ok None ) ) ; } |
let run_step ctxt code accu stack = let open Script_interpreter in let open Contract_helpers in step None ctxt default_step_constants code accu stack >>=? fun ( ( _ , _ , ctxt ' ) as r ) -> step ( Some logger ) ctxt default_step_constants code accu stack >>=? fun ( _ , _ , ctxt ' ' ) -> if Gas . ( remaining_operation_g... |
let test_bad_contract_parameter ( ) = test_context ( ) >>=? fun ctx -> Contract_helpers . run_script ctx " { parameter unit ; storage unit ; code { CAR ; NIL operation ; PAIR } } " ~ storage " : Unit " ~ parameter " : 0 " ( ) >>= function | Ok _ -> Alcotest . fail " expected an error " | Error ( Environment . Ecoproto_... |
let test_multiplication_close_to_overflow_passes ( ) = test_context ( ) >>=? fun ctx -> Contract_helpers . run_script ctx " { parameter unit ; storage unit ; code { DROP ; PUSH mutez 2944023901536524477 ; \ PUSH nat 2 ; MUL ; DROP ; UNIT ; NIL operation ; PAIR } } " ~ storage " : Unit " ~ parameter " : Unit " ( ) >>= f... |
let read_file filename = let ch = open_in filename in let s = really_input_string ch ( in_channel_length ch ) in close_in ch ; s |
let test_stack_overflow ( ) = let open Script_typed_ir in test_context ( ) >>=? fun ctxt -> let ctxt = Gas . update_remaining_operation_gas ctxt @@ Gas . fp_of_milligas_int ( Saturation_repr . saturated :> int ) in let stack = Bot_t in let descr kinstr = { kloc = 0 ; kbef = stack ; kaft = stack ; kinstr } in let kinfo ... |
let test_stack_overflow_in_lwt ( ) = let open Script_typed_ir in test_context ( ) >>=? fun ctxt -> let ctxt = Gas . update_remaining_operation_gas ctxt @@ Gas . fp_of_milligas_int ( Saturation_repr . saturated :> int ) in let stack = Bot_t in let item ty s = Item_t ( ty , s ) in let unit_t = unit_t in let unit_k = unit... |
let test_json_roundtrip name testable enc v = let v ' = Data_encoding . Json . destruct enc ( Data_encoding . Json . construct enc v ) in Alcotest . check testable ( Format . asprintf " round trip should not change value of % s " name ) v v ' ; return_unit |
let test_json_roundtrip_err name e ( ) = test_json_roundtrip name Testable . protocol_error Environment . Error_monad . error_encoding e |
let error_encoding_tests = let contract_zero = Contract . implicit_contract Signature . Public_key_hash . zero in let script_expr_int = Micheline . strip_locations ( Micheline . Int ( 0 , Z . zero ) ) in List . map ( fun ( name , e ) -> Tztest . tztest ( Format . asprintf " test error encoding : % s " name ) ` Quick ( ... |
module Test_map_instr_on_options = struct type storage = { prev : int option ; total : int } let test_map_option_script = { | { parameter ( option int ) ; storage ( pair ( option int ) int ) ; code { UNPAIR ; DIP { CDR } ; MAP { DUP ; DIP { ADD } ; } ; PAIR ; NIL operation ; PAIR ; } } } | let run_test_map_opt_script p... |
let tests = [ Tztest . tztest " test bad contract error " ` Quick test_bad_contract_parameter ; Tztest . tztest " check robustness overflow error " ` Slow test_stack_overflow ; Tztest . tztest " check robustness overflow error in lwt " ` Slow test_stack_overflow_in_lwt ; Tztest . tztest " test multiplication no illegit... |
let ie_addr = Uint16 . ( of_int 0xFF ) |
let if_addr = Uint16 . ( of_int 0xF0 ) |
let create ( ) = Interrupt_controller . create ~ ie_addr ~ if_addr let t = create ( ) in t |> Interrupt_controller . show |> Printf . printf " % s " ; [ % expect { | ie ( : vblank : 0 , lcd_stat : 0 , timer : 0 , serial_port : 0 , joypad : 0 ) , if ( : vblank : 0 , lcd_stat : 0 , timer : 0 , serial_port : 0 , joypad : ... |
let random_action ( ) = match Random . int 12 with | 0 -> ` Before | 1 -> ` After | 2 -> ` Inside | 3 -> ` Outside | 4 -> ` Forget | 5 -> ` Replace_before | 6 -> ` Replace_after | 7 -> ` Replace_inside | 8 -> ` Replace_outside | 9 | 10 | 11 -> ` None | _ -> assert false |
module type S = module type of Order_managed_interval |
type ' a tree = Node of ' a * ' a tree list |
module Test ( M : S ) = struct let process gc check name = let rec apply acc ( Node ( x , xs ) ) = function | ` None -> Node ( x , sub xs ) :: acc | ` Before -> Node ( x , sub xs ) :: Node ( M . before x , [ ] ) :: acc | ` After -> Node ( M . after x , [ ] ) :: Node ( x , sub xs ) :: acc | ` Inside -> Node ( x , [ Node... |
let t ( ) = ( Unix . times ( ) ) . Unix . tms_utime |
let once ? gc ? check ~ pass state name ( module M : S ) = let module M = Test ( M ) in Random . set_state state ; Gc . major ( ) ; Gc . major ( ) ; let t0 = t ( ) in M . test ? gc ? check name pass ; let dt = t ( ) . - t0 in Printf . printf " % s check time : . % 02f \ n " name dt |
let ( ) = let ( ) = Random . self_init ( ) in let state = Random . get_state ( ) in let pass = try int_of_string ( Sys . argv . ( 1 ) ) with _ -> 80 in once state " Order_interval " ( module Order_interval ) ~ pass ~ check : true ~ gc : false ; once state " Order_managed_interval " ( module Order_managed_interval ) ~ p... |
module type S = sig type t [ @@ deriving sexp_of ] val quickcheck_generator : t Generator . t val quickcheck_shrinker : t Shrinker . t end |
module type Test = sig module type S = S module Config : sig module Seed : sig type t = | Nondeterministic | Deterministic of string [ @@ deriving sexp_of ] end type t = { seed : Seed . t ; test_count : int ; shrink_count : int ; sizes : int Sequence . t } [ @@ deriving fields , sexp_of ] end val default_config : Confi... |
( module struct let check input output = List . for_all [ " " ; " " ; + " " - ] ~ f ( : fun prefix -> let input = prefix ^ input in let output = prefix ^ output in [ % compare . equal : string ] output ( insert_underscores input ) ) ; ; let % test _ = check " 1 " " 1 " let % test _ = check " 12 " " 12 " let % test _ = ... |
module Stream = struct include Stream let map f stream = let next _ = match Stream . next stream with | v -> Some ( f v ) | exception Stream . Failure -> None in Stream . from next let filter p stream = let rec next i = match Stream . next stream with | v -> ( match p v with | Some v -> Some v | None -> next i ) | exce... |
module Util = struct let always x _ = x let some x = Some x let cons ( x , xs ) = x :: xs end |
module Tok = struct type kwd = Let | In | If | Then | Else | Case | End | Fun type op = Plus | Minus | Times | Eql type ' a t = | Kwd : kwd -> unit t | Id : string t | Int : int t | Op : op -> unit t | LParen : unit t | RParen : unit t | LBrace : unit t | RBrace : unit t | Comma : unit t | Bar : unit t | Colon : unit t... |
module Lexer = struct module P = Lexing open P open Util let chr c = tok ( Chr c ) $ always c let token t v = Parsing . Tok ( t , v ) let token ' t = token t ( ) let kwd_token k = token ' ( Tok . Kwd k ) let op_token o = token ' ( Tok . Op o ) let charset s = let len = String . length s in let rec loop i acc = if i < l... |
module Exp = struct module P = Parsing open P open Util open Tok type exp = | Var of string | Let of string * exp * exp | Int of int | Op of op * exp * exp | If of exp * exp * exp let ( ) @@ f p = p $ f let ( ) |> p1 p2 = p1 >>> p2 $ ( fun ( f , x ) -> f x ) let any gs = List . fold_left ( ) <|> bot gs let paren p = ( ... |
let x = match Word_size . word_size with | W32 -> 9 | W64 -> 10 in for i = 0 to x do for j = 0 to x do assert ( int_pow i j = Caml . ( int_of_float ( float_of_int i ** float_of_int j ) ) ) done done ; ; |
module Test ( X : Make_arg ) : sig end = struct open X include Make ( X ) let % test_module " integer - rounding " = ( module struct let check dir ~ range ( : lower , upper ) ~ modulus expected = let modulus = of_int_exn modulus in let expected = of_int_exn expected in for i = lower to upper do let observed = round ~ d... |
let examples = [ - 1 ; 0 ; 1 ; 2 ; 3 ; 4 ; 5 ; 7 ; 8 ; 9 ; 63 ; 64 ; 65 ] |
let examples_64_bit = [ Int . min_value ; Int . min_value + 1 ; Int . max_value - 1 ; Int . max_value ] ; ; |
let print_for ints f = List . iter ints ~ f ( : fun i -> print_s [ % message " " ~ _ ( : i : int ) ~ _ ( : Or_error . try_with ( fun ( ) -> f i ) : int Or_error . t ) ] ) ; ; print_for examples floor_log2 ; [ % expect { | ( - 1 ( Error ( " [ Int . floor_log2 ] got invalid input " - 1 ) ) ) ( 0 ( Error ( " [ Int . floor... |
let intern_extern obj = let f = Filename . temp_file " testnum " " . data " in let oc = open_out_bin f in output_value oc obj ; close_out oc ; let ic = open_in_bin f in let res = input_value ic in close_in ic ; Sys . remove f ; res ; ; |
let equal_nat n1 n2 = eq_nat n1 0 ( length_nat n1 ) n2 0 ( length_nat n2 ) ; ; List . iter ( fun ( i , s ) -> let n = nat_of_string s in ignore ( test i equal_nat ( n , intern_extern n ) ) ) [ 1 , " 0 " ; 2 , " 1234 " ; 3 , " 8589934592 " ; 4 , " 340282366920938463463374607431768211455 " ; 5 , String . make 100 ' 3 ' ;... |
let arch_sixtyfour = Sys . word_size = 64 |
let try_with = Or_error . try_with ( module struct open Consume let % test_unit " bin_prot char " = let t = of_string " abc " in let a = bin_prot Char . bin_reader_t t in let b = bin_prot Char . bin_reader_t t in [ % test_eq : char ] a ' a ' ; [ % test_eq : char ] b ' b ' ; [ % test_eq : string ] ( to_string t ) " c " ... |
module type Accessors_common = Accessors_common |
module type Accessors_read = Accessors_read |
module type Accessors_write = Accessors_write |
module type Consuming_blit = Consuming_blit |
type nonrec ( ' d , ' w ) t = ( ' d , ' w ) Hexdump . t [ @@ deriving sexp_of ] |
type nonrec seek = seek [ @@ deriving sexp_of ] |
type nonrec no_seek = no_seek [ @@ deriving sexp_of ] |
module type Bound = Bound |
let strings = [ " " ; " a " ; " hello " ; " \ 000 " ; " \ 000 \ 000 \ 000 " ; " \ 000hello " ; String . make 1000 ' x ' ] ; ; |
let large_int a b c d = ( a lsl 48 ) lor ( b lsl 32 ) lor ( c lsl 16 ) lor d |
let iter_examples ~ f = List . iter strings ~ f ( : fun string -> let len = String . length string in for capacity = max 1 len to len + 2 do for pos = 0 to 2 do if pos + len <= capacity then ( try f ( create ~ len : capacity ) string ~ pos with | e -> raise_s [ % sexp " iter_examples " , { string : string ; len : int ;... |
type iter_slices_state = { pos : int option ; len : int option ; pos ' : int ; len ' : int ; is_valid : bool } |
let iter_slices n ~ f = let choices = [ None ; Some ( - 1 ) ; Some 0 ; Some 1 ; Some ( n / 3 ) ; Some ( n - 1 ) ; Some n ; Some ( n + 1 ) ] in List . iter choices ~ f ( : fun pos -> List . iter choices ~ f ( : fun len -> let pos ' = Option . value pos ~ default : 0 in let len ' = Option . value len ~ default ( : n - po... |
let is_empty = is_empty ( module struct let ( ) = let n = Random . int 100_000 + 1 in assert ( n > 0 ) ; let t = create ~ len : n in assert ( capacity t = n ) ; assert ( length t = n ) ; assert ( not ( is_empty t ) ) ; ; end ) ; ; let t = create ~ len : 1 in assert ( capacity t = 1 ) ; assert ( length t = 1 ) ; assert ... |
module Accessors ( Accessors : sig include module type of Unsafe val is_safe : bool end ) = struct open Accessors let % test_unit _ = let t = create ~ len : 10 in let n = length t in assert ( n = 10 ) ; Poke . char t ~ pos : 0 ' a ' ; Poke . char t ~ pos : 1 ' b ' ; ( sub_shared t |> fun t -> assert ( length t = n ) ; ... |
module Unsafe = Accessors ( struct include Unsafe let is_safe = false end ) |
let memcmp = memcmp let a = Iobuf . of_string " abc " in assert ( memcmp a a = 0 ) ; ; let a = Iobuf . of_string " abc " in let b = Iobuf . of_string " abd " in assert ( memcmp a b = - 1 ) ; ; ( module struct let % expect_test " set_bounds_and_buffer_sub " = let src = Iobuf . of_string " 123abcDEF " in let dst = Iobuf ... |
type nonrec ( ' d , ' w ) t = ( ' d , ' w ) Hexdump . t [ @@ deriving sexp_of ] let to_bigstring_shared_via_iovec ? pos ? len iobuf = let iovec = Expert . to_iovec_shared ? pos ? len iobuf in Bigstring . sub_shared iovec . buf ~ pos : iovec . pos ~ len : iovec . len in List . iter [ Iobuf . Expert . to_bigstring_shared... |
type nonrec ok_or_eof = ok_or_eof = | Ok | Eof |
module Io_test ( Ch : sig type in_ val create_in : string -> in_ val close_in : in_ -> unit val read : ( [ > write ] , seek ) Iobuf . t -> in_ -> ok_or_eof type out_ val create_out : Unix . File_descr . t -> out_ val close_out : out_ -> unit val write : ( [ > read ] , seek ) Iobuf . t -> out_ -> unit end ) = struct let... |
let input = input type in_ = In_channel . t let create_in file = In_channel . create file let close_in = In_channel . close type out_ = Out_channel . t let create_out = Unix . out_channel_of_descr let close_out = Out_channel . close let write = output let read = input end ) |
let write = write type in_ = Unix . File_descr . t type out_ = in_ let create_in file = Unix . openfile ~ mode [ : Unix . O_RDONLY ] file let close_in fd = Unix . close fd let create_out = Fn . id let close_out = close_in let read = read let write = write end ) |
let write_assume_fd_is_nonblocking = write_assume_fd_is_nonblocking iter_examples ~ f ( : fun t string ~ pos -> let n = String . length string in let file , fd = Unix . mkstemp " iobuf_test " in protect ~ finally ( : fun ( ) -> Unix . unlink file ) ~ f ( : fun ( ) -> ( sub_shared t ~ pos |> fun t -> Fill . stringo t st... |
let pwrite_assume_fd_is_nonblocking = pwrite_assume_fd_is_nonblocking let s = " 000000000011111111112222222222 " in let n = String . length s in let t = of_string s in let file , fd = Unix . mkstemp " iobuf_test " in protect ~ finally ( : fun ( ) -> Unix . unlink file ) ~ f ( : fun ( ) -> ( sub_shared t ~ pos : 0 ~ len... |
let rec retry_until_ready thunk = try thunk ( ) with | Unix . Unix_error ( ( EWOULDBLOCK | EAGAIN | EINTR ) , _ , _ ) -> Thread . yield ( ) ; retry_until_ready thunk ; ; |
let sendto_and_recvfrom recvfrom recv_fd sendto ~ sendto_name = let port , recv_addr = match Unix . getsockname recv_fd with | Unix . ADDR_INET ( recv_addr , port ) -> port , recv_addr | _ -> assert false in let send_addr = Unix . ( ADDR_INET ( Inet_addr . localhost , port ) ) in Result . iter sendto ~ f ( : fun sendto... |
let sends_with_recvfrom recvfrom = let fd = Unix . ( socket ~ domain : PF_INET ~ kind : SOCK_DGRAM ~ protocol : 0 ( ) ) in Unix . ( bind fd ~ addr ( : ADDR_INET ( Inet_addr . bind_any , 0 ) ) ) ; Unix . set_nonblock fd ; sendto_and_recvfrom recvfrom fd ~ sendto_name " : send " ( Or_error . map ( send_nonblocking_no_sig... |
let create_sample_file ( ? int_size = 2 ) ( ? be = false ) ~ msgcount = let bstr = Bigstring . create 512 in let t = create ~ len : 512 in let filename , fd = Unix . mkstemp " iobuftest " in for i = 0 to msgcount - 1 do let s = sprintf " MESSAGE % d " i in let len = String . length s in if Random . bool ( ) then ( let ... |
let check_msgs ( ? int_size = 2 ) ( ? be = false ) file = let msg_number = ref 0 in let check_message r = let msg = Consume . stringo r in let s = sprintf " MESSAGE % d " ! msg_number in assert ( String . equal s msg ) ; msg_number := ! msg_number + 1 in let fd = Unix . openfile file ~ perm : 0o600 ~ mode [ : Unix . O_... |
let string = " ` Boston is populous ' is about Boston and contains ` Boston ' ; ` ` Boston ' is disyllabic ' \ is about ` Boston ' and contains ` ` Boston ' ' . ` ` Boston ' ' designates ` Boston ' , which in \ turn designates Boston . To mention Boston we use ` Boston ' or a synonym , and to \ mention ` Boston ' we us... |
let iobuf = Iobuf . of_string string |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.