Skip to content

Commit

Permalink
Updates for AmsterdamJS demo
Browse files Browse the repository at this point in the history
  • Loading branch information
mrijk committed Dec 13, 2017
1 parent e8c15d3 commit 19179d6
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/rangedrand.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function rangedRand(start, end) {
s.fdef(rangedRand, {
args: s.and(s.cat('start', isInt, 'end', isInt),
args => args.start < args.end),
ret: isString,
ret: isInt,
fn: s.and(f => f.ret >= f.start,
f => f.ret < f.end)
});
Expand Down
2 changes: 1 addition & 1 deletion lib/gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function* sampleInf(generator) {

function retrySample(generator, retries = maxAttempts) {
try {
return testcheck.sample(generator, 1);
return testcheck.sample(generator, 10);
} catch (err) {
if (retries === 0) {
throw new Error(`sampleFromSpec failed at ${maxAttempts} attempts`);
Expand Down
2 changes: 1 addition & 1 deletion lib/test/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function check(sym, opts = {}) {

const validReturnValue = ([, returnValue]) => isValid(returnSpec, returnValue);
const validateFunction = ([args, returnValue]) => funcSpec({ret: returnValue, args: conform(argsSpec, args)});

const pass = every(samples, sample => validReturnValue(sample) && validateFunction(sample));

return {
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@
"devDependencies": {
"chai": "^4.1.2",
"coveralls": "^3.0.0",
"eslint": "^4.12.1",
"eslint": "^4.13.1",
"eslint-plugin-lodash": "^2.5.0",
"eslint-plugin-node": "^5.2.1",
"genfun": "^4.0.1",
"genfun": "^5.0.0",
"gh-pages": "^1.1.0",
"gitbook-cli": "^2.3.2",
"istanbul": "^0.4.5",
"mocha": "^4.0.1",
"pre-commit": "^1.2.2",
"sinon": "^4.1.2",
"stryker": "^0.15.4",
"sinon": "^4.1.3",
"stryker": "^0.15.5",
"stryker-api": "^0.11.0",
"stryker-html-reporter": "^0.11.2",
"stryker-html-reporter": "^0.11.3",
"stryker-javascript-mutator": "^0.2.3",
"stryker-mocha-framework": "^0.7.1",
"stryker-mocha-runner": "^0.10.1"
Expand Down
1 change: 1 addition & 0 deletions test/gen.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe('Test node.spec.gen functions', () => {
});

it('should generate 10 integers', () => {
console.log([...gen.sample(s.gen(isInt))]);
expect([...gen.sample(s.gen(isInt))]).to.have.length(10);
});

Expand Down
2 changes: 1 addition & 1 deletion test/star.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const {invalidString, isBoolean, isInteger, isOdd, isString} = s.utils;
describe('Test the star (*) function', () => {
before(() => {
s.def('::odd?', s.and(isInteger, isOdd));
s.def('::odds', s.plus('::odd?'))
s.def('::odds', s.plus('::odd?'));
});

const odds = s.star('::odd?');
Expand Down

0 comments on commit 19179d6

Please sign in to comment.