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
One cool thing about
for expressions is that you can use multiple generators inside of them. This lets you do some nice analytics when you have some interesting data relationships.
For instance, suppose you have some data like this: