Generator Transformation
Advanced tutorial
The contents of this document should be considered advanced and is provided mostly for interest. You do not need to understand this document in order to use quick_check.js to its full potential.
qc.map βΈ¬ (a β b) β Gen a β Gen b
This allows you to define a generator in terms of another generator. This function is curried.
qc.of βΈ¬ a β Gen a
Creates a generator based on a constant value. This generator returns the constant value passed into it. In effect, it works like Lodash's _.constant
function.
expect(function(a) {
return a === 5;
}).forAll(qc.of(3));
expect (a) ->
a == 5
.forAll qc.of 3
expect(a => a === 5).forAll(qc.of(3));
qc.join βΈ¬ Gen (Gen a) β Gen a
Takes a generator generator and returns a generator. This way you can unwrap unnecessarily complex values.
Updated almost 8 years ago