ghostwheel

Hassle-free clojure.spec, automatic generative testing, side effect detection, and evaluation tracing for Clojure(-Script) – https://github.com/gnl/ghostwheel
Saikyun 2019-11-08T13:50:04.000600Z

hey, I've been enjoying ghostwheel lately, but have run into some issues

Saikyun 2019-11-08T13:51:32.001900Z

I'm trying to define a function like this:

(>defn zone-of-card
  [db card-id]
  [::db ::card-id | #((into #{} (keys (:cards db))) card-id)
   => ::zone]
  ...)

Saikyun 2019-11-08T13:51:51.002400Z

but it often fails generating correct card-ids

Saikyun 2019-11-08T13:53:20.003700Z

I was wondering if there was a way to solve this? I've managed to write custom generators like so: (defn card-in-db-gen [] (s/gen (into #{} (keys (:cards db))))) but I don't understand how to fit that with the >defn macro. is it possible? is it feasible?

Saikyun 2019-11-08T13:53:36.004100Z

is there another way one might spec a "database" and its relations?

Saikyun 2019-11-08T13:53:40.004300Z

thankful for any input

Saikyun 2019-11-08T18:54:44.004800Z

I guess what I'm asking for is to be able to add a custom generator that generates all the arguments 🙂

tony.kay 2019-11-08T19:12:06.005100Z

have you looked at <-? I think that is what you want

tony.kay 2019-11-08T19:13:44.005600Z

or do you mean on the args themselves? In that case you just need to use with-gen on things like ::card-id I think

tony.kay 2019-11-08T19:14:29.006Z

(s/def ::card-ids (s/with-gen .....))