You can nest calls to forAll
like this:
val boundedIntProperty = forAll { (minBound: Int, maxBound: Int) =>
forAll( Gen.choose(minBound, maxBound) ) { someBoundedInt =>
...
}
}
Note that above, minBound
can be larger than maxBound
sometimes, which will make Gen.choose
fail (not produce a value). So you probably want to generate your bounds in a smarter way too.