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

Document that properties can be nested #44

Open
dbp opened this issue Jan 27, 2023 · 0 comments
Open

Document that properties can be nested #44

dbp opened this issue Jan 27, 2023 · 0 comments

Comments

@dbp
Copy link

dbp commented Jan 27, 2023

From the documentation, it would seem that this shouldn't work:

(quickcheck (property [(x arbitrary-integer)]
                (property [(y arbitrary-integer)]
      (= (* x y) (* y x)))

But it does; if the body is changed to fail, the reporting does the right thing: tells you the x and y that cause the issue.

And indeed, so does this:

(quickcheck (property [(x arbitrary-integer)]
                        (if (< x 10)
                           (property [(y arbitrary-integer)]
                             (= (* x y) (* y x)))
                           (property [(y arbitrary-integer)]
                              (= (* x y) (* y x 2))))

This is great, but nothing on the documentation makes it obvious this would be possible! For property:

"The ids are bound to the result of the given gen/arb-exprs inside the body expressions. The body expressions are used as the bodies of a predicate function that will be run with newly generated values from the specified generators or arbitraries."

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

1 participant