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

Support Standard Invariants #289

Open
jlink opened this issue Jan 7, 2022 · 0 comments
Open

Support Standard Invariants #289

jlink opened this issue Jan 7, 2022 · 0 comments

Comments

@jlink
Copy link
Collaborator

jlink commented Jan 7, 2022

Testing Problem

Some invariants show up again and again. A few examples:

  • Idempotency
  • Commutativity
  • Associativity
  • Equals/Hashcode dependency

Coding properties for them by hand requires very similar code again and again.

Suggested Solution

Provide a mechanism to apply standard invariants onto functions, types etc.

Different APIs are thinkable:

  • Abstract template classes for an Invariant, e.g.
    class IdempotencyProperties<T> {
      abstract T createFunction();
    }
  • Annotation based enhancement of Property classes
  • ???

Discussion

Here's how this can be done in quickcheck (Haskell): https://github.com/knupfer/test-invariant/blob/master/src/Test/Invariant.hs

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