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

Improve generator distribution for sized schemas #748

Merged
merged 1 commit into from Aug 30, 2022

Conversation

frenchy64
Copy link
Contributor

We want the same distribution for gen/vector for both
these cases:

  1. only :min is provided
  2. no min-max opts are passed.

This fixes generation for 1 by using + to shift the length
distribution instead of squashing it via clojure.core/max.

Same approach as clojure.test.check.generators/coll-distinct-by:
https://github.com/clojure/test.check/blob/b6a318af92e836f1f20960f38a5944168b88d60d/src/main/clojure/clojure/test/check/generators.cljc#L799

We want the same distribution for `gen/vector` for both
these cases:
1. only :min is provided
2. no min-max opts are passed.

This fixes generation for 1 by using + to shift the length
distribution instead of squashing it via clojure.core/max.

Same approach as clojure.test.check.generators/coll-distinct-by:
  https://github.com/clojure/test.check/blob/b6a318af92e836f1f20960f38a5944168b88d60d/src/main/clojure/clojure/test/check/generators.cljc#L799
@frenchy64 frenchy64 marked this pull request as ready for review August 30, 2022 15:15
@ikitommi ikitommi merged commit 457fc5d into metosin:master Aug 30, 2022
@ikitommi
Copy link
Member

Thanks!

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