评论作者:gfredericks
如果我没有时间补丁,我认为这样的生成器是一个不错的选择
`
(def gen-bigint
(gen/sized
(fn [size]
(let [large-integer (gen/resize size gen/large-integer)]
;; scaling gives us relatively small vectors, but using
;; the resized large-integer above means the numbers in
;; the small vectors will still be big
(gen/scale #(+ 2 (/ % 20))
(gen/fmap (fn [xs] (+ (bigint (first xs)) (reduce * (map bigint (rest xs)))))
(gen/not-empty (gen/vector large-integer)))))))) ```