ifigueroap / racket-quickcheck

Quickcheck Clone implemented in Racket
Other
32 stars 16 forks source link

choose-* and others that require generators should coerce arbitraries to generators. #26

Open ifigueroap opened 8 years ago

ifigueroap commented 8 years ago

For instance,

(quickcheck (property ([int-list (choose-list arbitrary-integer 10)]) (= 1 1)))

fails because arbitrary-integer is not a generator, but it is trivially converted to one using coerce->generator. The exact error message (in the v0.1 tag) is:

generator-proc: contract violation
  expected: generator?
  given: #<arbitrary>

in general I think there should exist a predicate generator-like? that test whether something is a generator, or could be converted to one...