TheSeamau5 / elm-check

Property Based Testing in Elm
70 stars 20 forks source link

Add Investigator.percentage #15

Closed rtfeldman closed 9 years ago

rtfeldman commented 9 years ago

I wanted one of these so I could generate an Array and then select an element from within it at random. Seems more broadly applicable than that, of course. :smiley:

TheSeamau5 commented 9 years ago

Oh, quick tip, if you want a random generator that always generates the same value, there's constant.

http://package.elm-lang.org/packages/TheSeamau5/elm-random-extra/2.1.0/Random-Extra#constant

You don't need to say, Random.float 0 0 you can just do Random.constant 0

rtfeldman commented 9 years ago

Ah! Good to know. I figured there was something like that, but didn't know what it was called. Changed to constant in c69d079a0df116d9adf9601afd4a7dbfd2f5824f

TheSeamau5 commented 9 years ago

Cool, thanks. This is a pretty useful investigator.

TheSeamau5 commented 9 years ago

Published : http://package.elm-lang.org/packages/TheSeamau5/elm-check/3.1.0/Check-Investigator#percentage

rtfeldman commented 9 years ago

Nice, thanks! :grinning: