This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-18
Channels
- # adventofcode (1)
- # bangalore-clj (1)
- # beginners (118)
- # boot (39)
- # cljs-dev (6)
- # cljsrn (1)
- # clojure (62)
- # clojure-mke (1)
- # clojure-nl (6)
- # clojure-russia (51)
- # clojure-spec (8)
- # clojure-uk (9)
- # clojurescript (101)
- # code-reviews (1)
- # cursive (2)
- # datascript (9)
- # datomic (80)
- # emacs (4)
- # hoplon (27)
- # jobs-discuss (1)
- # off-topic (1)
- # om (1)
- # onyx (18)
- # protorepl (2)
- # re-frame (13)
- # reagent (13)
- # rum (9)
- # test-check (23)
I wrote a little essay about growth & shrinking of test.check generators: https://github.com/clojure/test.check/blob/master/doc/growth-and-shrinking.md
Is it considered bad practice to employ custom generators to produce values that lead to decent perf of the functions being checked? Motivation: You have a function which, for certain valid inputs, would slow down checking considerably. Would it be considered an abuse of s/with-gen
for this purpose, or is there a better way, or is this still an open question?
A concrete hypothetical example: Testing the 2-arg arity of repeat
. You want the spec to allow any number for n
, but you want to limit the size of the generated values of n
, just for testing purposes.
@mfikes Seems like the essay @gfredericks just posted here is relevant to your question: https://github.com/clojure/test.check/blob/master/doc/growth-and-shrinking.md -- it only hints at sizing being relevant for performance (memory usage) but in general I think it makes sense to apply custom generators for this purpose. I don't have authority on blessing it as a good practice, though 🙂
Seems fine to me
You can also supply the generators at test time rather than in the registered spec if you want smaller scope
With gen overrides
👍 to all that