test-check

2022-03-23T13:21:46.408509Z

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"))))))

2022-03-23T13:32:22.165599Z

test.chuck can make a generator from a regex

👍 1