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

Export PropCheck generators in test and dev environment #14

Open
evnu opened this issue Dec 2, 2019 · 1 comment
Open

Export PropCheck generators in test and dev environment #14

evnu opened this issue Dec 2, 2019 · 1 comment

Comments

@evnu
Copy link
Owner

evnu commented Dec 2, 2019

closed_intervals_test.exs contains a simple PropCheck generator. It would be nice to make that available to downstream users. We probably need to allow a user to pass in a generator for interval values into this generator, in order to make it work with arbitrary data. This probably includes passing in :order and :eq as well. I have something like this in mind:

def gen_closed_intervals(values_gen, order, eq) do
  let [first <- values_gen, second <- values_gen, more <- list(values_gen)] do
    ClosedIntervals.from([first, second | more], order: order, eq: eq)
  end
end

This should be placed in a new module generators/closed_intervals.ex, and mix.exs must be extended to compile this module if the environment is test or dev. We should then also add an example for the README to allow people finding this.

@evnu
Copy link
Owner Author

evnu commented Dec 3, 2019

CC @turion

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