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

Clarify the current use of mock #10

Merged
merged 1 commit into from
Oct 27, 2022
Merged

Clarify the current use of mock #10

merged 1 commit into from
Oct 27, 2022

Conversation

jasagredo
Copy link

There is a comment in the readme that mentions that mock is a hack for some reasons, and points to this issue advancedtelematic#236 in which one might get the impression that mock is actually not used in the library and one can just mock whatever answers if they don't use symbolic references.

Because this isn't actually
used by the library yet, it's not important for mock to return the correct
responses, e.g. having mock for Read return ReadValue 0 is completely
fine.

I should have added that the only important part is that Reference responses are generated by genSyms, because that is what increases the state counter that you mentioned in the beginning which is used for generating commands...

But for now, while mock is only used for genSyming references, it doesn't really matter.

I got the understanding that as I don't use references yet, I could just define the following:

mock :: Model Symbolic
     -> Action Symbolic
     -> GenSym (Response Symbolic)
mock _ _ = pure ResponseOk

But this catastrophically fails on the transition function if you don't expect that response for every command. I have the suspicion that didn't happen in the linked issue because the system didn't have to shrink as the test succeeded. Once you try to shrink, you would get incomprehensible pairings of cmd and resp (unless one realizes that mock is actually used!!).

The understanding I had was wrong, as there are indeed some uses of mock that require you to actually implement mock. I hope these changes in the README might give some hints to the reader to avoid future misunderstandings.

Copy link
Owner

@stevana stevana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clarification!

I've forgot the details around mock to be honest, I wanted to remove it at some point as I saw it as a failed experiment, but Edsko's lockstep technique depends on it.

@stevana stevana merged commit 7ca9580 into stevana:master Oct 27, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants