Writing custom generators for ScalaCheck can be one of the more difficult and/or time-consuming parts of using it. As a result I thought I’d start putting together a list of generators that I have written or seen elsewhere. Unfortunately I can’t credit all the ones I’ve seen in other places because I google’d and copied them many moons ago, but I’ll give credit/attribution to all the ones I can.Back to top
This is a combination of generators I wrote, and some that I copied from other places and may have modified a little:
This is a page from my book, Functional Programming, Simplified
“But I was trying to think why I don’t use QuickCheck — which is a very nice tool — more. I think it’s because the situations that cause me trouble are ones that I would find it difficult to generate test data for.”
In this lesson I’ll share a non-trivial example of how I used ScalaCheck to test a function I wrote recently.