123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105(** Produce unit tests for blittable values. *)open!Baseopen!BlitmoduletypeElt=sigtypetvalequal:t->t->bool(** [of_bool] is used to generate two distinct values of type [t], used in unit tests.
It is required that [of_bool false <> of_bool true]. *)valof_bool:bool->tendmoduletypeElt1=sigtype'atvalequal:boolt->boolt->boolvalof_bool:bool->booltendmoduletypeSequence=sigtypettypeeltvalcreate:len:int->tvallength:t->intvalget:t->int->eltvalset:t->int->elt->unitendtype'apoly='amoduletypeSequence1=sigtype'at(** [Make1*] guarantees to only call [create_like ~len t] with [len > 0] if [length t >
0]. *)vallength:_t->int(** [create_bool], [get], and [set] are just used for unit tests. [z] is needed for
[Flat_tuple_array], [elt] is needed for [Option_array]. *)type'aztype'aeltvalcreate_bool:len:int->boolztvalget:'azt->int->'aeltvalset:'azt->int->'aelt->unitendmoduletypeTest_blit=sigmoduletypeElt=EltmoduletypeElt1=Elt1moduletypeSequence=SequencemoduletypeSequence1=Sequence1moduleTest(Elt:Elt)(Sequence:Sequencewithtypeelt:=Elt.t)(Tested:Swithtypet:=Sequence.t):sigendmoduleTest_distinct(Elt:Elt)(Src:Sequencewithtypeelt:=Elt.t)(Dst:Sequencewithtypeelt:=Elt.t)(Tested:S_distinctwithtypesrc:=Src.twithtypedst:=Dst.t):sigendmoduleTest1(Sequence:Sequence1withtype'aelt:='apoly)(Tested:S1withtype'at:='aSequence.t):sigendmoduleTest1_generic(Elt:Elt1)(Sequence:Sequence1withtype'aelt:='aElt.t)(Tested:S1withtype'at:='aSequence.t):sigend(** [Make_and_test] uses the [Blit.Make] functor and the [Test] functor. *)moduleMake_and_test(Elt:Elt)(Sequence:sigincludeSequencewithtypeelt:=Elt.tvalunsafe_blit:(t,t)blitend):Swithtypet:=Sequence.tmoduleMake_distinct_and_test(Elt:Elt)(Src:Sequencewithtypeelt:=Elt.t)(Dst:sigincludeSequencewithtypeelt:=Elt.tvalunsafe_blit:(Src.t,t)blitend):S_distinctwithtypesrc:=Src.twithtypedst:=Dst.tmoduleMake1_and_test(Sequence:sigincludeBlit.Sequence1includeSequence1withtype'at:='atwithtype'aelt:='apolyend):S1withtype'at:='aSequence.tmoduleMake1_generic_and_test(Elt:Elt1)(Sequence:sigincludeBlit.Sequence1includeSequence1withtype'at:='atwithtype'aelt:='aElt.tend):S1withtype'at:='aSequence.tend