Fork me on GitHub
#test-check
<
2022-03-23
>
jjttjj13:03:46

I want to make a generator for a string of an exact length where only certain letters are allowed. Is there an obvious better way than this that I'm missing:

(gen/generate
  (gen/fmap (fn [x] (apply str x))
    (apply gen/tuple
      (repeat 10
        (gen/elements
          (mapcat (juxt identity str/upper-case) "abcdef"))))))

gfredericks13:03:22

test.chuck can make a generator from a regex

👍 1