Skip to main content

list-distinct-by

function

clojure.test.check.generators/list-distinct-by

(list-distinct-by [key-fn gen] [key-fn gen opts])
Generates a list of elements from the given generator, with the guarantee that (map key-fn the-list) will be distinct. If the generator cannot or is unlikely to produce enough distinct elements, this generator will fail in the same way as `such-that`. Available options: :num-elements the fixed size of generated list :min-elements the min size of generated list :max-elements the max size of generated list :max-tries the number of times the generator will be tried before failing when it does not produce distinct elements (default 10) :ex-fn a function of one arg that will be called if test.check cannot generate enough distinct values; it will be passed a map with `:gen`, `:num-elements`, and `:max-tries` and should return an exception

No examples yet. Be the first to add one!