However, I'm not sure whether one should include it into the document. It's a competitor to randomAssertEquals, but I'm not sure how often that one gets used. Both can be created in terms of the other:
var randomAssertEquals = function(generator, userSol, refSol){
var property = function(values){
Test.assertEquals(userSol.apply(this,values), refSol.apply(this,values));
}
return forAll(property, generator);
}
// ------------------------------------------
var forAll = function(property){
var generators = Array.prototype.slice.call(arguments, 1);
var generator = function(){ return generators.map(f => f()); }
var const_true = function(){ return true;}
return randomAssertEquals (generator, property, const_true, 100);
}
So, the
quickcheck
package has been available for some time. There was a small bug, but other than that it seems rather reasonable.However, I'm not sure whether one should include it into the document. It's a competitor to
randomAssertEquals
, but I'm not sure how often that one gets used. Both can be created in terms of the other:Both solutions have advantages and disadvantages.