text stringlengths 0 601k |
|---|
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 : false ~ show_types : false ctxt contra... |
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 unparsing " ` Quick test_unparse_comb... |
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 , Bigarray . int32_elt ) t | Float32 : ( float , Bigarray .... |
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 . Float64 -> Float64 |
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 , name with | Setup . Float32 , " Float32Array " ->... |
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 -> true | Int16_signed , Int16_signed -> true... |
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 if not ( array_of_ba a3 = a0 ) t... |
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 false ( check Int Nil ) ; assert_equal f... |
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 true ( check arr1 arr2 ) ; assert_equal false ( c... |
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 ) ] , uniq1 ) in let rec3 = Record ( [ ( sym " x " , Int ) ; ( sym " y " , I... |
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 None ) in assert_equal true ( check name1 Int ) ; assert_equal... |
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 = create ~ name " : t2 " [ % sexp_of : _ ] let % test _ = same t1 t1 l... |
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_typ_printed_as ~ name " : c " " long c " long ... |
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 abs_t = abstract ~ name " : abs_t " ~ siz... |
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 = structure " s_prims " in let ... |
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 ] ) ) [ 4 ] " ( array 1 ( ptr ( array 2 ( Foreign . funptr ( ptr ( array 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_printed_as " int32_t [ 5 ] [ 6 ] " ( bigarray array2 ( 5 ... |
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 ] " ( bigarray array1 4 Bigarray_compat . int1... |
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 ] | Bigarray_compat . float64 ) ; assert_typ_printed_as " float _Complex... |
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 " " int ( void ) ) ) ( int ) " ( Foreign . funptr ( void @... |
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 ( void ) " v ; let w : unit typ = view ( Foreign . funptr ( int ... |
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 " Struct_stubs . bears_t ; assert_typ_prin... |
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 string types " >:: test_ocaml_string_print... |
let _ = run_test_tt_main suite |
let rec permut = function | [ ] -> [ [ ] ] | x :: xs -> let insert xs = let rec loop acc left right = match right with | [ ] -> List . rev ( x :: left ) :: acc | y :: ys -> loop ( List . rev_append left ( x :: right ) :: acc ) ( y :: left ) ys in loop [ ] [ ] xs in List . concat_map insert ( permut xs ) |
let test_take_n _ = ListLabels . iter ( permut [ 1 ; 2 ; 3 ; 4 ; 5 ; 6 ; 7 ; 8 ; 9 ] ) ~ f ( : fun xs -> Assert . equal ~ msg : __LOC__ ( TzList . take_n ~ compare 1 xs ) [ 9 ] ) ; ListLabels . iter ( permut [ 1 ; 2 ; 3 ; 4 ; 5 ; 6 ; 7 ; 8 ; 9 ] ) ~ f ( : fun xs -> Assert . equal ~ msg : __LOC__ ( TzList . take_n ~ com... |
let test_drop_n _ = Assert . equal ~ msg : __LOC__ ( TzList . drop_n 3 [ 1 ; 2 ; 3 ; 4 ; 5 ] ) [ 4 ; 5 ] ; Assert . equal ~ msg : __LOC__ ( TzList . drop_n 3 [ 1 ; 2 ] ) [ ] ; Assert . equal ~ msg : __LOC__ ( TzList . drop_n 3 [ ] ) [ ] ; Assert . equal ~ msg : __LOC__ ( TzList . drop_n ( - 1 ) [ 1 ; 2 ] ) [ 1 ; 2 ] ; ... |
let test_filter_some _ = Assert . equal ~ msg : __LOC__ ( TzList . filter_some [ ] ) [ ] ; Assert . equal ~ msg : __LOC__ ( TzList . filter_some [ None ] ) [ ] ; Assert . equal ~ msg : __LOC__ ( TzList . filter_some [ None ; None ] ) [ ] ; Assert . equal ~ msg : __LOC__ ( TzList . filter_some [ Some 0 ; None ; Some 1 ]... |
let list_size = QCheck . Gen . int_range 2 1000 |
let pp_int_list = Format . pp_print_list ~ pp_sep ( : fun ppf ( ) -> Format . fprintf ppf " ; " ) Format . pp_print_int |
let test_shuffle_preserves_values = QCheck . Test . make ~ name " : shuffle preserves value sets " ~ count QCheck . ( list_of_size list_size int ) ( fun l -> let l1 = List . sort Int . compare l in let l2 = List . sort Int . compare ( TzList . shuffle l ) in Lib_test . Qcheck_helpers . qcheck_eq ' ~ pp : pp_int_list ~ ... |
let test_take_drop = QCheck . Test . make ~ name " ( : take_n n l @@ drop_n n l ) = l " ~ count QCheck . ( pair ( list_of_size list_size int ) small_int ) ( fun ( l , n ) -> Lib_test . Qcheck_helpers . qcheck_eq ' ~ pp : pp_int_list ~ eq ( : = ) ~ actual : TzList . ( take_n n l @ TzList . drop_n n l ) ~ expected : l ( ... |
let test_filter_some_length = QCheck . Test . make ~ name " ( : length ( filter_some l ) ) = ( length ( filter ( Option . is_some ) l ) ) " ~ count QCheck . ( list_of_size list_size ( option int ) ) ( fun l -> Lib_test . Qcheck_helpers . qcheck_eq ' ~ pp : Format . pp_print_int ~ eq ( : = ) ~ actual ( : List . length (... |
let ( ) = Alcotest . run " stdlib " [ ( " tzList " , [ ( " take_n " , ` Quick , test_take_n ) ; ( " drop_n " , ` Quick , test_drop_n ) ; ( " filter_some " , ` Quick , test_filter_some ) ; QCheck_alcotest . to_alcotest test_shuffle_preserves_values ; QCheck_alcotest . to_alcotest test_take_drop ; QCheck_alcotest . to_al... |
let test_split_duplicated_separator_default_behavior ( ) = let inputs = [ " Hello World " ; " Hello World " ; " HelloWorld " ; " Hello World " ; " Hello World " ; " Hello World " ; ] in List . iter ( fun s -> assert ( TzString . split ? dup : None ' ' s = TzString . split ' ' s ) ) inputs |
let test_split_dup_param_to_true_with_duplicated_separator ( ) = let inputs = [ " Hello World " ; " Hello World " ; " Hello World " ; " Hello World " ; " Hello World " ; ] in List . iter ( fun s -> assert ( [ " Hello " ; " World " ] = TzString . split ~ dup : true ' ' s ) ) inputs |
let test_split_dup_param_to_false_with_duplicated_separator ( ) = let inputs = [ ( " Hello World " , [ " Hello " ; " World " ] ) ; ( " Hello World " , [ " Hello " ; " " ; " World " ] ) ; ( " Hello World " , [ " Hello " ; " " ; " World " ; " " ] ) ; ( " HelloWorld " , [ " HelloWorld " ] ) ; ( " Hello World " , [ " " ; "... |
let test_split_roundtrip ( ) = let inputs = [ " HelloWorld " ; " Hello World " ; " Hello World " ; " H e l l o W o rl d " ; " " ; ] in List . iter ( fun input -> let split = TzString . split ~ dup : false ' ' input in let reassembled = String . concat " " split in assert ( input = reassembled ) ) inputs |
let split_tests = [ ( " Default behavior handles a duplicated separator " , ` Quick , test_split_duplicated_separator_default_behavior ) ; ( " dup parameter to true " , ` Quick , test_split_dup_param_to_true_with_duplicated_separator ) ; ( " dup parameter to false " , ` Quick , test_split_dup_param_to_false_with_duplic... |
let ( ) = Alcotest . run " TzString " [ ( " split " , split_tests ) ] |
let raises f v = Exn . does_raise ( fun ( ) -> f v ) ( module struct let % test _ = Uchar . ( to_scalar min_value ) = 0x0000 let % test _ = Uchar . ( to_scalar max_value ) = 0x10FFFF end ) ; ; ( module struct let % test _ = raises Uchar . succ_exn Uchar . max_value let % test _ = Uchar . ( to_scalar ( succ_exn min_valu... |
let char_max = Uchar . of_scalar_exn 0x00FF ( module struct let % test _ = Uchar . ( is_char Uchar . min_value ) let % test _ = Uchar . ( is_char char_max ) let % test _ = Uchar . ( not ( is_char ( of_scalar_exn 0x0100 ) ) ) let % test _ = not ( Uchar . is_char Uchar . max_value ) end ) ; ; ( module struct let % test _... |
let _ = print_newline ( ) ; Printf . printf " Testing union - find algorithm \ n " |
let test = let open UF . M in UF . add 0 >>= fun ( ) -> UF . add 1 >>= fun ( ) -> UF . add 2 >>= fun ( ) -> UF . add 3 >>= fun ( ) -> UF . add 4 >>= fun ( ) -> UF . find 0 >>= fun v0_repr -> UF . find 1 >>= fun v1_repr -> assert ( v0_repr <> v1_repr ) ; UF . union 0 1 >>= fun _ -> UF . find 0 >>= fun v0_repr -> UF . fi... |
let ( ) = UF . M . run test |
let _ = Printf . printf " Success . \ n " |
let all_tests = ref [ ] |
let test_cnt = ref 0 |
let add_tests name tests = all_tests := ! all_tests @ [ name , tests ] |
let pos_tests = [ " a * b " , " b * a " ; " a * ( b * c ) " , " ( c * b ) * a " ; " ( a * b ) f " , " ( b * a ) f " ; " a * b -> c " , " b * a -> c " ; " ( a * b ) f * c " , " ( b * a ) f * c " ; " ( a * b ) f -> c " , " ( b * a ) f -> c " ; " a -> ( b * c ) f " , " a -> ( c * b ) f " ; " ( a * b ) * c " , " a * ( b * ... |
let neg_tests = [ " unit -> a " , " a " ; " unit -> unit -> a " , " a " ; " unit * unit -> a " , " a " ; " ( unit -> a ) * b " , " a * b " ; " ( unit -> a ) f " , " a f " ; " a -> ' a " , " x -> b -> c " ; " x * b -> c " , " a -> ' a " ; " ' a -> ' a " , " ( x -> y ) * z -> y " ; " a " , " a -> a " ; " a " , " a * a " ... |
let slow_tests = [ " ' A * int list -> unit " , " anchor * bitmap * bool * bool * color * color * color * color * color * color * color * color * cursor * int * int * int * int * int * int * int * int * justification * relief * state * string * string * string -> ' a " ] |
let tests = let make_test speed res ( str1 , str2 ) = let env_query = Type . Env . make Query in let env = Type . Env . make Data in let test ( ) = let ty1 = Type . of_string env_query str1 in let ty2 = Type . of_string env str2 in let name = Fmt . str " % s ≡ % s " str1 str2 in Alcotest . ( check bool ) name res @@ Un... |
let ( ) = add_tests " Unification . unifiable " tests |
let ( ) = Alcotest . run ~ quick_only : true ~ argv : Sys . argv " unification " ! all_tests |
let zero_obj = Caml . Obj . repr ( 0 : int ) let t = create_obj_array ~ len : 0 in assert ( length t = 0 ) ; ; let str = Caml . Obj . repr " foo " in let t = create ~ len : 2 str in assert ( phys_equal ( get t 0 ) str ) ; assert ( phys_equal ( get t 1 ) str ) ; ; let float = Caml . Obj . repr 3 . 5 in let t = create ~ ... |
module Sequence = struct type nonrec ' a t = ' a t type ' a z = ' a let length = length let get = get let set = set let create_bool ~ len = create ~ len false end let test a1 a2 f = let result = map2_exn ~ f ( of_list a1 ) ( of_list a2 ) in print_s [ % message ( result : int Uniform_array . t ) ] in test [ ] [ ] ( fun ... |
let t1 = Array ( Var 1 ) |
let t2 t = Fun ( Var 1 , t ) |
let t3 a b = Block ( 0 , [ a ; t1 ; t2 b ] ) |
let t4 t = t3 t t ; ; |
let t5 = Variant ( 3 , [ [ Var 1 ] ; [ Array Bool ] ; [ Var 2 ; Int ; Unit ] ] ) |
let t6 = Variant ( 3 , [ [ Var 2 ] ; [ Array Unit ] ; [ Float ; Var 1 ; Int ] ] ) |
let t7 = Block ( 0 , [ Var 1 ; Var 2 ; Int ] ) |
let t8 = Block ( 0 , [ Var 2 ; Float ; Var 1 ] ) |
let t9 a b = Fun ( a , b ) |
let b3 x y z = Block ( 0 , [ x ; y ; z ] ) |
let v3 a b c = Variant ( 0 , [ a ; b ; c ] ) |
let b2 n x y = Block ( n , [ x ; y ] ) |
let unifying a b = print_endline ( " " ^ string_of_subst ( unify [ ( a , b ) ] Subst . empty ) ) |
let merging a b = try print_endline ( " Merging " ^ string_of_ty a ^ " and " ^ string_of_ty b ) ; print_endline ( " " ^ string_of_ty ( merge_ty a b ) ) with Merge_failure -> print_endline " failed to merge " | Unification_failure -> print_endline " failed to unify " ; ; |
let testlib = Dl . ( dlopen ~ filename " : clib / libtest_functions . so " ~ flags [ : RTLD_NOW ] ) |
let test_inspecting_float _ = let module M = struct type u let utyp : u union typ = union " u " let ( ) -: ty label = field utyp label ty let f = double -: " f " let i = int64_t -: " i " let ( ) = seal utyp let pi = 3 . 14 let e = 2 . 718 let u = make utyp let ( ) = setf u f pi let repr = getf u i let ( ) = assert_equa... |
let test_endian_detection _ = let module M = struct type e let etyp : e union typ = union " e " let ( ) -: ty label = field etyp label ty let i = int64_t -: " i " let c = array ( sizeof int64_t ) uchar -: " c " let ( ) = seal etyp let updated_char_index = if Sys . big_endian then sizeof int64_t - 1 else 0 let e = make ... |
module Build_foreign_tests ( S : Cstubs . FOREIGN with type ' a result = ' a and type ' a return = ' a ) = struct open Functions module M = Common ( S ) open M let test_union_padding _ = let module M = struct let mkPadded : int64 -> padded union = fun x -> let u = make padded in setf u i x ; u let arr = CArray . of_lis... |
module Build_stub_tests ( S : Cstubs . FOREIGN with type ' a result = ' a and type ' a return = ' a ) = struct open Functions include Build_foreign_tests ( S ) module N = Functions . Stubs ( S ) open N let test_passing_unions_by_value _ = let module M = struct let mkPadded : int64 -> padded union = fun x -> let u = mak... |
module Build_struct_stub_tests ( S : Ctypes . TYPE with type ' a typ = ' a Ctypes . typ and type ( ' a , ' s ) field = ( ' a , ' s ) Ctypes . field ) = struct module M = Types . Struct_stubs ( S ) let retrieve_size name = let f = Foreign . foreign ~ from : testlib name ( void @-> returning size_t ) in Unsigned . Size_t... |
let test_union_address _ = let module M = struct type u let u : u union typ = union " u " let ( ) -: ty label = field u label ty let i = int64_t -: " i " let c = char -: " c " let s = ptr ( structure " incomplete " ) -: " s " let ( ) = seal u let up = addr ( make u ) let ( ) = begin assert_equal ( to_voidp up ) ( to_vo... |
let test_updating_sealed_union _ = let utyp = union " sealed " in let _ = field utyp " _ " int in let ( ) = seal utyp in assert_raises ( ModifyingSealedType " sealed " ) ( fun ( ) -> field utyp " _ " char ) |
let test_adding_fields_through_views _ = let module M = struct let union_u = union " union_u " let u = typedef union_u " u " let x = field u " x " int let y = field u " y " float let ( ) = seal u end in ( ) |
let test_sealing_empty_union _ = let empty = union " empty " in assert_raises ( Unsupported " union with no fields " ) ( fun ( ) -> seal empty ) |
let suite = " Union tests " >::: [ " inspecting float representation " >:: test_inspecting_float ; " detecting endianness " >:: test_endian_detection ; " union padding ( foreign ) " >:: Foreign_tests . test_union_padding ; " union padding ( stubs ) " >:: Stub_tests . test_union_padding ; " passing unions by value ( stu... |
let _ = run_test_tt_main suite |
let create x = let t = create x in assert ( is_compressed t ) ; t ; ; |
let union t1 t2 = union t1 t2 ; invariant ignore t1 ; invariant ignore t2 ; assert ( is_compressed t1 || is_compressed t2 ) ; ; |
let get t = let x = get t in assert ( is_compressed t ) ; x ; ; |
let set t x = set t x ; assert ( is_compressed t ) ; ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.