Closed radhikalism closed 1 year ago
When generating values from schemas, it is not possible to directly express returning a single constant value, as in clojure.test.check.generators/return.
clojure.test.check.generators/return
Expected: (mg/generate [:int {:gen/return 1}]) => constantly 1
(mg/generate [:int {:gen/return 1}])
1
Actual: Other values are returned because :gen/return is not recognized.
:gen/return
Workarounds:
(mg/generate [:int {:gen/gen (gen/return 1)}])
(mg/generate [:int {:gen/elements [1]}])
(mg/generate [:int {:gen/fmap (constantly 1)}])
Although workarounds are available, they are not as idiomatic as :gen/return x corresponding to (gen/return x).
:gen/return x
(gen/return x)
When generating values from schemas, it is not possible to directly express returning a single constant value, as in
clojure.test.check.generators/return
.Expected:
(mg/generate [:int {:gen/return 1}])
=> constantly1
Actual: Other values are returned because
:gen/return
is not recognized.Workarounds:
(mg/generate [:int {:gen/gen (gen/return 1)}])
(mg/generate [:int {:gen/elements [1]}])
(mg/generate [:int {:gen/fmap (constantly 1)}])
Although workarounds are available, they are not as idiomatic as
:gen/return x
corresponding to(gen/return x)
.