malli 2025-03-25

Dear all, does anybody have an example of using :gen/gen (test-gen/fmap... on a key? I cannot seem to make it work...

found a way (I hope)

the problem is my use of gen/nat for generating positive integers this works:

(assoc %:gen/gen (test-gen/fmap (fn [v] (format "ADR%010d" v))
                                (test-gen/large-integer* {:min 0 :max 9999999999})))

does :gen/fmap work for you? e.g. (from the readme):

;; :gen/fmap 
(mg/generate
  [:and {:gen/fmap (partial str "kikka_")} string?]
  {:seed 10, :size 10})
;; => "kikka_WT3K0yax2"

❤️ 2

yeah ended up using that with gen/any as placeholder :D

well that version from test-check anyway for other use cases as well