text
stringlengths
0
601k
let ( ) = Private . clock := clock
module Make_test ( M : Monad ) = struct open M . Let_syntax let test ? hide_if_less_than ( ) = let non_async_profile ( ) = profile ? hide_if_less_than Sync ( lazy [ % message " non_async_profile " ] ) ( fun ( ) -> advance_clock_by ( sec 0 . 1 ) ) in let bar ( ) = profile M . sync_or_async ? hide_if_less_than ( lazy [ %...
module Test_profile = Make_test ( struct include Monad . Ident let sync_or_async = Sync_or_async . Sync end )
module Test_profile_async = Make_test ( struct include Deferred let sync_or_async = Sync_or_async . Async end ) Test_profile . test ( ) ; [ % expect { | ( 1_000_000us foo " 1970 - 01 - 01 00 : 00 : 00Z " ( ( 20 % 200_000us bar ) ( 50 % 500_000us baz ( ( 40 % 200_000us bar ) ( 20 % 100_000us non_async_profile ) ( 40 % 2...
let call_profile ( ) = profile Sync ( lazy [ % sexp " context " ] ) ( fun ( ) -> advance_clock_by ( sec 1 . ) ; print_endline " function supplied to [ profile ] ran " ) ; ; Ref . set_temporarily output_profile ( fun string -> call_profile ( ) ; print_endline string ) ~ f ( : fun ( ) -> Ref . set_temporarily hide_if_les...
let profile_sync ( ) = profile Sync ( lazy [ % message " foo " ] ) ( fun ( ) -> advance_clock_by ( sec 1 . ) ) ; ; require_does_not_raise [ % here ] ~ cr : CR_soon ( fun ( ) -> Ref . set_temporarily sexp_of_time_ns ( fun _ -> raise_s [ % message " raising " ] ) ~ f : profile_sync ) ; [ % expect { | ( 1_000_000us foo ( ...
let fail = Fail None
let error msg = Fail ( Some msg )
let test_cases = [ ]
let cmp_result result1 result2 = match ( result1 , result2 ) with
let make_single_test_case ( code , expected_result ) = in try in in
module Hash_Properties ( Desc : sig val name : string end ) struct let pp_bytes fmt d = Format . fprintf fmt " % S " ( Bytes . to_string d ) let test_prop_incremental_one ( msg_s : string ) = let st = X . init ( ) in let msg = Bytes . of_string msg_s in X . update st msg ; let expected = X . finish st in let actual = X...
module SHA256_Props = Hash_Properties ( struct let name = " SHA256 " end ) ( Hacl . Hash . SHA256 )
module SHA512_Props = Hash_Properties ( struct let name = " SHA512 " end ) ( Hacl . Hash . SHA512 )
let ( ) = Alcotest . run " tezos - crypto - shaX - props " [ ( " SHA256_Props " , qcheck_wrap SHA256_Props . tests ) ; ( " SHA512_Props " , qcheck_wrap SHA512_Props . tests ) ; ]
module Signature_Properties ( Desc : sig val name : string end ) struct let test_prop_sign_check ( s : string ) = let ( _ , pk , sk ) = X . generate_key ( ) in let data = Bytes . of_string s in let signed = X . sign sk data in X . check pk signed data let test_prop_sign_check = Test . make ~ name ( : Desc . name ^ " _s...
module Ed25519_Props = Signature_Properties ( struct let name = " Ed25519 " end ) ( Ed25519 )
module P256_Props = Signature_Properties ( struct let name = " P256 " end ) ( P256 )
module Secp256k1_Props = Signature_Properties ( struct let name = " Secp256k1 " end ) ( Secp256k1 )
let ( ) = let open Signature in let f ( algo , name ) = let module X = struct include Signature let generate_key ? seed ( ) = generate_key ~ algo ? seed ( ) end in let module XProps = Signature_Properties ( struct let name = " Signature_ " ^ name end ) ( X ) in ( name , qcheck_wrap XProps . tests ) in List . map f [ ( ...
module Pk_Properties ( Desc : sig val name : string end ) struct let test_prop_sign_check ( sk_bytes : string ) = match X . sk_of_bytes @@ Bytes . of_string sk_bytes with | Some sk -> let pk = X . neuterize sk in let pk_bytes = X . to_bytes pk in let pk1 = X . pk_of_bytes_without_validation pk_bytes in let pk2 = X . pk...
module P256_Props = Pk_Properties ( struct let name = " P256 " end ) ( Hacl . P256 )
let ( ) = Alcotest . run " tezos - crypto - signature - pk " [ ( " P256_Pros " , qcheck_wrap P256_Props . tests ) ]
let test_protoc ctxt = let read filename = let path = Filename . concat ( Filename . dirname Sys . executable_name ) filename in let file = open_in path in let contents = really_input_string file ( in_channel_length file ) in close_in file ; Str . global_replace ( Str . regexp " " ) +$ " " contents in let actual_protoc...
let suite = " Test protoc " >:: test_protoc
let all_env_versions = Protocol . [ V0 ; V1 ; V2 ; V3 ]
let env_v_eq_check ( ) = List . iter ( fun v -> assert ( Protocol . compare_version v v = 0 ) ) all_env_versions
let env_v_lt_check ( ) = let rec check = function | [ ] -> ( ) | v :: vs -> assert ( List . for_all ( fun w -> Protocol . compare_version v w < 0 ) vs ) ; check vs in check all_env_versions
let env_v_gt_check ( ) = let rec check = function | [ ] -> ( ) | v :: vs -> assert ( List . for_all ( fun w -> Protocol . compare_version w v > 0 ) vs ) ; check vs in check all_env_versions
let env_v_comparison_checks = let open Alcotest in [ test_case " equal " ` Quick env_v_eq_check ; test_case " less - than " ` Quick env_v_lt_check ; test_case " greater - than " ` Quick env_v_gt_check ; ]
let ( ) = Alcotest . run " Protocol " [ ( " environment - version - comparison " , env_v_comparison_checks ) ]
module Util = struct [ %% declare_roles a , b , c , d ] [ %% declare_labels msg , left , right , middle , ping , pong , fini ] end
let test_projection_success ( ) = assert_equal ( ) @@ ignore @@ extract @@ ( a --> b ) msg finish ; assert_equal ~ msg " : simple " ( ) @@ ignore @@ extract @@ choice_at a [ % disj b ( left , right ) ] ( a , ( a --> b ) left finish ) ( a , ( a --> b ) right finish ) ; assert_equal ~ msg " : simple loop " ( ) @@ ignore ...
let suite = " Protcol combinators expected " >::: [ " test_projection_success " >:: test_projection_success ] ; ;
let _results = run_test_tt_main suite in ( )
module Util = struct [ %% declare_roles_prefixed a , b , c , d ] [ %% declare_labels msg , left , right , middle , ping , pong , fini ] end
let test_failfast_bottom ( ) = let bottom ( ) = loop_with [ a ; b ; c ] ( fun t -> t ) in assert_raises UnguardedLoop ~ msg " : bottom " ( fun _ -> ignore @@ extract @@ bottom ( ) ) ; assert_raises UnguardedLoop ~ msg " : bottom after comm " ( fun _ -> ignore @@ extract @@ ( a --> b ) msg @@ bottom ( ) ) ; assert_raise...
let test_failfast_loop_roles ( ) = assert_raises UnguardedLoop ~ msg " : declared roles absent in the loop " ( fun _ -> ignore @@ extract @@ loop_with [ a ; b ; c ] @@ fun t -> choice_at c [ % disj role_B ( left , right ) ] ( c , ( c --> b ) left t ) ( c , ( c --> b ) right t ) ) ; assert_raises UnguardedLoop ~ msg " :...
let test_loop_merge ( ) = assert_raises UnguardedLoop ~ msg " : loop merge " ( fun _ -> ignore @@ extract @@ choice_at a [ % disj role_B ( left , right ) ] ( a , ( a --> b ) left @@ loop_with [ a ; b ; c ] ( fun t -> choice_at a [ % disj role_B ( left , right ) ] ( a , ( a --> b ) left t ) ( a , ( a --> b ) right t ) )...
let suite = " Protcol combinators fail - fast test " >::: [ " test_failfast_bottom " >:: test_failfast_bottom ; " test_failfast_loop_roles " >:: test_failfast_loop_roles ; " test_loop_merge " >:: test_loop_merge ; ] ; ;
let _results = run_test_tt_main suite in ( )
module Util = struct [ %% declare_roles a , b , c , d ] [ %% declare_labels msg , left , right , middle , ping , pong , fini ] end
let extract_b_many g = let ` cons ( _ , ` cons ( b , _ ) ) = extract g in ignore ( Mpst . Multicast . get_many b )
let test_multicast_projection_success ( ) = let finish = many_at a Mpst . BasicCombinators . finish in ignore @@ extract @@ ( a @@--> b ) left finish ; ignore @@ extract @@ choice_at b [ % disj a ( left , right ) ] ( b , ( b -->@@ a ) left finish ) ( b , ( b -->@@ a ) right finish ) ; assert_equal ( ) @@ ignore @@ extr...
let suite = " Protcol combinators expected " >::: [ " test_multicast_projection_success " >:: test_multicast_projection_success ; ] ; ;
let _results = run_test_tt_main suite in ( )
let test_protocol_store _ store = let open Lwt_syntax in let protocols_to_register = [ ( Tezos_embedded_protocol_alpha . Registerer . Registered . hash , Tezos_embedded_protocol_alpha . Registerer . Source . sources ) ; ( Tezos_embedded_protocol_genesis . Registerer . Registered . hash , Tezos_embedded_protocol_genesis...
let tests = let test_cases = List . map wrap_test [ ( " generic protocol storing " , test_protocol_store ) ] in ( " protocol store " , test_cases )
module Alcotest_protocol_validator = struct module type HASHEQ = sig type t val eq : t -> t -> bool val pp : Format . formatter -> t -> unit end let registered_protocol : Registered_protocol . t Alcotest . testable = let open Registered_protocol in let eq ( p1 : t ) ( p2 : t ) : bool = let ( module P1 ) = p1 in let ( m...
let section = Some ( Internal_event . Section . make_sanitized [ " node " ; " validator " ] )
let filter = Some section
let wrap f _switch ( ) = Tztest . with_empty_mock_sink ( fun _ -> Lwt_utils_unix . with_tempdir " tezos_test_ " ( fun test_dir -> init_chain test_dir >>= fun store -> init_mock_p2p Distributed_db_version . Name . zero >>= function | Ok p2p -> let db = Distributed_db . create store p2p in Updater . init ( Filename . con...
let test_pushing_validator_protocol vl _switch ( ) = let pt = Protocol . { expected_env = V0 ; components = [ ] } in Protocol_validator . validate vl Protocol_hash . zero pt >>= fun res -> Alcotest . ( check ( Tztestable . tzresults Alcotest_protocol_validator . registered_protocol ) ) " Compilation should fail . " res...
let test_previously_validated_protocol vl _switch ( ) = let phony_pt = Protocol . { expected_env = V0 ; components = [ ] } in Protocol_validator . validate vl genesis_protocol_hash phony_pt >>= fun res -> Alcotest . check ( Tztestable . tzresults Alcotest_protocol_validator . registered_protocol ) " Compilation should ...
let test_fetching_protocol vl _switch ( ) = Protocol_validator . fetch_and_compile_protocol ~ peer : P2p_peer . Id . zero ~ timeout : Ptime . Span . zero vl Protocol_hash . zero >>= fun _ -> Mock_sink . ( assert_has_event " Should have a fetching_protocol event " ? filter Pattern . { level = Some Internal_event . Notic...
let tests = [ Alcotest_lwt . test_case " pushing_validator_protocol " ` Quick ( wrap test_pushing_validator_protocol ) ; Alcotest_lwt . test_case " previously_validated_protocol " ` Quick ( wrap test_previously_validated_protocol ) ; Alcotest_lwt . test_case " fetching_protocol " ` Quick ( wrap test_fetching_protocol )...
let proxy_mode_gen = QCheck2 . Gen . oneofl Tezos_proxy . Proxy . [ Client ; Server ]
let key_gen = let keys = QCheck2 . Gen . oneofl [ " big_maps " ; " index " ; " contents " ; " contracts " ; " cycle " ; " cycle " ; " rolls " ; " owner " ; " snapshot " ; " v1 " ; ] |> QCheck2 . Gen . list in QCheck2 . Gen . frequency QCheck2 . Gen . [ ( 9 , keys ) ; ( 1 , list string ) ]
let rec is_prefix t1 t2 = match ( t1 , t2 ) with | ( [ ] , _ ) -> true | ( _ , [ ] ) -> false | ( x1 :: rest1 , x2 :: rest2 ) when x1 = x2 -> is_prefix rest1 rest2 | _ -> false
let test_split_key = let fmt = let pp_sep fmt ( ) = Format . fprintf fmt " " / in Format . pp_print_list ~ pp_sep Format . pp_print_string in QCheck2 . Test . make ~ name " [ : fst ( split_key s ) ] is a prefix of [ s ] " QCheck2 . Gen . ( pair proxy_mode_gen key_gen ) @@ fun ( mode , key ) -> match Proxy . ProtoRpc . ...
let ( ) = Alcotest . run " tezos - lib - client - proxy " [ ( " proxy " , Lib_test . Qcheck_helpers . qcheck_wrap [ test_split_key ] ) ]
let to_some gen = QCheck . Gen . ( gen >|= Option . some )
let rpc_addr_gen = let open QCheck . Gen in let octet = 0 -- 255 in ( fun i j k l port -> let host = Format . sprintf " % s " ( String . concat " . " @@ List . map Int . to_string [ i ; j ; k ; l ] ) in let str = Format . sprintf " http ://% s :% d " host port in Uri . of_string str ) <$> octet <*> octet <*> octet <*> ...
let rpc_tls_gen = let open QCheck . Gen in let path_gen = list_size ( 1 -- 8 ) ( string_size ~ gen ( : char_range ' a ' ' z ' ) ( 1 -- 8 ) ) >|= fun s -> " " / ^ String . concat " " / s in pair path_gen path_gen >|= fun ( cert , key ) -> cert ^ " , " ^ key
let sym_block_caching_time_gen = QCheck . Gen . ( 1 -- 256 )
let proxy_server_config_arb endpoint_gen rpc_addr_gen rpc_tls_gen sym_block_caching_time_gen = let gen = QCheck . Gen . ( quad endpoint_gen rpc_addr_gen rpc_tls_gen sym_block_caching_time_gen >|= fun ( endpoint , rpc_addr , rpc_tls , sym_block_caching_time ) -> Proxy_server_config . make ~ endpoint ~ rpc_addr ~ rpc_tls...
module UnionRightBias = struct let arb = QCheck . Gen . ( proxy_server_config_arb ( opt @@ QCheck . gen Qcheck_helpers . endpoint_arb ) ( opt @@ QCheck . gen Qcheck_helpers . endpoint_arb ) ( opt rpc_tls_gen ) ( opt sym_block_caching_time_gen ) ) let reflexive = QCheck . Test . make ~ name " [ : union_right_bias t t ] ...
let test_example ( ) = let fail msg_opt = let suffix = Option . fold ~ none " , : but an unknown error happened " ~ some ( : fun msg -> " , but received error : " ^ msg ) msg_opt in QCheck . Test . fail_reportf " [ example_config ] should be parseable and validated % s . " suffix in let json = Data_encoding . Json . fr...
let good_proxy_server_config_arb ( ? sym_block_caching_time_gen = QCheck . Gen . ( opt sym_block_caching_time_gen ) ) ( ) = proxy_server_config_arb ( to_some @@ QCheck . ( gen Qcheck_helpers . endpoint_arb ) ) ( to_some rpc_addr_gen ) QCheck . Gen . ( opt rpc_tls_gen ) sym_block_caching_time_gen
let test_good_arb_to_runtime_ok = QCheck . Test . make ~ name " [ : to_runtime ] returns [ Ok ] on expected values " ( good_proxy_server_config_arb ( ) ) @@ fun config -> match Proxy_server_config . to_runtime config with | Ok _ -> true | Error msg -> QCheck . Test . fail_reportf " Expected [ to_runtime ] to succeed , ...
let test_union_preserves_to_runtime_ok = let arb = good_proxy_server_config_arb ( ) in let to_runtime_is_ok config = Proxy_server_config . to_runtime config |> Result . is_ok in QCheck . Test . make ~ name " [ : union_right_bias ] preserves [ Result . is_ok to_runtime ] " QCheck . ( pair arb arb ) @@ fun ( config1 , co...
let test_to_runtime_err_implies_union_to_runtime_err = let url_gen = QCheck . gen Qcheck_helpers . endpoint_arb in let arb = let open QCheck . Gen in let rpc_addr_gen = oneof [ rpc_addr_gen ; url_gen ] in let rpc_tls_gen = oneof [ string ; rpc_tls_gen ] in proxy_server_config_arb ( opt url_gen ) ( opt rpc_addr_gen ) ( ...
let test_wrong_sym_block_caching_time = let sym_block_caching_time_gen = to_some QCheck . Gen . ( neg_int ) in QCheck . Test . make ~ name " : if [ sym_block_caching_time ] is <= 0 , then [ to_runtime ] fails " ( good_proxy_server_config_arb ~ sym_block_caching_time_gen ( ) ) @@ fun config -> match Proxy_server_config ...
let ( ) = Alcotest . run " Proxy_server_config " [ ( " union_right_bias " , Qcheck_helpers . qcheck_wrap UnionRightBias . [ reflexive ; right_bias ; associative ; disjoint_commutative ] ) ; ( " example " , [ Alcotest . test_case " [ example_config ] is successfully parsed and validated " ` Quick test_example ; ] ) ; ( ...
module Setup : sig val shares : Pvss . Encrypted_share . t list val commitments : Pvss . Commitment . t list val proof : Pvss . proof val secret_scalar : Sp . Group . Scalar . t val secret : Pvss . Secret_key . t val public_secret : Pvss . Public_key . t val other_shares : Pvss . Encrypted_share . t list val other_comm...
let test_dealer_proof ( ) = let shr = ( Setup . shares , Setup . other_shares ) and cmt = ( Setup . commitments , Setup . other_commitments ) and prf = ( Setup . proof , Setup . other_proof ) in for i = 0 to 1 do for j = 0 to 1 do for k = 0 to 1 do let pick = function 0 -> fst | _ -> snd in assert ( Pvss . check_dealer...
module Proof = struct module G = Sp . Group type exponent = G . Scalar . t type proof = exponent * exponent list type t = proof let encoding = Data_encoding . ( tup2 G . Scalar . encoding ( list G . Scalar . encoding ) ) let mangle : t -> t = fun ( e , es ) -> ( G . Scalar . ( mul e e ) , es ) end
let test_invalid_dealer_proof ( ) = let proof : Proof . t = Setup . convert_encoding Pvss . proof_encoding Proof . encoding Setup . proof in let mangled = Proof . mangle proof |> Setup . convert_encoding Proof . encoding Pvss . proof_encoding in assert ( not ( Pvss . check_dealer_proof Setup . shares Setup . commitment...
let test_share_reveal ( ) = let shares_valid = List . map2 ( fun ( share , ( reveal , proof ) ) public_key -> Pvss . check_revealed_share share reveal ~ public_key proof ) Setup . reveals Setup . public_keys in List . iteri ( fun i b -> print_endline ( string_of_int i ) ; assert b ) shares_valid
module Encrypted_share = struct include Sp . Group let mangle : t -> t = fun share -> Sp . Group . ( share + share ) end
let test_invalid_share_reveal ( ) = let mangle_share : Pvss . Encrypted_share . t -> Pvss . Encrypted_share . t = fun share -> let share : Encrypted_share . t = Setup . convert_encoding Pvss . Encrypted_share . encoding Encrypted_share . encoding share in Encrypted_share . mangle share |> Setup . convert_encoding Encry...
let test_reconstruct ( ) = let indices = [ 0 ; 1 ; 2 ; 3 ; 4 ] in let reconstructed = Pvss . reconstruct ( List . map ( fun n -> let ( _ , ( r , _ ) ) = List . nth Setup . reveals n in r ) indices ) indices in assert ( Sp . Group . ( ( = ) ) ( Setup . convert_encoding Pvss . Public_key . encoding Setup . group_encoding...
let test_invalid_reconstruct ( ) = let indices = [ 0 ; 1 ; 2 ; 3 ] in let reconstructed = Pvss . reconstruct ( List . map ( fun n -> let ( _ , ( r , _ ) ) = List . nth Setup . reveals n in r ) indices ) indices in assert ( Setup . convert_encoding Pvss . Public_key . encoding Setup . group_encoding reconstructed != Set...
let test_randomness_commitment_protocol ( ) = let threshold = 3 in let bakers = Setup . random_keypairs 30 in let endorsers = [ 0 ; 1 ; 2 ; 3 ; 4 ; 5 ; 6 ; 7 ; 8 ; 9 ] in let endorsers_public_keys = List . map ( fun endorser -> ( List . nth bakers endorser ) . Setup . public_key ) endorsers in let ( secret_nonce , publ...
let tests = [ ( " pvss " , [ ( " dealer proof " , ` Quick , test_dealer_proof ) ; ( " invalid dealer proof " , ` Quick , test_invalid_dealer_proof ) ; ( " reveal " , ` Quick , test_share_reveal ) ; ( " invalid reveal " , ` Quick , test_invalid_share_reveal ) ; ( " reconstruct " , ` Quick , test_reconstruct ) ; ( " inva...
module Interface ( R : Idl . RPC ) RPC = struct open R type exns = | Error1 of string | Error2 of ( int * bool ) bool | Error3 of ( int * bool * string ) string [ @@ deriving rpcty ] rpcty exception Calc_error of exns let errors = let open Idl . Error in { def = exns ; raiser = ( fun e -> Calc_error e ) e ; matcher = (...
module IfCode = Interface ( Codegen . Gen ( ) )
let interfaces = Codegen . Interfaces . create ~ name " : test_interface " ~ title " : Test Interface " ~ description [ : { | Test Interface for integer arithmetic } | ] ~ interfaces [ : IfCode . implementation ( ) ]
let gen_python_bindings file = let oc = open_out file in output_string oc ( Pythongen . of_interfaces interfaces |> Pythongen . string_of_ts ) string_of_ts ; close_out oc
let run_cmd msg cmd = print_endline cmd ; Alcotest ( . check int ) int msg 0 ( Sys . command cmd ) cmd
let run_linters file = run_cmd " pylint should exit with 0 " ( " pylint \ -- disable = line - too - long , too - few - public - methods , unused - argument , no - self - use , invalid - name , broad - except , protected - access , redefined - builtin , useless - object - inheritance , super - with - arguments , conside...
let lint_bindings ( ) = let file = " python / bindings . py " in gen_python_bindings file ; run_linters file
let run ? input cmd = print_endline cmd ; let inp , out = Unix . open_process cmd in ( match input with | Some input -> output_string out input | None -> ( ) ) ; close_out out ; let l = input_line inp in close_in inp ; l |> String . trim
let test_commandline ( ) = gen_python_bindings " python / calc_impl / bindings . py " ; let run ? input cmd = run ? input ( " python python / calc_impl " / ^ cmd ) cmd in let n = run " Calc . add 4 5 " in Alcotest ( . check string ) string " Calc . add with parameters passed on the command line " " 9 " n ; let n = run ...
let check_test_class ( ) = gen_python_bindings " python / calc_test / bindings . py " ; let run ? input cmd = run ? input ( " python python / calc_test " / ^ cmd ) cmd in run " Calc . add 4 5 " |> ignore ; run ~ input { { " :| int1 " : 3 , " int2 " : 2 } 2 } | " Calc . add -- json " |> ignore ; run " Calc . land false ...
let check_exceptions ( ) = gen_python_bindings " python / bindings . py " ; run_cmd " Exceptions should be correctly generated " " python python / exn_test . py "
let tests = [ ( " Check generated test interface bindings with pylint & pycodestyle " , ` Slow , lint_bindings ) ; " Check generated commandline bindings " , ` Slow , test_commandline ; " Check generated test class with commandline bindings " , ` Slow , check_test_class ; " Cehck generated exceptions " , ` Slow , check...
let known_ok_tez_literals = [ ( 0L , " 0 " ) ; ( 10L , " 0 . 00001 " ) ; ( 100L , " 0 . 0001 " ) ; ( 1_000L , " 0 . 001 " ) ; ( 10_000L , " 0 . 01 " ) ; ( 100_000L , " 0 . 1 " ) ; ( 1_000_000L , " 1 " ) ; ( 10_000_000L , " 10 " ) ; ( 100_000_000L , " 100 " ) ; ( 1_000_000_000L , " 1000 " ) ; ( 10_000_000_000L , " 10000...
let known_bad_tez_literals = [ " 10000 . " ; " 100 , . " ; " 100 , " ; " 1 , 0000 " ; " 0 . 0000 , 1 " ; " 0 . 00 , 1 " ; " 0 , 1 " ; " HAHA " ; " 0 . 000 , 000 , 1 " ; " 0 . 0000000 " ; " 9 , 999 , 999 , 999 , 999 . 999 , 999 " ; ]
let fail expected given msg = Format . kasprintf Stdlib . failwith " [ @% s @ expected : % s @ got : % s ] " @ msg expected given