Fork me on GitHub
#test-check
<
2017-06-26
>
rabbitthirtyeight19:06:04

I'm having trouble doing some seemingly basic stuff with test.check. Can someone point out where I'm going wrong? Basically bind and large-integer* don't seem to be working as I expected. If I have the following in my property:

(let  [greater (gen/large-integer* {:min 0 :max 10})
        lesser (gen/bind greater (fn [x] (gen/large-integer* {:min 0 :max x})))]


    (prop/for-all [less lesser
                   great greater]
                  (is (<= less great)))
when I run the test I always get the following failure:
expected: (<= less great)
  actual: (not (<= 1 0))

gfredericks20:06:48

@rabbitthirtyeight I know what's wrong, but don't know enough about what you're really doing to recommend an alternative

gfredericks20:06:02

the reason it isn't doing what you think is that there's a different greater being generated for each of less and great