Skip to content

Instantly share code, notes, and snippets.

@eraserhd
Created August 30, 2016 18:51
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Weird spec problem
(defn- dependency-indices
[length]
(s/tuple (s/int-in 0 length)
(s/int-in 0 length)))
(defn- index-set
[length]
(s/gen (s/coll-of (dependency-indices length)
:kind set?
:max-count (/ length 2))))
(s/def ::tasks
(s/spec (s/coll-of ::task)
:gen (fn []
(gen/bind
(s/gen (s/coll-of ::task :min-count 5))
(fn [tasks]
;; If we remove the gen/tuple - just make it (gen/return tasks), it runs
;; fast. With the gen/tuple, it says "Couldn't satisfy such-that" consisitently
(gen/tuple (gen/return tasks)))))))
(s/def ::task (s/keys :req [:task.def2/uuid
:task.def2/name]))
(s/def :task.def2/uuid uuid?)
(s/def :task.def2/name (s/and string? not-empty))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment