contractis
Advanced tools
Comparing version 0.0.14 to 0.0.15-alpha.0
@@ -28,3 +28,3 @@ const gen = require("./generators"); | ||
generate: () => | ||
isnum((opts || {}).lte) && isnum((opts || {}).lte) | ||
isnum((opts || {}).gte) && isnum((opts || {}).lte) | ||
? gen.num_between(opts.lte, opts.gte) | ||
@@ -31,0 +31,0 @@ : isnum((opts || {}).lte) |
{ | ||
"name": "contractis", | ||
"version": "0.0.14", | ||
"version": "0.0.15-alpha.0", | ||
"description": "Design by Contract for JavaScript", | ||
@@ -21,3 +21,3 @@ "repository": "github:saltcorn/saltcorn", | ||
}, | ||
"gitHead": "776883807352b79551cab678f76027892934260f" | ||
"gitHead": "0b9f7470e0c42789b3d6d579d3f49cf4e336003e" | ||
} |
21
test.js
const { contract, is, auto_test } = require("."); | ||
const { ContractViolation } = require("./util.js"); | ||
const gen = require("./generators"); | ||
describe("disable", () => { | ||
@@ -423,1 +425,20 @@ it("should exist", () => { | ||
}); | ||
describe("generate", () => { | ||
it("gen pos not nan", () => { | ||
const rnd = gen.num_positive(); | ||
expect(typeof rnd).toBe("number"); | ||
expect(isNaN(rnd)).toBe(false); | ||
}); | ||
it("num not nan", () => { | ||
const rnd = is.number({ lte: 5.0 }).generate(); | ||
expect(typeof rnd).toBe("number"); | ||
expect(isNaN(rnd)).toBe(false); | ||
}); | ||
it("int not nan", () => { | ||
const rnd = is.integer({ lte: 5 }).generate(); | ||
expect(typeof rnd).toBe("number"); | ||
expect(isNaN(rnd)).toBe(false); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32718
1126