An interface-only OCaml package. Stm_spec.S describes a pure state transition and its requested output instructions. Stm_spec.TEST extends it with preconditions, postconditions and a state-dependent QCheck input generator.
For OCaml, build with dune build -p stm_spec @install or install with opam install ./stm_spec.opam. Add stm_spec to your Dune libraries and package dependencies, then use include Stm_spec.S or include Stm_spec.TEST.
For Melange, build with dune build -p stm_spec_melange @install or install with opam install ./stm_spec_melange.opam. Add stm_spec_melange to your Dune libraries and package dependencies, then use include Stm_spec_melange.S. Both packages use the same reducer signature. The QCheck contract is available through the OCaml package.
A network timeout requests a resend; an acknowledgement completes delivery. The reducer never sends a request itself. See the business interface and the test interface for how to include the signatures while sharing types.
Build the private example library from the repository root with dune build examples/delivery_example.cma. It has no executable and is not installed. Within this Dune project, a consumer can add (libraries delivery_example) and use the wrapped modules directly:
module Machine = Delivery_example.State_machine
module Contract = Delivery_example.Test_contract
let check_timeout state =
let transition = Machine.step state Machine.Timeout in
Contract.postcond state Machine.Timeout transition