Skip to content

Instantly share code, notes, and snippets.

@devstopfix
Last active March 2, 2017 15:43
Show Gist options
  • Save devstopfix/cdbaf609faf6f914d3ddafe2d850962d to your computer and use it in GitHub Desktop.
Save devstopfix/cdbaf609faf6f914d3ddafe2d850962d to your computer and use it in GitHub Desktop.
Generate EVRYTHNG Refs for example data
; lein try org.clojure/test.check
(require '[clojure.test.check.generators :as gen])
;"abcdefghkmnpqrstwxyABCDEFGHKMNPQRSTUVWXY23456789"
(def prefix-u (partial into ["U"]))
(def chars-to-str (partial apply str))
(def thng-id (gen/fmap
(comp chars-to-str prefix-u)
(gen/vector (gen/elements [\T \H \N \G \h \n \g]) 23)))
(def product-id (gen/fmap
(comp chars-to-str prefix-u)
(gen/vector (gen/elements [\P \R \D \U \C \T \c \t]) 23)))
(def collection-id (gen/fmap
(comp chars-to-str prefix-u)
(gen/vector (gen/elements [\C \E \T \N \c \e \t \n]) 23)))
(-> (gen/sample collection-id 100) sort)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment