Weird spec problem
This file contains 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
(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