Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Stateful.InvariantSourceAn invariant is a property that must always be true in a stateful test.
val create :
name:string ->
inv:(test_case -> 'state -> unit) ->
?always_check:bool ->
unit ->
'state tDeclares an invariant.
name is printed in the final output if the test fails on an invariantinv tc state checks the invariant on state. Anything it draws or notes through tc prints indented under the line before it.always_check defaults to false. When true, the invariant is checked after every step. Otherwise, it is sampled.Every invariant is checked on the initial and final states.
let short =
Stateful.Invariant.create
~name:"short"
~inv:(fun _tc stack -> assert (List.length stack < 10))
()
;;