Skip to content

Instantly share code, notes, and snippets.

@m0smith
Last active October 25, 2019 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m0smith/bc62fb985236aa04945231eb05a44a31 to your computer and use it in GitHub Desktop.
Save m0smith/bc62fb985236aa04945231eb05a44a31 to your computer and use it in GitHub Desktop.
(require '[clojure.test.check.generators :as gen])
(require '[clojure.string :refer [join]])
(require '[schema-generators.generators :as g])
(require '[schema.core :as s])
(def IP String)
#_(def IP (s/named String "IP"))
(def Host String)
(s/defschema Computer
{:ip IP
:host Host})
(def leaf-gens
{IP (gen/fmap (partial join ".") (gen/tuple (gen/choose 0 255) (gen/choose 0 255) (gen/choose 0 255) (gen/choose 0 255)))})
(g/generate Computer leaf-gens)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment