jobjo / popper

Property-based testing at ease
ISC License
43 stars 1 forks source link

Support char, bytes, int32, int64 comparators #47

Closed bikallem closed 3 years ago

bikallem commented 3 years ago

Hi, Thanks for this useful library. I am evaluating popper for one of my projects and realized there is no built-in support for char, bytes, int32, int64 and unit data types. Is this by design and if not are you open to PR to add support for this?

jobjo commented 3 years ago

Hi, char, int32, int64 and unit do exist in the Sample module. See the primitives section.

bytes (and likely a few others) are missing. Should be straight forward to add. Feel free to push a PR yourself or I will take a look. I have a few other missing pieces in the pipeline so should push a new version soon.

Let me know if you have any other requests!

bikallem commented 3 years ago

Hi, char, int32, int64 and unit do exist in the Sample module. See the primitives section.

Indeed, Sample does have those primitives and it seems to be missing in Comparator.t. In terms of using the Popper.equal function it seems to require 'a Comparator.t and not 'a Sample.t, hence me raising the issue.

I will send the PR shortly to address this issue.

jobjo commented 3 years ago

Indeed, Sample does have those primitives and it seems to be missing in Comparator.t. In terms of using the Popper.equal function it seems to require 'a Comparator.t and not 'a Sample.t, hence me raising the issue.

Ah, right. Should make sure those line up.

I will send the PR shortly to address this issue.

Great, thanks!

bikallem commented 3 years ago

bytes (and likely a few others) are missing. Should be straight forward to add. Feel free to push a PR yourself or I will take a look. I have a few other missing pieces in the pipeline so should push a new version soon.

For bytes in Sample.t, should this just peruse the String module implementation?

jobjo commented 3 years ago

Arguably the distribution for sampling char values could be made different but I think it's fine to just map over string.