DalekBaldwin / check-it

Randomized specification-based testing for Common Lisp. Available through Quicklisp.
51 stars 10 forks source link

integer range #22

Closed mfiano closed 5 years ago

mfiano commented 5 years ago

Why is the range only [-10,10]? For example this will stack overflow: (generate (generator (guard (lambda (x) (> x 10)) (integer))))

DalekBaldwin commented 5 years ago

(integer) without a specified range encompasses any possible integer, but the numbers that end up being generated are dynamically bound by the *size* parameter (which starts at 10 by default). In general it's better practice to write generators that are limited to the subset of values you want by construction, like (integer 11 *), or through a mapped or chained generator, instead of wrapping a guard with a high probability of failure (or certainty of failure under some sizing contexts) as a postcondition.