Write a function, generate random input, pass that random input to that function, multiple times. Report back success or failure: essentially, that’s what QuickCheck does.
1. Write a function
Here’s what that function does, in steps:
2. Generate random input
Given a hypothetical
Gen module, we can do something like this:
This is a generator for values of type
int list1. If we run it, it’ll generate values like these:
3. Pass that random input to that function
Now, we need a way to pass each one of these generated values to our function, and report back success or failure2: essentially, that’s what QuickCheck does.
See also: Write you some QuickCheck.