Okay, as I learned via my previous question, the RWH book is already out of date for QuickCheck. And despite all the posts I've read that tell me how incredibly simple it is to use QuickCheck, I cannot find any place that tells me how to change the number of tests to run for a property.
RWH says:
handyCheck limit = check defaultConfig { configMaxTest = limit , configEvery = \_ _ -> "" }
How to do this with QuickCheck 2.4? More importantly, how would I have found out myself? Please don't tell me that I should've been able to figure it out from the API documentation.
You are looking for:
quickCheckWith stdArgs { maxSuccess = 5000 } someProp
How I found out
quickCheck
was the Args
type with a maxSuccess
field.Args
- finding stdArgs
. (Use your browsers search function - ctrl-f usually). OTOH, I could have used hoogle.Args
type somewhere so I kept looking. The next line was quickCheckWith
- bingo! On the other hand, I could have used hoogle.How Else Can You Find Out
As I stated above, you could have used hoogle to find a lot of the functions, assuming you realize the Args
type is the core of what you need (from the haddocks).
Otherwise, you are probably reduced to looking at what other packages do, which means you need to know what other packages are worth looking at. The examples folder in QuickCheck seems obvious, but not all packages include such examples. Using reverse dependencies you can often find a package to look at, but for QC lots of packages don't have explicit dependencies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With