text stringlengths 12 786k |
|---|
type tup7 = a * b * c * d * e * f * g |
type tup8 = a * b * c * d * e * f * g * h |
let test_tup2 = Test . make ~ count : 10 ~ name " : forall x in ( ' a ' , ' b ' ) ' b ' : x = ( ' a ' , ' b ' ) ' b ' " ( make gen_tup2 ) gen_tup2 ( fun x -> x = ( ' a ' , ' b ' ) ' b ' ) ' b ' |
let test_tup3 = Test . make ~ count : 10 ~ name " : forall x in ( ' a ' , ' b ' , ' c ' ) ' c ' : x = ( ' a ' , ' b ' , ' c ' ) ' c ' " ( make gen_tup3 ) gen_tup3 ( fun x -> x = ( ' a ' , ' b ' , ' c ' ) ' c ' ) ' c ' |
let test_tup4 = Test . make ~ count : 10 ~ name " : forall x in ( ' a ' , ' b ' , ' c ' , ' d ' ) ' d ' : x = ( ' a ' , ' b ' , ' c ' , ' d ' ) ' d ' " ( make gen_tup4 ) gen_tup4 ( fun x -> x = ( ' a ' , ' b ' , ' c ' , ' d ' ) ' d ' ) ' d... |
let test_tup5 = Test . make ~ count : 10 ~ name " : forall x in ( ' a ' , ' b ' , ' c ' , ' d ' , ' e ' ) ' e ' : x = ( ' a ' , ' b ' , ' c ' , ' d ' , ' e ' ) ' e ' " ( make gen_tup5 ) gen_tup5 ( fun x -> x = ( ' a ' , ' b ' , ' c ' , ' d... |
let test_tup6 = Test . make ~ count : 10 ~ name " : forall x in ( ' a ' , ' b ' , ' c ' , ' d ' , ' e ' , ' f ' ) ' f ' : x = ( ' a ' , ' b ' , ' c ' , ' d ' , ' e ' , ' f ' ) ' f ' " ( make gen_tup6 ) gen_tup6 ( fun x -> x = ( ' a ' , ' b... |
let test_tup7 = Test . make ~ count : 10 ~ name " : forall x in ( ' a ' , ' b ' , ' c ' , ' d ' , ' e ' , ' f ' , ' g ' ) ' g ' : x = ( ' a ' , ' b ' , ' c ' , ' d ' , ' e ' , ' f ' , ' g ' ) ' g ' " ( make gen_tup7 ) gen_tup7 ( fun x -> ... |
let test_tup8 = Test . make ~ count : 10 ~ name " : forall x in ( ' a ' , ' b ' , ' c ' , ' d ' , ' e ' , ' f ' , ' g ' , ' h ' ) ' h ' : x = ( ' a ' , ' b ' , ' c ' , ' d ' , ' e ' , ' f ' , ' g ' , ' h ' ) ' h ' " ( make gen_tup8 ) ... |
let tests = [ test_tup2 ; test_tup3 ; test_tup4 ; test_tup5 ; test_tup6 ; test_tup7 ; test_tup8 ; ] |
let tests = List . map ( QCheck_alcotest . to_alcotest ) to_alcotest tests |
let ( ) = Alcotest . run " Test_Tuple " [ ( " Tuple " , tests ) tests ] tests |
let _make_sure_pool_pointer_is_an_int x = ( x : _ Pool . Pointer . t :> int ) |
module Make ( Pool : Pool . S ) = struct module Pointer = Pool . Pointer let % test_unit " get_tuple with length = 1 " = let pool = Pool . create Pool . Slots . t1 ~ capacity : 10 ~ dummy : 0 in let ptr = Pool . new1 pool 42 in let tuple = Pool . get_tuple pool ptr in assert ( t... |
module Error_checked_pool = Pool . Error_check ( Pool ) let t = create Slots . t1 ~ capacity : 1 ~ dummy : 13 in let pointer = new1 t 15 in let show_pointer ( ) = print_s [ % sexp ( pointer_is_valid t pointer : bool ) , ( get t pointer Slot . t0 : int ) ] in show_pointer ( ) ... |
let check_tx_rollup_exists ctxt tx_rollup = Context . Tx_rollup . state ctxt tx_rollup >|=? fun _ -> ( ) |
let check_proto_error f t = match t with | Environment . Ecoproto_error e :: _ when f e -> Assert . test_error_encodings e ; return_unit | _ -> failwith " Unexpected error : % a " Error_monad . pp_print_trace t |
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 -> Op . tx_rollup_origination ( I i ) contract >>=? fun ( op... |
let message_hash_testable : Tx_rollup_message . hash Alcotest . testable = Alcotest . testable Tx_rollup_message . pp_hash ( = ) |
let wrap m = m >|= Environment . wrap_tzresult |
let inbox_fees state size = Environment . wrap_tzresult ( Tx_rollup_state . fees state size ) |
let fees_per_byte state = inbox_fees state 1 |
let check_batch_in_inbox : Tx_rollup_inbox . t -> int -> string -> unit tzresult Lwt . t = fun inbox n expected -> let ( expected_batch , _ ) = Tx_rollup_message . make_batch expected in let expected_hash = Tx_rollup_message . hash expected_batch in match List . nth inbox . contents n with |... |
let context_init n = Context . init ~ consensus_threshold : 0 ~ tx_rollup_enable : true ~ endorsing_reward_per_slot : Tez . zero ~ baking_reward_bonus_per_slot : Tez . zero ~ baking_reward_fixed_portion : Tez . zero n |
let originate b contract = Op . tx_rollup_origination ( B b ) contract >>=? fun ( operation , tx_rollup ) -> Block . bake ~ operation b >>=? fun b -> return ( b , tx_rollup ) |
let init_originate_and_submit ( ? batch = String . make 5 ' c ' ) ( ) = context_init 1 >>=? fun ( b , contracts ) -> let contract = WithExceptions . Option . get ~ loc : __LOC__ @@ List . nth contracts 0 in originate b contract >>=? fun ( b , tx_rollup ) -> Context . Con... |
let assert_ok res = match res with Ok r -> r | Error _ -> assert false |
let raw_level level = assert_ok @@ Raw_level . of_int32 level |
let test_origination ( ) = Context . init ~ tx_rollup_enable : true 1 >>=? fun ( b , contracts ) -> let contract = WithExceptions . Option . get ~ loc : __LOC__ @@ List . nth contracts 0 in Context . get_constants ( B b ) >>=? fun { parametric = { tx_rollup_origination_size ; ... |
let test_two_originations ( ) = Context . init ~ tx_rollup_enable : true 1 >>=? fun ( b , contracts ) -> let contract = WithExceptions . Option . get ~ loc : __LOC__ @@ List . nth contracts 0 in Incremental . begin_construction b >>=? fun i -> Op . tx_rollup_origination ( I i ) c... |
let test_fees_per_byte_update ( ) = let test ~ inbox_ema ~ fees_per_byte ~ final_size ~ hard_limit ~ result = let fees_per_byte = Tez . of_mutez_exn fees_per_byte in let result = Tez . of_mutez_exn result in let state = Alpha_context . Tx_rollup_state . Internal_for_tests . make ~ fees_per_byte... |
let test_add_batch ( ) = let contents_size = 5 in let contents = String . make contents_size ' c ' in init_originate_and_submit ~ batch : contents ( ) >>=? fun ( ( contract , balance ) , state , tx_rollup , b ) -> Context . Tx_rollup . inbox ( B b ) tx_rollup >>=? fun { ... |
let test_add_two_batches ( ) = let contents_size1 = 5 in let contents1 = String . make contents_size1 ' c ' in init_originate_and_submit ~ batch : contents1 ( ) >>=? fun ( ( contract , balance ) , state , tx_rollup , b ) -> Op . tx_rollup_submit_batch ( B b ) contract tx_roll... |
let test_batch_too_big ( ) = context_init 1 >>=? fun ( b , contracts ) -> let contract = WithExceptions . Option . get ~ loc : __LOC__ @@ List . nth contracts 0 in originate b contract >>=? fun ( b , tx_rollup ) -> Context . get_constants ( B b ) >>=? fun constant -> let conten... |
let fill_inbox b tx_rollup contract contents k = let message_size = String . length contents in Context . get_constants ( B b ) >>=? fun constant -> let tx_rollup_inbox_limit = constant . parametric . tx_rollup_hard_size_limit_per_inbox in Context . Contract . counter ( B b ) contract >>=? fun... |
let test_inbox_too_big ( ) = context_init 1 >>=? fun ( b , contracts ) -> let contract = WithExceptions . Option . get ~ loc : __LOC__ @@ List . nth contracts 0 in Context . get_constants ( B b ) >>=? fun constant -> let tx_rollup_batch_limit = constant . parametric . tx_rollup_ha... |
let test_finalization ( ) = context_init 2 >>=? fun ( b , contracts ) -> let filler = WithExceptions . Option . get ~ loc : __LOC__ @@ List . nth contracts 0 in let contract = WithExceptions . Option . get ~ loc : __LOC__ @@ List . nth contracts 0 in originate b contract >>=? fun ... |
let test_inbox_linked_list ( ) = let assert_level_equals ~ loc expected actual = match actual with | None -> assert false | Some level -> Assert . equal ~ loc Raw_level . equal " expected same level " Raw_level . pp expected level in context_init 1 >>=? fun ( b , contracts ) -> let contra... |
let tests = [ Tztest . tztest " check feature flag is disabled " ` Quick test_disable_feature_flag ; Tztest . tztest " check tx rollup origination and burn " ` Quick test_origination ; Tztest . tztest " check two originated tx rollup in one operation have different address " ` Quick test_... |
let wrap_error_lwt x = x >>= fun x -> Lwt . return @@ Environment . wrap_tzresult x |
let test_unparse_view ( ) = let dummy_contract = " { parameter unit ; storage unit ; code { CAR ; NIL operation ; PAIR } ; view \ " \ v0 " \ unit unit { DROP ; UNIT } ; view " \ v1 " \ nat nat { CAR } } " in let contract_expr = Expr . from_string dummy_contract in... |
let test_context ( ) = Context . init ~ consensus_threshold : 0 3 >>=? fun ( b , _cs ) -> Incremental . begin_construction b >>=? fun v -> return ( Incremental . alpha_ctxt v ) |
let test_context_with_nat_nat_big_map ( ) = Context . init 3 >>=? fun ( b , contracts ) -> let source = WithExceptions . Option . get ~ loc : __LOC__ @@ List . hd contracts in Op . contract_origination ( B b ) source ~ script : Op . dummy_script >>=? fun ( operation , originate... |
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_typecheck_stack_overflow ( ) = test_context ( ) >>=? fun ctxt -> let storage = " Unit " in let parameter = " Unit " in let script = read_file " . / contracts / big_interpreter_stack . tz " in Contract_helpers . run_script ctxt script ~ storage ~ parameter ( ) >>= functi... |
let _test_unparse_stack_overflow ( ) = test_context ( ) >>=? fun ctxt -> let enorme_et_seq n = let rec aux n acc = aux ( n - 1 ) @@ Micheline . Seq ( 0 , [ acc ] ) in aux n ( Micheline . Int ( 0 , Z . zero ) ) in Script_ir_translator . ( unparse_code ctxt Readable ( ... |
let location = function | Prim ( loc , _ , _ , _ ) | Int ( loc , _ ) | String ( loc , _ ) | Bytes ( loc , _ ) | Seq ( loc , _ ) -> loc |
let test_parse_ty ctxt node expected = let legacy = false in let allow_lazy_storage = true in let allow_operation = true in let allow_contract = true in let allow_ticket = true in Environment . wrap_tzresult ( Script_ir_translator . parse_ty ctxt ~ legacy ~ allow_lazy_storage ~ allow_operation ~ allow_c... |
let test_parse_comb_type ( ) = let open Script in let open Script_typed_ir in let nat_prim = Prim ( - 1 , T_nat , [ ] , [ ] ) in let nat_prim_a = Prim ( - 1 , T_nat , [ ] , [ " % a " ] ) in let nat_prim_b = Prim ( - 1 , T_nat , [ ] , [ " % b " ] ... |
let test_unparse_ty loc ctxt expected ty = Environment . wrap_tzresult ( Script_ir_translator . unparse_ty ~ loc ( ) : ctxt ty >>? fun ( actual , ctxt ) -> if actual = expected then ok ctxt else Alcotest . failf " Unexpected error : % s " loc ) |
let test_unparse_comb_type ( ) = let open Script in let open Script_typed_ir in let nat_prim = Prim ( ( ) , T_nat , [ ] , [ ] ) in let nat_ty = nat_t in let pair_prim l = Prim ( ( ) , T_pair , l , [ ] ) in let pair_ty ty1 ty2 = pair_t ( - 1 ) ty1 ty2 in let pair_pr... |
let test_unparse_comparable_ty loc ctxt expected ty = let open Script_typed_ir in Environment . wrap_tzresult ( set_t ( - 1 ) ty >>? fun set_ty_ty -> Script_ir_translator . unparse_ty ~ loc ( ) : ctxt set_ty_ty >>? fun ( actual , ctxt ) -> if actual = Prim ( ( ) , T_set , [ exp... |
let test_unparse_comb_comparable_type ( ) = let open Script in let open Script_typed_ir in let nat_prim = Prim ( ( ) , T_nat , [ ] , [ ] ) in let nat_ty = nat_key in let pair_prim l = Prim ( ( ) , T_pair , l , [ ] ) in let pair_ty ty1 ty2 = pair_key ( - 1 ) ty1 ty2... |
let test_parse_data ( ? equal = Stdlib . ( = ) ) loc ctxt ty node expected = let legacy = false in let allow_forged = true in wrap_error_lwt ( Script_ir_translator . parse_data ctxt ~ legacy ~ allow_forged ty node >>=? fun ( actual , ctxt ) -> if equal actual expected then return ctxt else... |
let test_parse_data_fails loc ctxt ty node = let legacy = false in let allow_forged = false in wrap_error_lwt ( Script_ir_translator . parse_data ctxt ~ legacy ~ allow_forged ty node >>= function | Ok _ -> Alcotest . failf " Unexpected typechecking success : % s " loc | Error trace -> let trace_s... |
let test_parse_comb_data ( ) = let open Script in let open Script_typed_ir in let z = Script_int . zero_n in let z_prim = Micheline . Int ( - 1 , Z . zero ) in let nat_ty = nat_t in let pair_prim l = Prim ( - 1 , D_Pair , l , [ ] ) in let pair_ty ty1 ty2 = pair_t ( - 1 ) ty... |
let test_parse_address ( ) = let open Script_typed_ir in test_context_with_nat_nat_big_map ( ) >>=? fun ( ctxt , _big_map_id ) -> wrap_error_lwt ( Lwt . return ( Contract . of_b58check " KT1FAKEFAKEFAKEFAKEFAKEFAKEFAKGGSE2x " ) ) >>=? fun kt1fake -> test_parse_data __LOC__ ctxt addr... |
let test_unparse_data loc ctxt ty x ~ expected_readable ~ expected_optimized = wrap_error_lwt ( Script_ir_translator . unparse_data ctxt Script_ir_translator . Readable ty x >>=? fun ( actual_readable , ctxt ) -> ( if actual_readable = expected_readable then return ctxt else Alcotest . failf " E... |
let test_unparse_comb_data ( ) = let open Script in let open Script_typed_ir in let z = Script_int . zero_n in let z_prim = Micheline . Int ( - 1 , Z . zero ) in let nat_ty = nat_t in let pair_prim l = Prim ( - 1 , D_Pair , l , [ ] ) in let pair_ty ty1 ty2 = pair_t ( - 1 ) ... |
let gen_pairs left right = [ Prim ( ( ) , Script . D_Pair , [ left ; right ] , [ ] ) ; Seq ( ( ) , [ left ; right ] ) ] |
let rec gen_combs leaf arity = assert ( arity >= 2 ) ; if arity = 2 then gen_pairs leaf leaf else gen_combs leaf ( arity - 1 ) |> List . map ( fun smaller -> ( match smaller with | Prim ( loc , Script . D_Pair , vs , [ ] ) -> Prim ( loc , Script . D_Pair , leaf :: vs ... |
let test_optimal_comb ( ) = let open Script_typed_ir in let leaf_ty = nat_t in let leaf_mich = Int ( ( ) , Z . zero ) in let leaf_v = Script_int . zero_n in let size_of_micheline mich = let canonical = Micheline . strip_locations mich in ( canonical , Bytes . length @@ Data_encoding . ... |
let test_contract_not_packable ( ) = let contract_unit = Prim ( 0 , Script . T_contract , [ Prim ( 0 , T_unit , [ ] , [ ] ) ] , [ ] ) in test_context ( ) >>=? fun ctxt -> ( match Script_ir_translator . parse_any_ty ctxt ~ legacy : false contract_unit with | Ok ... |
let test_forbidden_op_in_view op ( ) = let prefix = " . / contracts / forbidden_op_in_view_ " in let script = read_file ( prefix ^ op ^ " . tz " ) in let contract_expr = Expr . from_string script in test_context ( ) >>=? fun ctxt -> Script_ir_translator . typecheck_code ~ legacy ... |
let tests = [ Tztest . tztest " test unparse view " ` Quick test_unparse_view ; Tztest . tztest " test typecheck stack overflow error " ` Quick test_typecheck_stack_overflow ; Tztest . tztest " test comb type parsing " ` Quick test_parse_comb_type ; Tztest . tztest " test comb type ... |
type ( ' a , ' b ) ba = ( ' a , ' b , c_layout ) Genarray . t |
type ( ' a , ' b ) ta = ( ' a , ' b ) typedArray |
module Setup = struct type ( _ , _ ) t = | Int8 : ( int , Bigarray . int8_signed_elt ) t | Uint8 : ( int , Bigarray . int8_unsigned_elt ) t | Int16 : ( int , Bigarray . int16_signed_elt ) t | Uint16 : ( int , Bigarray . int16_unsigned_elt ) t | Int32 : ( int32 , B... |
let kind_of_setup : type a b . ( a , b ) Setup . t -> ( a , b ) kind = function | Setup . Int8 -> Int8_signed | Setup . Uint8 -> Int8_unsigned | Setup . Int16 -> Int16_signed | Setup . Uint16 -> Int16_unsigned | Setup . Int32 -> Int32 | Setup . Float32 -> Float32 | Setup . ... |
let ta_type_is_correct : type a b . ( a , b ) Setup . t -> ( a , b ) ta Js . t -> bool = fun setup a -> let get_prop prop obj = Js . Unsafe . get obj ( Js . string prop ) in let name = a |> get_prop " constructor " |> get_prop " name " |> Js . to_string in match setup , ... |
let kind_field_is_correct : type a b . ( a , b ) Setup . t -> ( a , b ) ba -> bool = fun setup a -> match kind_of_setup setup , Genarray . kind a with | Float32 , Float32 -> true | Float64 , Float64 -> true | Int8_signed , Int8_signed -> true | Int8_unsigned , Int8_unsigned -> t... |
let ba_of_array : type a b . ( a , b ) Setup . t -> a array -> ( a , b ) ba = fun setup a -> Array1 . of_array ( kind_of_setup setup ) c_layout a |> genarray_of_array1 |
let array_of_ba : type a b . ( a , b ) ba -> a array = fun a -> let a = Bigarray . array1_of_genarray a in let len = Bigarray . Array1 . dim a in let rec aux i = if i == len then [ ] else Bigarray . Array1 . unsafe_get a i :: aux ( i + 1 ) in aux 0 |> Array . of_list |
let array_of_ta : type a b . ( a , b ) Setup . t -> ( a , b ) ta Js . t -> a array = fun _ a -> let len = a . ## length in let rec aux i = if i == len then [ ] else unsafe_get a i :: aux ( i + 1 ) in aux 0 |> Array . of_list |
let test setup a0 = let a1 = ba_of_array setup a0 in let a2 = from_genarray a1 in if not ( array_of_ta setup a2 = a0 ) then print_endline " ` a2 ` doesnt match ` a0 ` " ; if not ( ta_type_is_correct setup a2 ) then print_endline " corrupted typedArray type " ; let a3 = to_genarray a2 in... |
let test_check_basic _ = assert_equal true ( check Int Int ) ; assert_equal true ( check String String ) ; assert_equal true ( check Unit Unit ) ; assert_equal true ( check Nil Nil ) ; assert_equal false ( check Int String ) ; assert_equal false ( check Int Unit ) ; assert_equal fa... |
let test_check_array _ = let uniq1 = ref ( ) in let uniq2 = ref ( ) in let arr1 = Array ( Int , uniq1 ) in let arr2 = Array ( Int , uniq1 ) in let arr3 = Array ( Int , uniq2 ) in let arr4 = Array ( String , uniq1 ) in assert_equal true ( check arr1 arr1 ) ; assert_equal tru... |
let test_check_record _ = let uniq1 = ref ( ) in let uniq2 = ref ( ) in let sym = Sym . from_string in let rec1 = Record ( [ ( sym " x " , Int ) ; ( sym " y " , Int ) ] , uniq1 ) in let rec2 = Record ( [ ( sym " x " , Int ) ; ( sym " y " , Int ) ... |
let test_check_name _ = let sym = Sym . from_string in let name1 = Name ( sym " n1 " , ref ( Some Int ) ) in let name2 = Name ( sym " n2 " , ref ( Some String ) ) in let name3 = Name ( sym " n3 " , ref ( Some name1 ) ) in let name4 = Name ( sym " n4 " , ref Non... |
let suite = " types " >::: [ " test_check_basic " >:: test_check_basic ; " test_check_array " >:: test_check_array ; " test_check_record " >:: test_check_record ; " test_check_name " >:: test_check_name ; ] |
let _ = run_test_tt_main suite |
let id = Id . create ~ name " : some - type - id " [ % sexp_of : unit ] in print_s [ % sexp ( id : _ Id . t ) ] ; [ % expect { | some - type - id } ] | ; ; ( module struct open Type_equal . Id let t1 = create ~ name " : t1 " [ % sexp_of : _ ] let t2 = ... |
let strip_whitespace = Str . ( global_replace ( regexp " [ \ r \ n ] " ) + " " ) |
let equal_ignoring_whitespace l r = strip_whitespace l = strip_whitespace r |
let assert_printed_as ? name format expected typ = assert_equal ~ cmp : equal_ignoring_whitespace ~ printer ( : fun s -> s ) expected ( format ? name typ ) |
let assert_typ_printed_as ? name e t = assert_printed_as ? name string_of_typ e t |
let assert_fn_printed_as ? name e f = assert_printed_as ? name string_of_fn e f |
let test_atomic_printing _ = begin assert_typ_printed_as " void " void ; assert_typ_printed_as ~ name " : a " " char a " char ; assert_typ_printed_as " signed char " schar ; assert_typ_printed_as ~ name " : b " " short b " short ; assert_typ_printed_as " int " int ; assert_ty... |
let test_pointer_printing _ = begin assert_typ_printed_as ~ name " : a " " void * a " ( ptr void ) ; assert_typ_printed_as " unsigned long long " ** ( ptr ( ptr ullong ) ) ; assert_typ_printed_as ~ name " : b " " char ***** b " ( ptr ( ptr ( ptr ( ptr ( ptr char ) ... |
let test_struct_and_union_printing _ = begin let s_incomplete = structure " s_incomplete " in let u_incomplete = union " u_incomplete " in assert_typ_printed_as ~ name " : a " " struct s_incomplete a " s_incomplete ; assert_typ_printed_as " union u_incomplete " u_incomplete ; let s_prims ... |
let test_array_printing _ = begin assert_typ_printed_as ~ name " : a " " int a [ 10 ] " ( array 10 int ) ; assert_typ_printed_as " long [ 1 ] [ 2 ] [ 3 ] " ( array 1 ( array 2 ( array 3 long ) ) ) ; assert_typ_printed_as ~ name " : b " " int [ 3 ] ... |
let test_ocaml_string_printing _ = begin assert_typ_printed_as ~ name " : p " " char * p " ocaml_string ; assert_typ_printed_as " char " * ocaml_string ; end |
let test_bigarray_signed_printing _ = begin assert_typ_printed_as " int8_t [ 1 ] [ 3 ] " ( bigarray genarray [ | 1 ; 3 ] | Bigarray_compat . int8_signed ) ; assert_typ_printed_as " int16_t [ 3 ] " ( bigarray array1 3 Bigarray_compat . int16_signed ) ; assert_typ_print... |
let test_bigarray_unsigned_printing _ = skip_if true " Unsigned bigarray elements currently indistinguishable from signed elements " ; begin assert_typ_printed_as " uint8_t [ 2 ] " ( bigarray array1 2 Bigarray_compat . int8_unsigned ) ; assert_typ_printed_as " uint16_t [ 4 ] " ( big... |
let test_bigarray_float_printing _ = begin assert_typ_printed_as " float [ 10 ] [ 100 ] " ( bigarray genarray [ | 10 ; 100 ] | Bigarray_compat . float32 ) ; assert_typ_printed_as " double [ 20 ] [ 30 ] [ 40 ] " ( bigarray genarray [ | 20 ; 30 ; 40 ] | ... |
let test_function_printing _ = begin assert_fn_printed_as ~ name " : a " " void a ( void ) " ( void @-> returning void ) ; assert_fn_printed_as " float ( int , char , double ) " ( int @-> char @-> double @-> returning float ) ; assert_fn_printed_as ~ name " : c " " in... |
let test_view_printing _ = begin assert_typ_printed_as ~ name " : a " " char * a " string ; let v : unit typ = view ~ read ( : fun _ -> ( ) ) ~ write ( : fun ( ) ( ) -> ( ) ) ( Foreign . funptr ( void @-> returning void ) ) in assert_typ_printed_as " void ( ... |
let test_enum_printing _ = begin assert_typ_printed_as ~ name " : f " " enum fruit f " Struct_stubs . fruit ; assert_typ_printed_as " enum fruit " Struct_stubs . fruit ; assert_typ_printed_as ~ name " : b " " bears_t b " Struct_stubs . bears_t ; assert_typ_printed_as " bears_t " ... |
let suite = " Type printing tests " >::: [ " printing atomic types " >:: test_atomic_printing ; " printing pointers " >:: test_pointer_printing ; " printing structs and unions " >:: test_struct_and_union_printing ; " printing arrays " >:: test_array_printing ; " printing OCaml stri... |
let _ = run_test_tt_main suite |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.