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

0 votes
in Spec by

This should specify a spec whose generator always returns collections of size 4 or 5 but instead it generates collections of size 4 to 8:

(require '[clojure.spec.alpha :as s] '[clojure.spec.gen.alpha :as gen]) (map count (gen/sample (s/gen (s/coll-of char? :min-count 4 :gen-max 5)))) ;; (4 7 8 8 4 7 4 5 5 7)

Cause: The max logic in s/every-impl is: }. If there is a max-count it's used, otherwise the larger of gen-max or 2min-count is used. In this case, 2min-count is 8. Seems like we should never generate more than gen-max though, so propose changing this logic to: }.

Patch: clj-2202.patch

1 Answer

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-2202 (reported by alex+import)
...