Stateful.RuleOne possible action in a sequential stateful test.
Declares a rule.
name is printed in the final output when the rule is run.weight is a hint of how frequently the rule should be run. The default weight is 1.0, and weights must be finite and strictly positive.step tc state performs one application of the rule, drawing any arguments it needs from tc and updating state in place. tc is valid only for that step.With the PPX, a rule takes the following option: [@@rule { weight = ... }].
let push =
Stateful.Rule.create
~name:"push"
~step:(fun tc stack ->
let n = draw tc (integers ~min_value:0 ~max_value:100 ()) in
stack := n :: !stack)
()
;;val name : _ t -> stringReturns the name of the rule.
let label = Stateful.Rule.name pushval weight : _ t -> floatReturns the weight of the rule