Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finite state machines #446

Open
mirosval opened this issue Apr 18, 2024 · 1 comment
Open

Finite state machines #446

mirosval opened this issue Apr 18, 2024 · 1 comment

Comments

@mirosval
Copy link

Both examples in https://github.com/proptest-rs/proptest/tree/master/proptest-state-machine/examples seem to be infinite state machines.

I'm trying to use proptest for a finite state machine, but I'm having trouble finding a way to express that. I have 2 problems:

  1. Explaining to the strategy that it found the terminal state and should stop
    a. If I always return false from preconditions I get the error below
    b. It doesn't seem to be possible to create an empty Strategy, that just wouldn't produce new states from transitions
  2. I have a transition function in my STM that returns Result<Self, Error> when the supplied transition was not valid for the current state, this is not possible in the current ReferenceStateMachine, though I guess it could be worked around by implementing ReferenceStateMachine for a wrapper type
Test aborted: Too many local rejects
        successes: 1
        local rejects: 65536
                65536 times at Pre-conditions were not satisfied
        global rejects: 0
@matthew-russo
Copy link
Member

Thanks for the feedback and sorry for the delay.

Taking a step back from the current status of proptest-state-machine what would be the ideal situation you're looking for? Are you trying to emulate something you've done with other lanaguages/libraries? If so can you share examples? If not, could you describe how you would have expected things to work from an interface perspective. proptest-state-machine is a pre-1.0 release where we're trying to figure out the right things to offer so I don't want to get stuck too much in its current interfaces when thinking about new use cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants