Advertisement
Guest User

Untitled

a guest
Aug 30th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. (defn- dependency-indices
  2. [length]
  3. (s/tuple (s/int-in 0 length)
  4. (s/int-in 0 length)))
  5.  
  6. (defn- index-set
  7. [length]
  8. (s/gen (s/coll-of (dependency-indices length)
  9. :kind set?
  10. :max-count (/ length 2))))
  11.  
  12. (s/def ::tasks
  13. (s/spec (s/coll-of ::task)
  14. :gen (fn []
  15. (gen/bind
  16. (s/gen (s/coll-of ::task :min-count 5))
  17. (fn [tasks]
  18. ;; If we remove the gen/tuple - just make it (gen/return tasks), it runs
  19. ;; fast. With the gen/tuple, it says "Couldn't satisfy such-that" consisitently
  20. (gen/tuple (gen/return tasks)))))))
  21.  
  22. (s/def ::task (s/keys :req [:task.def2/uuid
  23. :task.def2/name]))
  24.  
  25. (s/def :task.def2/uuid uuid?)
  26. (s/def :task.def2/name (s/and string? not-empty))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement