Welcome! Please see the About page for a little more info on how this works.

0 votes
in test.check by
The generators {{neg-int}} and {{pos-int}} generate {{0}}, which is confusing as {{(= (pos? 0} (neg? 0) false)}}. The suggestion is to change {{s-pos-int}} and {{s-neg-int}} to {{pos-int}} and {{neg-int}} respectively, and replace the current {{neg-int}} and {{pos-int}}. Suggestions for new names include {{non-x-int}} and {{not-x-int}}.

[Original issue|https://github.com/reiddraper/simple-check/issues/46]

3 Answers

0 votes
by

Comment made by: gshayban

`
user> (clojure.spec.gen.alpha/sample (clojure.spec.alpha/gen pos-int?))
(1 1 1 4 2 4 31 1 8 4)

user> (clojure.test.check.generators/sample clojure.test.check.generators/pos-int)
(0 0 1 1 0 5 1 2 1 4)
`

users of this generator via clojure.spec never see the zeros

0 votes
by

Comment made by: gfredericks

I think {{pos-int}} and {{neg-int}} should be deprecated (due to the confusing names), and probably not replaced. {{pos-int}} is just {{nat}}, and {{neg-int}} is a bizarre distribution that is easy enough to make yourself.

I'd like a somewhat rethought set of integer generators and am not confident what that would look like, but I do know for sure that it wouldn't involve these two, so deprecating them should be safe.

0 votes
by
Reference: https://clojure.atlassian.net/browse/TCHECK-2 (reported by hypirion)
...