I’ve indeed seen the book on ScalaCheck, and have been tempted to order it from Amazon. I’m about 20% through the Alvin Alexander book Functional Programmning Simplified (the Scala edition). When I finish that one, I may take a look at the ScalaCheck book. Thanks for the recommendations. It’s now on my amazon wish list.
So I guess the question is, what are you trying to do here?
What I’m trying to do is use a function which already knows how to generate a random Bdd, and persuade the testing framework to use that function. genRandomBdd needs an argument to tell it the number of levels (representing the number of variables in the Boolean function the Bdd represents), each additional level doubles the size on average, and consequently doubles the calculation time. So I have a function genNumVars generate a random integer with a special distribution. 1 twice as likely as 2, 2 twice as likely as 3, etc… but capped by a given maximum.
!!!Yippeeeeee!!! That suggestion seems to work well. Many thanks for your patience. Here is the version of the code. It’s not very much in the end. But far from trivial in its subtlety.
I have some diagnostic println calls in there just to prove to myself, that it is indeed taking a considerably large number of different Bdds.
Here is an excerpt of the disgnostic output.
A related question, @jducoeur, when there’s a failure, the prop based testing framework is supposed to try to reproduce the failure with as small a test case as possible. What do I need to do to facilitate that? Won’t the generator above, always generate numbers with the same frequency? Ideally, I’d like to allow the framework to limit the maximum (8 in the case as programmed). Right? Can I modify the to allow this?
For ScalaCheck, I honestly don’t know, but the term you want to Google for is “shrinking”. I know we changed the details of the approach for the new ScalaTest harness, but I don’t know offhand how it is implemented in ScalaCheck.