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

Varray example #183

Merged
merged 2 commits into from
Nov 27, 2023
Merged

Varray example #183

merged 2 commits into from
Nov 27, 2023

Conversation

n-osborne
Copy link
Collaborator

This PR add the varray example.
It is bassed on the not yet merged #177, please consider only the two last commits.

There were four challenges, of different importance:

  • The specifications are in an ml file and Gospel does not read ml file. The proposed solution/workaround is to extract the content of the module signature we are interested in.
  • Writing specifications with Gospel sequence type is not that easy (it is very possible that review reveals some off-by-one mistakes!)
  • User have to write some dune machinery in order to test different Functor instantiations.
  • The included module is a bit bigger than the one for the Initiate ortac-example package #177 example and need to be included in two different tests. We had to make it a library. The size of the included module is what triggered Add an include option to qcheck-stm cli #181.

Copy link
Contributor

@shym shym left a comment

Choose a reason for hiding this comment

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

This is nice, well done! (I confess I didn’t review the generated tests :-).
I’ve pushed on my varray-bis branch a fix for a couple of typos in the README. (By the way, I wondered at what width you split lines, so I didn’t reformat after editing, but you probably should).

A couple of small suggestions for the specs.

  • Calling the helper function valid is ambiguous to me (especially as it is documented as checking whether an index is valid :-). As it is only used in one function specification, I would simply inline it there.
  • In sub (examples/varray_sig.ml at line 318), you prohibit n=0: why? Same thing in blit. This is allowed in fill, for instance, where the informal documentation is stating the same constraint.
  • In fill, I was surprised the ensures was not reversed, ie if pos <= i < pos+len then proj x else ..., as a more direct formalisation of the informal documentation. But it might be the purpose, of rewriting it in another way to avoid repeating the same mistake?

@n-osborne
Copy link
Collaborator Author

Waiting for varray.0.2 so that minimal version for varray can be added.

Specifications are in a `ml` file, extraction is done with an awk script
for two different instatiations of the Functor.
@n-osborne
Copy link
Collaborator Author

CI failure seems unrelated. I merge.

@n-osborne n-osborne merged commit bdef212 into ocaml-gospel:main Nov 27, 2023
2 of 3 checks passed
@shym shym deleted the varray branch November 27, 2023 16:43
@shym shym restored the varray branch November 27, 2023 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants