Closed Horusiath closed 4 years ago
Thanks for the PR!
Unfortunately, I'm quite sure what to do with this just yet. I don't really have the bandwidth to dig into this. Could you say a few sentences at a very high level about what this does and how you'd want it integrated into this library? Additionally, is this something that could live in a different crate?
I'm not sure yet - I'd love to get some directions to get deeper insight into how shrinking works and how to integrate them into quickcheck. I'm quite tight on time myself, but would love to finish that contribution (especially given that it'd help me in my daily work).
All righty. I definitely don't have the time to mentor this, sorry. :( I'm going to close this for now, but if you happen to get this into another crate I would be happy to link to this in the README.
This is an initial PR with API for building stateful property-based tests using the
StateMachine<T>
. To bring the issue closer, here are the docs about the same feature implemented in Erlang and F#.API so far was extended by two new structures:
Model
trait which defines 3 functions:run
which mutates current model's state given the generated operationnext
which is supposed to produce new operation to be appliedpre
which is supposed to check if a given operation has any sense in a context of a current model's state.StateMachine<T: Model>
which is just a configurable wrapper around model, which implementsTestable
trait.The minimal case for non-negative counter with
inc
/dec
functions could look like this:At the moment, this library doesn't try to shrink the sequence of operations in case of failure.