-
Notifications
You must be signed in to change notification settings - Fork 3
/
strgen.cljc
27 lines (20 loc) · 1.02 KB
/
strgen.cljc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
(ns miner.strgen
(:require [miner.strgen.impl :as impl]
[clojure.test.check.generators :as gen]))
(defn string-generator
"Returns a test.check generator that generates strings matching the given regular
expression `regex`. (Fancy flags and POSIX extensions are not suppored; see the doc for
more information about the supported regular expression syntax.) The optional
`or-more-limit` controls the maximum numbers of elements that are generated when matching
a potentially unbounded regex (such as #\"x*\" or #\"y+\"). The default is 9."
([regex]
(impl/string-generator regex))
([regex or-more-limit]
(impl/string-generator regex or-more-limit)))
(defn case-insensitive-string-generator
"Like `string-generator` but case-insensitive so it generates a mix of upper and lowercase
characters for the given regex."
([regex]
(gen/bind (string-generator regex) impl/gen-case-insensitive))
([regex or-more-limit]
(gen/bind (string-generator regex or-more-limit) impl/gen-case-insensitive)))