text stringlengths 0 601k |
|---|
type nostrict = { nostrict_field : int ; } |
let test_nostrict _ctxt = assert_equal ~ printer ( : show_error_or pp_nostrict ) pp_nostrict ( Result . Ok { nostrict_field = 42 } ) ( nostrict_of_yojson ( ` Assoc [ " nostrict_field " , ( ` Int 42 ) 42 ; " some_other_field " , ( ` Int 43 ) 43 ] 43 ) 43 ) 43 |
module Opentype : sig type ' a opentype = . . [ @@ deriving yojson ] yojson type ' a opentype += A of ' a | B of string list [ @@ deriving yojson ] yojson end = struct type ' a opentype = . . [ @@ deriving yojson ] yojson type ' a opentype += A of ' a | B of string list [ @@ deriving yojson ] yojson end |
type ' a Opentype . opentype += | C of ' a Opentype . opentype * float | A = Opentype . A [ @@ deriving yojson ] yojson |
let rec pp_opentype f fmt = function A x -> Format . fprintf fmt " A ( A % s ) s " ( f x ) x Format . pp_print_string fmt " C ( C " ; pp_opentype f fmt x ; Format . fprintf fmt " , % f ) f " v |
let test_opentype _ctxt = let pp_ot = pp_opentype string_of_int in let to_yojson = Opentype . opentype_to_yojson i1_to_yojson in let of_yojson = Opentype . opentype_of_yojson i1_of_yojson in assert_roundtrip pp_ot to_yojson of_yojson ( Opentype . A 0 ) 0 [ " " \ A " , \ 0 ] 0 " ; assert_roundtrip pp_ot to_yojson of_yoj... |
type outer_t = int [ @@ deriving yojson ] yojson |
module Automatic_deriving_in_signature_only : sig type t [ @@ deriving yojson ] yojson end = struct type t = int let of_yojson = outer_t_of_yojson let to_yojson = outer_t_to_yojson end |
module Warnings = struct module W34 = struct [ @@@ ocaml . warning " @ 34 ] " module M1 : sig type u [ @@ deriving yojson ] yojson end = struct type internal = int list [ @@ deriving yojson ] yojson type u = int list [ @@ deriving yojson ] yojson end module M2 : sig type ' a u [ @@ deriving yojson ] yojson end = struct... |
module TestShadowing = struct module List = struct let map ( ) = ( ) end type t = int list [ @@ deriving yojson ] yojson module Array = struct let to_list ( ) = ( ) end module Bytes = struct let to_string ( ) = ( ) end type v = bytes [ @@ deriving yojson ] yojson end |
module Test_extension_forms = struct let _ = [ % to_yojson : unit ] unit , [ % of_yojson : unit ] unit let _ = [ % to_yojson : int ] int , [ % of_yojson : int ] int let _ = [ % to_yojson : int32 ] int32 , [ % of_yojson : int32 ] int32 let _ = [ % to_yojson : Int32 . t ] t , [ % of_yojson : Int32 . t ] t let _ = [ % to_... |
module Test_exn_depends_on_non_exn = struct module M : sig type t [ @@ deriving yojson { exn = false } ] end = struct type t = int [ @@ deriving yojson { exn = false } ] end open M type u = t * t [ @@ deriving yojson { exn = true } ] end |
module Test_recursive_polyvariant = struct type a = [ ` B of string ] [ @@ deriving of_yojson ] of_yojson type b = [ a | ` C of b list ] list [ @@ deriving of_yojson ] of_yojson type c = [ a | b | ` D of b list ] list [ @@ deriving of_yojson ] of_yojson let c_of_yojson yj : c Ppx_deriving_yojson_runtime . error_or = c_... |
type ' a recursive1 = { lhs : string ; rhs : ' a } and foo = unit recursive1 and bar = int recursive1 [ @@ deriving show , yojson ] yojson |
let test_recursive _ctxt = assert_roundtrip ( pp_recursive1 pp_i1 ) pp_i1 ( recursive1_to_yojson i1_to_yojson ) i1_to_yojson ( recursive1_of_yojson i1_of_yojson ) i1_of_yojson { lhs " = x " ; rhs = 42 } 42 { " " \ lhs " " \:\ x " , " \\ rhs " \: 42 } 42 " ; assert_roundtrip pp_foo foo_to_yojson foo_of_yojson { lhs " = ... |
let test_int_redefined ctxt = let module M = struct type int = Break_things let x = [ % to_yojson : int ] int 1 end in let expected = ` Int 1 in assert_equal ~ ctxt ~ printer : show_json expected M . x |
let test_equality_redefined ctxt = let module M = struct module Pervasives = struct let ( ) = : int -> int -> bool = fun a b -> a = b let _ = 1 = 1 let never_gonna_be_in_pervasives = None end let ( ) = : int -> int -> bool = fun a b -> a = b let _ = 1 = 1 type t = { field : int option [ @ default Pervasives . never_gon... |
module Sanitize = struct module Result = struct type t = MyResult [ @@ deriving yojson ] yojson end type result_list = Result . t list [ @@ deriving yojson ] yojson module List = struct let x = [ 1 ; 2 ] 2 end type t = { field : int list [ @ default List . x ] x } x [ @@ deriving to_yojson ] to_yojson type t2 = { my : ... |
let suite = " Test ppx_yojson " >::: [ " test_unit " >:: test_unit ; " test_int " >:: test_int ; " test_int_edge " >:: test_int_edge ; " test_float " >:: test_float ; " test_bool " >:: test_bool ; " test_char " >:: test_char ; " test_string " >:: test_string ; " test_ref " >:: test_ref ; " test_option " >:: test_option... |
let _ = run_test_tt_main suite |
let init_genesis ? policy ( ) = Context . init ~ consensus_threshold : 0 5 >>=? fun ( genesis , _ ) -> Block . bake ? policy genesis >>=? fun b -> return ( genesis , b ) |
let test_consensus_operation_preendorsement_for_future_level ( ) = init_genesis ( ) >>=? fun ( genesis , pred ) -> let raw_level = Raw_level . of_int32 ( Int32 . of_int 10 ) in let level = match raw_level with Ok l -> l | Error _ -> assert false in Consensus_helpers . test_consensus_operation ~ loc : __LOC__ ~ is_preen... |
let test_consensus_operation_preendorsement_for_old_level ( ) = init_genesis ( ) >>=? fun ( genesis , pred ) -> let raw_level = Raw_level . of_int32 ( Int32 . of_int 0 ) in let level = match raw_level with Ok l -> l | Error _ -> assert false in Consensus_helpers . test_consensus_operation ~ loc : __LOC__ ~ is_preendors... |
let test_consensus_operation_preendorsement_for_future_round ( ) = init_genesis ( ) >>=? fun ( genesis , pred ) -> Environment . wrap_tzresult ( Round . of_int 21 ) >>?= fun round -> Consensus_helpers . test_consensus_operation ~ loc : __LOC__ ~ is_preendorsement : true ~ endorsed_block : pred ~ round ~ error_title " :... |
let test_consensus_operation_preendorsement_for_old_round ( ) = init_genesis ~ policy ( : By_round 10 ) ( ) >>=? fun ( genesis , pred ) -> Environment . wrap_tzresult ( Round . of_int 0 ) >>?= fun round -> Consensus_helpers . test_consensus_operation ~ loc : __LOC__ ~ is_preendorsement : true ~ endorsed_block : pred ~ ... |
let test_consensus_operation_preendorsement_on_competing_proposal ( ) = init_genesis ( ) >>=? fun ( genesis , pred ) -> Consensus_helpers . test_consensus_operation ~ loc : __LOC__ ~ is_preendorsement : true ~ endorsed_block : pred ~ block_payload_hash : Block_payload_hash . zero ~ error_title " : Consensus operation o... |
let test_unexpected_preendorsements_in_blocks ( ) = init_genesis ( ) >>=? fun ( genesis , pred ) -> Consensus_helpers . test_consensus_operation ~ loc : __LOC__ ~ is_preendorsement : true ~ endorsed_block : pred ~ error_title " : unexpected preendorsement in block " ~ context ( : Context . B genesis ) ( ) |
let test_too_high_round ( ) = init_genesis ( ) >>=? fun ( genesis , pred ) -> let raw_level = Raw_level . of_int32 ( Int32 . of_int 2 ) in let level = match raw_level with Ok l -> l | Error _ -> assert false in Environment . wrap_tzresult ( Round . of_int 1 ) >>?= fun round -> Consensus_helpers . test_consensus_operati... |
let test_duplicate_preendorsement ( ) = init_genesis ( ) >>=? fun ( genesis , _ ) -> Block . bake genesis >>=? fun b -> Incremental . begin_construction ~ mempool_mode : true b >>=? fun inc -> Op . preendorsement ~ endorsed_block : b ( B genesis ) ( ) >>=? fun operation -> let operation = Operation . pack operation in ... |
let test_preendorsement_for_next_level ( ) = init_genesis ( ) >>=? fun ( genesis , _ ) -> Consensus_helpers . test_consensus_op_for_next ~ genesis ~ kind ` : Preendorsement ~ next ` : Level |
let test_preendorsement_for_next_round ( ) = init_genesis ( ) >>=? fun ( genesis , _ ) -> Consensus_helpers . test_consensus_op_for_next ~ genesis ~ kind ` : Preendorsement ~ next ` : Round |
let tests = let module AppMode = Test_preendorsement_functor . BakeWithMode ( struct let name = " AppMode " let baking_mode = Block . Application end ) in let module ConstrMode = Test_preendorsement_functor . BakeWithMode ( struct let name = " ConstrMode " let baking_mode = Block . Baking end ) in AppMode . tests @ Con... |
module type MODE = sig val name : string val baking_mode : Block . baking_mode end |
module BakeWithMode ( Mode : MODE ) : sig val tests : unit Alcotest_lwt . test_case trace let name = Mode . name let bake = Block . bake ~ baking_mode : Mode . baking_mode let aux_simple_preendorsement_inclusion ( ? payload_round = Some Round . zero ) ( ? locked_round = Some Round . zero ) ( ? block_round = 1 ) ( ? pre... |
type bigstring = ( char , int8_unsigned_elt , c_layout ) Array1 . t |
let create_untagged_int_ref init_val = alloc_untagged_int_ref init_val |> EP . create |
let create_unboxed_float_ref init_val = alloc_unboxed_float_ref init_val |> EP . create : int -> NP . t = " external_untagged_int_ref_as_native_pointer " : float -> NP . t = " external_unboxed_float_ref_as_native_pointer " |
module T = struct type temporal_locality = P . temporal_locality = | None | Low | Moderate | High [ @@ deriving sexp , enumerate ] type operation = P . operation = | Read | Write [ @@ deriving sexp , enumerate ] end |
let ints = List . init len ~ f ( : fun _ -> Random . int Int . max_value ) |
let floats = List . init len ~ f ( : fun _ -> Random . float Float . max_value ) |
let int_refs = List . map ints ~ f : create_untagged_int_ref |
let float_refs = List . map floats ~ f : create_unboxed_float_ref |
let int_refs_as_native_pointer = List . map ints ~ f : create_untagged_int_ref_as_native_pointer ; ; |
let float_refs_as_native_pointer = List . map floats ~ f : create_unboxed_float_ref_as_native_pointer ; ; |
let bigstring_of_string s = let a = Array1 . create char c_layout ( String . length s ) in for i = 0 to String . length s - 1 do a . { i } <- s . [ i ] done ; a ; ; |
let bigstring = bigstring_of_string ( String . make 500 ' \ x00 ' ) |
let positions = [ 0 ; 1 ; 2 ; 3 ; 4 ; 5 ; 6 ; 7 ; 8 ; 9 ; 10 ; 16 ; 32 ; 64 ; 256 ] List . iter all_of_operation ~ f ( : fun operation -> List . iter all_of_temporal_locality ~ f ( : fun temporal_locality -> printf " { !% sexp : operation } { % sexp : temporal_locality } \ n " operation temporal_locality ; let test_int... |
let ocaml_keywords = [ " and " ; " as " ; " assert " ; " asr " ; " begin " ; " class " ; " constraint " ; " do " ; " done " ; " downto " ; " else " ; " end " ; " exception " ; " external " ; " false " ; " for " ; " fun " ; " function " ; " functor " ; " if " ; " in " ; " include " ; " inherit " ; " initializer " ; " la... |
let ocaml_spec_chars = [ ' ' ; ! ' ' ; $ ' ' ; % ' ' ; & ' ' ; * ' ' ; + ' ' ; - ' . ' ; ' ' ; / ' ' ; : ' ; ' ; ' ' ; < ' ' ; = ' ' ; > ' ' ; ? ' ' ; @ ' ' ; ^ ' ' ; | ' ' ; ~ ' ' ; # ' " ' ; \ ' ( ' ; ' ) ' ; ' , ' ; ' [ ' ; ' ] ' ; ' { ' ; ' } ' ] |
let ocaml_comments_info = { single_comment = " " ; multi_comment_start = " " ; nest = true ; strings = true ; } |
let java_keywords = [ " abstract " ; " continue " ; " for " ; " new " ; " switch " ; " assert " ; " default " ; " package " ; " synchronized " ; " boolean " ; " do " ; " if " ; " private " ; " this " ; " break " ; " double " ; " implements " ; " protected " ; " throw " ; " byte " ; " else " ; " import " ; " public " ; ... |
let java_spec_chars = [ ' ' ; ! ' ' ; $ ' ' ; % ' ' ; & ' ' ; * ' ' ; + ' ' ; - ' . ' ; ' ' ; / ' ' ; : ' ; ' ; ' ' ; < ' ' ; = ' ' ; > ' ' ; ? ' ' ; ^ ' ' ; | ' " ' ; \ ' ' ' ; \ ' ( ' ; ' ) ' ; ' , ' ; ' [ ' ; ' ] ' ; ' { ' ; ' } ' ; ' ' ; ~ ' ' ] @ |
let java_comments_info = { single_comment = " " ; // multi_comment_start = " " ; /* multi_comment_end = " " ; */ nest = false ; strings = true ; } |
let test_fun_str = " ) * quite the comment ) * let split_and_keep_on_spec_chars spec_chars str = let char_array = str_to_chr_arr str in ( List . fold_left ( fun acc_arr chr -> let str_of_chr = String . make 1 chr in if List . mem chr spec_chars then List . cons " " \\ ( List . cons str_of_chr acc_arr ) else match acc_a... |
let expected_res_str = String . concat " " [ " letvvv = letv = vvin ( List . v ( funvv -> letv = String . v1vinifList . vvvthenList . v " ; " ( List . vvv ) elsematchvwith | v :: v ( -> String . v [ v ; v ] ) :: v [ ] |-> failwithv " ; " ) [ ] v ) |> List . v ( funv -> v ) <>|> List . v " ] |
let test_fun_str4 = " wow " " \ ocaml_keywords ocaml_spec_chars false ) " letv = vinletv = 5inv " ) ; " remove_noise_9 " >:: ( fun _ -> assert_equal ( remove_noise ocaml_comments_info " let x = ' y ' " ocaml_keywords ocaml_spec_chars false ) " letv = v " ) ; ] |
let normalized_sexp t = let rec of_t = function | Normalize . Sexp ( sexp , _ ) -> Some ( of_sexp sexp ) | Normalize . Comment _ -> None and of_sexp = function | Normalize . Atom str -> Sexp . Atom str | Normalize . List ts -> Sexp . List ( of_t_list ts ) and of_t_list ts = List . filter_map ts ~ f : of_t in match of_t... |
let normalize conf sexp = sexp |> sexp_to_sexp_or_comment |> Normalize . of_sexp_or_comment conf |> normalized_sexp ; ; |
let conf = { Config . default with Config . atom_printing = Interpreted } |
let test ~ input : input_sexp sexp = [ % test_result : Sexp . t ] ~ expect : sexp ( normalize conf input_sexp ) ; ; let atom = Sexp . Atom " Not connected to oculus monitor " in test ~ input : atom atom ; ; test ~ input ( : Sexp . Atom " Not connected to oculus monitor ( connect to monitor please ) " ) ( List [ Atom " ... |
let conf = { Config . default with Config . atom_printing = Escaped } |
let test ~ input : input_sexp sexp = [ % test_result : Sexp . t ] ~ expect : sexp ( normalize conf input_sexp ) ; ; let atom = Sexp . Atom " Not connected to oculus monitor " in test ~ input : atom atom ; ; let sexp = Sexp . Atom " ( this is a ( bona fide ) sexp ) " in test ~ input : sexp sexp ; ; let sexp = Sexp . Ato... |
let test ( ? sticky_comments = Sexp_pretty . Config . default . sticky_comments ) ( ? atom_printing = Sexp_pretty . Config . default . atom_printing ) string = let lexbuf = Lexing . from_string string in let next ( ) = Option . try_with ( fun ( ) -> Sexp . With_layout . Parser . sexp Sexp . With_layout . Lexer . main l... |
let conf = { ( Config . create ~ color : false ( ) ) with Config . atom_printing = Minimal_escaping } ; ; let sexp = Sexp . Atom ( String . concat ~ sep " :\ n " ( List . init 10 ~ f : Int . to_string ) ) in let pretty = pretty_string conf sexp in print_endline pretty ; [ % expect { | " 0 1 2 3 4 5 6 7 8 9 " } ] ; | [ ... |
let test_safe_decode ( ) = let exception Custom_exception of string in let broken_encoding = Data_encoding . conv Fun . id ( fun _ -> raise ( Custom_exception " Should not leave the function scope " ) ) Data_encoding . unit in let actual = Prevalidation . Internal_for_tests . safe_binary_of_bytes broken_encoding Bytes ... |
module Parameters : Requester_impl . PARAMETERS with type key = Operation_hash . t and type value = int = struct type key = Operation_hash . t type value = int end |
module Hash : Requester . HASH with type t = Operation_hash . t = struct type t = Parameters . key let name = " test_with_key_Operation_hash_dot_t " let encoding = Operation_hash . encoding let pp = Operation_hash . pp end |
module Test_request = Requester_impl . Simple_request ( Parameters ) |
module Test_disk_table = Requester_impl . Disk_memory_table ( Parameters ) |
module Test_Requester = Requester_impl . Make_memory_full_requester ( Hash ) ( Parameters ) ( Test_request ) |
let init_full_requester_disk ? global_input ( ) : Test_Requester . t * Test_Requester . store = let ( st : Test_Requester . store ) = Test_disk_table . create 16 in let requester = Test_Requester . create ? global_input ( ) st in ( requester , st ) |
let init_full_requester ? global_input ( ) : Test_Requester . t = fst ( init_full_requester_disk ? global_input ( ) ) |
let mk_operation n : Operation . t = let base = " BLuxtLkkNKWgV8xTzBuGcHJRPukgk4nY " in let base_len = String . length base in let n_string = Int . to_string n in let n_string_len = String . length n_string in assert ( 0 <= n_string_len && n_string_len <= String . length base ) ; let base_prefix = String . sub base 0 (... |
let test_db_leak f ( nb_ops : int ) ( _ : unit ) = let requester = init_full_requester ( ) in let max_table_size = 32 in assert ( nb_ops >= max_table_size ) ; let parameters = Classification . { map_size_limit = max_table_size ; on_discarded_operation = Test_Requester . clear_or_cancel requester ; } in let classes = Cl... |
let test_in_mempool_leak f ( nb_ops : int ) ( _ : unit ) = let requester = init_full_requester ( ) in let max_table_size = 32 in assert ( nb_ops >= max_table_size ) ; let parameters = Classification . { map_size_limit = max_table_size ; on_discarded_operation = Test_Requester . clear_or_cancel requester ; } in let clas... |
let test_db_do_not_clear_right_away f ( nb_ops : int ) ( _ : unit ) = let requester = init_full_requester ( ) in let max_table_size = 32 in assert ( nb_ops >= max_table_size ) ; let parameters = Classification . { map_size_limit = max_table_size ; on_discarded_operation = Test_Requester . clear_or_cancel requester ; } ... |
let ( ) = let nb_ops = [ 64 ; 128 ] in let handle_refused_pair = [ ( ( fun tztrace -> Classification . add ( ` Refused tztrace ) ) , " handle_refused " ) ; ( ( fun tztrace -> Classification . add ( ` Outdated tztrace ) ) , " handle_outdated " ) ; ] in let handle_branch_pairs = [ ( ( fun tztrace -> Classification . add ... |
module Mock_protocol : Tezos_protocol_environment . PROTOCOL with type operation_data = unit and type operation_receipt = unit and type validation_state = unit = struct include Environment_protocol_T_test . Internal_for_tests . Mock_all_unit let begin_construction ~ chain_id : _ ~ predecessor_context : _ ~ predecessor_... |
module Init = struct let genesis_protocol = Protocol_hash . of_b58check_exn " ProtoDemoNoopsDemoNoopsDemoNoopsDemoNoopsDemo6XBoYp " let chain_id = Chain_id . zero let genesis_time = Time . Protocol . of_seconds 0L let wrap_tzresult_lwt ( f : Context . t -> unit tzresult Lwt . t ) ( ) : unit tzresult Lwt . t = Lwt_utils... |
let create_prevalidation ( module Mock_protocol : Tezos_protocol_environment . PROTOCOL with type operation_data = unit and type operation_receipt = unit and type validation_state = unit ) ctxt = let module Chain_store : Internal_for_tests . CHAIN_STORE with type chain_store = unit = struct type chain_store = unit let ... |
let now ( ) = Time . System . to_protocol ( Tezos_stdlib_unix . Systime_os . now ( ) ) |
let test_create ctxt = let live_operations = Operation_hash . Set . empty in let timestamp : Time . Protocol . t = now ( ) in let ( module Prevalidation ) = create_prevalidation ( module Mock_protocol ) ctxt in let predecessor : Store . Block . t = Init . genesis_block @@ Context . hash ~ time : timestamp ctxt in Preva... |
let prevalidation_operations_gen ( type a ) ( module P : Prevalidation . T with type protocol_operation = a ) ( ~ n : int ) : a Prevalidation . operation list QCheck2 . Gen . t = let mk_operation ( hash , ( raw : Operation . t ) ) : P . protocol_operation Prevalidation . operation = match P . parse hash raw with | Ok x... |
let mk_ops ( type a ) ( module P : Prevalidation . T with type protocol_operation = a ) : a Prevalidation . operation list = let ops = QCheck2 . Gen . generate1 ( prevalidation_operations_gen ( module P ) ~ n : nb_ops ) in assert ( Compare . List_length_with . ( ops = nb_ops ) ) ; ops |
let test_apply_operation_crash ctxt = let live_operations = Operation_hash . Set . empty in let timestamp : Time . Protocol . t = now ( ) in let ( module P ) = create_prevalidation ( module Mock_protocol ) ctxt in let ops : P . protocol_operation Prevalidation . operation list = mk_ops ( module P ) in let predecessor :... |
let ( ==> ) a b = ( not a ) || b |
let mk_rand ( ) = QCheck2 . Gen . generate ~ n : 8 QCheck2 . Gen . int |> Array . of_list |> Random . State . make |
let mk_live_operations ( type a ) rand ( ops : a Prevalidation . operation list ) = List . fold_left ( fun acc ( op : _ Prevalidation . operation ) -> if Random . State . bool rand then Operation_hash . Set . add ( Internal_for_tests . to_raw op |> Operation . hash ) acc else acc ) Operation_hash . Set . empty ops |
let test_apply_operation_live_operations ctxt = let timestamp : Time . Protocol . t = now ( ) in let rand : Random . State . t = mk_rand ( ) in let ( module Protocol : Tezos_protocol_environment . PROTOCOL with type operation_data = unit and type operation_receipt = unit and type validation_state = unit ) = ( module st... |
let test_apply_operation_applied ctxt = let timestamp : Time . Protocol . t = now ( ) in let rand : Random . State . t = mk_rand ( ) in let ( module Protocol : Tezos_protocol_environment . PROTOCOL with type operation_data = unit and type operation_receipt = unit and type validation_state = unit ) = ( module struct inc... |
let ( ) = Alcotest_lwt . run " mempool - prevalidation " [ ( " create " , [ Tztest . tztest " [ create ] returns Ok " ` Quick ( Init . wrap_tzresult_lwt test_create ) ; ] ) ; ( " apply_operation " , [ Tztest . tztest " [ apply_operation ] returns [ Branch_delayed ] when [ apply_operation ] \ from the protocol crashes "... |
let is_in_mempool oph t = Classification . is_in_mempool oph t <> None |
module Operation_map = struct let pp_with_trace ppf map = Format . fprintf ppf " [ % a ] " ( Format . pp_print_list ( fun ppf ( oph , ( op , _tztrace ) ) -> Format . fprintf ppf " ( % a : ( % a , < tztrace ) ) " > Operation_hash . pp oph Operation . pp op . Prevalidation . raw ) ) ( Operation_hash . Map . bindings map ... |
type classification_event = | Add_if_not_present of Classification . classification * unit Prevalidation . operation | Remove of Operation_hash . t | Flush of bool |
let drop oph t = let open Classification in let ( _ : ( unit Prevalidation . operation * classification ) option ) = remove oph t in ( ) |
let play_event event t = let open Classification in match event with | Add_if_not_present ( classification , op ) -> Generators . add_if_not_present classification op t | Remove oph -> drop oph t | Flush handle_branch_refused -> Internal_for_tests . flush ~ handle_branch_refused t |
module Extra_generators = struct open Classification let event_gen t = let open QCheck2 . Gen in let add_gen = let + ( classification , op ) = pair Generators . classification_gen ( Generators . operation_with_hash_gen ( ) ) in Add_if_not_present ( classification , op ) in let remove_gen = let + op = Generators . with_... |
let qcheck_eq_true ~ actual = let _ = qcheck_eq ' ~ pp : Format . pp_print_bool ~ expected : true ~ actual ( ) in ( ) |
let qcheck_eq_false ~ actual = let _ = qcheck_eq ' ~ pp : Format . pp_print_bool ~ expected : false ~ actual ( ) in ( ) |
let qcheck_bounded_map_is_empty bounded_map = let actual = bounded_map |> Classification . map |> Operation_hash . Map . is_empty in qcheck_eq_true ~ actual |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.