1. Meikel Brandmeyer
  2. ClojureCheck


Meikel Brandmeyer  committed 59656e1

Add string generator

  • Participants
  • Parent commits 215c275
  • Branches default

Comments (0)

Files changed (1)

File src/main/clojure/clojurecheck/core.clj

View file
  • Ignore whitespace
             vs  (list vals :length (constantly len))]
     (apply clojure.core/sorted-map (interleave ks vs))))
+(defn string
+  "Generates a string taking characters from the given generator. The
+  length of the string is an integer generator. The default grows with
+  the size guidance. The size guidance is passed verbatim to the
+  character generator."
+  {:added "2.1"}
+  [characters & {:keys [length] :or {length (int)}}]
+  (let-gen [chs (list characters :length length)]
+    (apply str chs)))
 (defn sized
   "Modify the size guidance according to f and pass it on to the
   given generator. If f is not a function it will be taken turned