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

Add pre/post/invariant checks for equality #1

Open
io7m opened this issue Jan 27, 2017 · 0 comments
Open

Add pre/post/invariant checks for equality #1

io7m opened this issue Jan 27, 2017 · 0 comments
Assignees

Comments

@io7m
Copy link
Member

io7m commented Jan 27, 2017

Experience has shown that this package gets used to write a lot of code like the following:

            Invariants.checkInvariantL(
             target.capacity(),
              size == target.capacity(),
              x -> "Allocated target buffer must be the correct size");

Note that size cannot appear in the contract message without turning the message lambda into a capturing lambda, which entails an allocation. Some entry points should be added that allow passing in an expected value so that it can appear in any error messages without any extra cost.

@io7m io7m self-assigned this Jan 27, 2017
io7m added a commit that referenced this issue Jan 27, 2017
The failure messages now allow for an optional expected value,
but no API functions currently use this.

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

No branches or pull requests

1 participant