Last active
March 2, 2017 15:43
-
-
Save devstopfix/cdbaf609faf6f914d3ddafe2d850962d to your computer and use it in GitHub Desktop.
Generate EVRYTHNG Refs for example data
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; 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