Fork me on GitHub
#testing
<
2019-05-17
>
fabrao15:05:10

Hello all, about generative testing, what is the best way to generate bunch of string with id like "prefix-" and random string with fixed size, like "prefix-12345"?

dharrigan15:05:37

(gen/sample (gen/fmap #(apply str "prefix-" %) (gen/vector gen/char-alpha 10)) 10)

dharrigan15:05:55

("prefix-ZdcwIbtOmG" "prefix-ZWFWPnzpIc" "prefix-WxCRVcrErI" "prefix-toADesqefK" "prefix-dxbcfmdopi" "prefix-sKjscpYcGO" "prefix-MAUqsOYoIu" "prefix-AKJsCWkXca" "prefix-twnWfFkkLv" "prefix-LDqwqRYQbu")

dharrigan15:05:58

hope that helps! 🙂

fabrao15:05:59

@dharrigan What is the lib did you use?

dharrigan15:05:33

[org.clojure/test.check "0.9.0"]

fabrao15:05:52

thanks a lot

dharrigan15:05:28

(:require [clojure.test.check.generators :as gen])

dharrigan15:05:31

you're very welcome