-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
110 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Mocha interop, assumes "it" is a globally defined function. | ||
*/ | ||
/*eslint-env mocha */ | ||
|
||
var checkers = require("./"); | ||
|
||
exports = module.exports = checking; | ||
exports.gen = checkers.gen; | ||
|
||
/** | ||
* Generate a mocha example | ||
* @param {string} desc The example description | ||
* @param {array} args List of generators to pass to body | ||
* @param {function} body Function to check, should return true or false | ||
* @param {number} n The number of iterations to check (optional) | ||
* @param {object} options Additional options for check (optional) | ||
*/ | ||
function checking(desc, args, body, n, options) { | ||
if (typeof n === 'undefined') { | ||
n = 1000; | ||
options = {}; | ||
} | ||
if (typeof options === 'undefined' && typeof n !== 'number') { | ||
options = n; | ||
n = 1000; | ||
} | ||
it(desc, function() { | ||
checkers.forAll(args, body).check(n, options); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters