test-check

wilkerlucio 2018-02-09T00:14:56.000060Z

@gfredericks sorry the delay, I'm not sure I can use recursive-gen on this case

wilkerlucio 2018-02-09T00:15:00.000028Z

but I was able to make it work

wilkerlucio 2018-02-09T00:15:19.000370Z

this how it ended up:

wilkerlucio 2018-02-09T00:15:22.000224Z

(s/def ::query
  (s/coll-of ::query-expr :kind vector?
    :gen #(let [g (s/gen (s/coll-of ::query-expr :kind vector? :max-count 5))]
            (gen/->Generator
              (fn [rdn size]
                (if (> *query-gen-max-depth* 0)
                  (binding [*query-gen-max-depth* (dec *query-gen-max-depth*)]
                    (gen/call-gen g rdn size))
                  (gen/call-gen (gen/return []) rdn size)))))))

wilkerlucio 2018-02-09T00:15:51.000312Z

this limits the depth of the generator by using a dynamic var, was the best solution I could find

2018-02-09T00:20:09.000252Z

yeah, I think it's technically possible with recursive-gen but maybe not easy would definitely be better for spec to handle it without error