Instances and utilities for the ScalaCheck property-based testing framework.
"com.github.morgen-peschke" % "commons-scalacheck" % commonsVersion
ivy"com.github.morgen-peschke::commons-scalacheck:$commonsVersion"
Most of the functionality in this module is surfaced here.
-
Range#choose
is a more flexible alternative toGen.chooseNum
This is particularly notable when theRange
has astep
value other than 1, at which point these are roughly equivalent:(a until b by c).choose Gen.chooseNum(0, ((b - a) - 1) / c).map(s => a + (c * s))
-
Range#chooseSteps
generates a value in the range[0, range.length)
-
Range#slices
generates subsets of a referenceRange
-
Gen#optional
andGen#zip
forward to the static methods provided onGen
, and can be simpler to use in some cases -
Gen#gen
provides an entry point for custom behavior, often using the baseGen
to build collections of various kinds through repeated application.
These are similar to Gen#listOfN
, however they are specialized to work with Range
rather than a fixed length. This can make specifying Gen
instances considerably less
noisy.
This typeclass provides much of the backbone of Combinators
and RangeGens
These provide various flavors of Gen
for Range
and NumericRange
.