Module Expect_test_helpers_kernel
include Expect_test_helpers_kernel__.Expect_test_helpers_kernel_intf.Expect_test_helpers_kernel
include module type of sig ... end
module CR = Expect_test_helpers_base.CRmodule Sexp_style = Expect_test_helpers_base.Sexp_styleval hide_positions_in_string : Base.string -> Base.stringval sexp_to_string : ?hide_positions:Base.bool -> Base.Sexp.t -> Base.stringval print_s : ?hide_positions:Base.bool -> Base.Sexp.t -> Base.unitval print_string : ?hide_positions:Base.bool -> Base.string -> Base.unitval print_endline : ?hide_positions:Base.bool -> Base.string -> Base.unitval print_cr : ?cr:CR.t -> ?hide_positions:Base.bool -> Base.Source_code_position.t -> Base.Sexp.t -> Base.unitval require : ?cr:CR.t -> ?hide_positions:Base.bool -> ?if_false_then_print_s:Base.Sexp.t Base.Lazy.t -> Base.Source_code_position.t -> Base.bool -> Base.unitval require_equal : ?cr:CR.t -> ?hide_positions:Base.bool -> ?if_false_then_print_s:Base.Sexp.t Base.Lazy.t -> ?message:Base.string -> Base.Source_code_position.t -> (module With_equal with type t = 'a) -> 'a -> 'a -> Base.unitval require_compare_equal : ?cr:CR.t -> ?hide_positions:Base.bool -> ?message:Base.string -> Base.Source_code_position.t -> (module With_compare with type t = 'a) -> 'a -> 'a -> Base.unitval require_sets_are_equal : ?cr:CR.t -> ?hide_positions:Base.bool -> ?names:(Base.string * Base.string) -> Base.Source_code_position.t -> (module Set with type t = 'a) -> 'a -> 'a -> Base.unitval show_raise : ?hide_positions:Base.bool -> ?show_backtrace:Base.bool -> (Base.unit -> 'a) -> Base.unitval require_does_not_raise : ?cr:CR.t -> ?hide_positions:Base.bool -> ?show_backtrace:Base.bool -> Base.Source_code_position.t -> (Base.unit -> Base.unit) -> Base.unitval require_does_raise : ?cr:CR.t -> ?hide_positions:Base.bool -> ?show_backtrace:Base.bool -> Base.Source_code_position.t -> (Base.unit -> 'a) -> Base.unitval quickcheck : Base.Source_code_position.t -> ?cr:CR.t -> ?hide_positions:Base.bool -> ?seed:Expect_test_helpers_base__.Expect_test_helpers_base_intf.Quickcheck.Test.Config.Seed.t -> ?sizes:Base.int Base.Sequence.t -> ?trials:Base.int -> ?shrinker:'a Expect_test_helpers_base__.Expect_test_helpers_base_intf.Quickcheck.Shrinker.t -> ?shrink_attempts:Base.int -> ?examples:'a Base.list -> sexp_of:('a -> Base.Sexp.t) -> f:('a -> Base.unit) -> 'a Expect_test_helpers_base__.Expect_test_helpers_base_intf.Quickcheck.Generator.t -> Base.unitval sexp_style : Sexp_style.t Base.refval on_print_cr : (Base.string -> Base.unit) Base.ref
module type With_containers = Expect_test_helpers_kernel__.Expect_test_helpers_kernel_intf.With_containersmodule type With_comparable = Expect_test_helpers_kernel__.Expect_test_helpers_kernel_intf.With_comparablemodule type With_hashable = Expect_test_helpers_kernel__.Expect_test_helpers_kernel_intf.With_hashablemodule Allocation_limit : module type of sig ... endval print_and_check_stable_type : ?cr:CR.t -> ?hide_positions:bool -> ?max_binable_length:int -> Core_kernel.Source_code_position.t -> (module Core_kernel.Stable_without_comparator with type t = 'a) -> 'a list -> unitprint_and_check_stable_typeprints the bin-io digest for the given type, and the bin-io and sexp serializations of the given values. Prints an error message for any serializations that fail to round-trip, and for any bin-io serializations that exceedmax_binable_length.
val print_and_check_stable_int63able_type : ?cr:CR.t -> ?hide_positions:bool -> ?max_binable_length:int -> Core_kernel.Source_code_position.t -> (module Core_kernel.Stable_int63able with type t = 'a) -> 'a list -> unitprint_and_check_stable_int63able_typeworks likeprint_and_check_stable_type, and includesInt63.tserializations.
val prepare_heap_to_count_minor_allocation : unit -> unitprepare_heap_to_count_minor_allocationcallsGcfunctions to setup the heap so that one can subsequently measure minor allocation via:let minor_words_before = Gc.minor_words () in (* ... do stuff ... *) let minor_words_after = Gc.minor_words () in let minor_words_allocated = minor_words_after - minor_words_before in
val require_allocation_does_not_exceed : ?hide_positions:bool -> Allocation_limit.t -> Core_kernel.Source_code_position.t -> (unit -> 'a) -> 'arequire_allocation_does_not_exceedis a specialized form ofrequirethat only produces output whenf ()allocates more than the given limits. The output will include the actual number of major and minor words allocated. We do NOT include these numbers in the successful case because those numbers are not stable with respect to compiler versions and build flags.If
freturns a value that should be ignored, use this idiom:ignore (require_allocation_does_not_exceed ... f : t)rather than this idiom:
require_allocation_does_not_exceed ... (fun () -> ignore (f () : t))With the latter idiom, the compiler may optimize the computation of
f ()taking advantage of the fact that the result is ignored, and eliminate allocation that is intended to be measured. With the former idiom, the compiler cannot do such optimization and must compute the result off ().There is no
?cr:CR.targument, because one should not release a test with a failing call, due to instability across compiler optimization levels. Even if a test allocates too much without much optimization, it may allocate less with more optimization.
val require_no_allocation : ?hide_positions:bool -> Core_kernel.Source_code_position.t -> (unit -> 'a) -> 'arequire_no_allocation here fis equivalent torequire_allocation_does_not_exceed (Minor_words 0) here f.
val print_and_check_container_sexps : ?cr:CR.t -> ?hide_positions:bool -> Core_kernel.Source_code_position.t -> (module With_containers with type t = 'a) -> 'a list -> unitprint_and_check_container_sexpsprints the sexp representation of maps, sets, hash tables, and hash sets based on the given values. For sets and hash sets, prints a CR if the sexp does not correspond to a list of elements. For maps and hash tables, prints a CR if the sexp does not correspond to an association list keyed on elements.
val print_and_check_comparable_sexps : ?cr:CR.t -> ?hide_positions:bool -> Core_kernel.Source_code_position.t -> (module With_comparable with type t = 'a) -> 'a list -> unitprint_and_check_comparable_sexpsis likeprint_and_check_container_sexpsfor maps and sets only.
val print_and_check_hashable_sexps : ?cr:CR.t -> ?hide_positions:bool -> Core_kernel.Source_code_position.t -> (module With_hashable with type t = 'a) -> 'a list -> unitprint_and_check_hashable_sexpsis likeprint_and_check_container_sexpsfor hash tables and hash sets only.
module Expect_test_helpers_kernel_private : sig ... endThis module is called
Expect_test_helpers_kernel_privaterather thanPrivatebecauseinclude Expect_test_helpers_kernelis a common idiom, and we don't want to interfere with otherPrivatemodules or create problems due to multiple definitions ofPrivate.