Merge pull request #619 from quantified-uncertainty/dependabot/npm_and_yarn/fast-check-3.0.0
This commit is contained in:
commit
fc2352ccc2
|
@ -5,7 +5,7 @@ import { testRun } from "./TestHelpers";
|
||||||
describe("cumulative density function of a normal distribution", () => {
|
describe("cumulative density function of a normal distribution", () => {
|
||||||
test("at 3 stdevs to the right of the mean is near 1", () => {
|
test("at 3 stdevs to the right of the mean is near 1", () => {
|
||||||
fc.assert(
|
fc.assert(
|
||||||
fc.property(fc.float(), fc.float({ min: 1e-7 }), (mean, stdev) => {
|
fc.property(fc.integer(), fc.integer({ min: 1 }), (mean, stdev) => {
|
||||||
let threeStdevsAboveMean = mean + 3 * stdev;
|
let threeStdevsAboveMean = mean + 3 * stdev;
|
||||||
let squiggleString = `cdf(normal(${mean}, ${stdev}), ${threeStdevsAboveMean})`;
|
let squiggleString = `cdf(normal(${mean}, ${stdev}), ${threeStdevsAboveMean})`;
|
||||||
let squiggleResult = testRun(squiggleString);
|
let squiggleResult = testRun(squiggleString);
|
||||||
|
@ -16,7 +16,7 @@ describe("cumulative density function of a normal distribution", () => {
|
||||||
|
|
||||||
test("at 3 stdevs to the left of the mean is near 0", () => {
|
test("at 3 stdevs to the left of the mean is near 0", () => {
|
||||||
fc.assert(
|
fc.assert(
|
||||||
fc.property(fc.float(), fc.float({ min: 1e-7 }), (mean, stdev) => {
|
fc.property(fc.integer(), fc.integer({ min: 1 }), (mean, stdev) => {
|
||||||
let threeStdevsBelowMean = mean - 3 * stdev;
|
let threeStdevsBelowMean = mean - 3 * stdev;
|
||||||
let squiggleString = `cdf(normal(${mean}, ${stdev}), ${threeStdevsBelowMean})`;
|
let squiggleString = `cdf(normal(${mean}, ${stdev}), ${threeStdevsBelowMean})`;
|
||||||
let squiggleResult = testRun(squiggleString);
|
let squiggleResult = testRun(squiggleString);
|
||||||
|
|
|
@ -4,13 +4,16 @@ import * as fc from "fast-check";
|
||||||
|
|
||||||
// Beware: float64Array makes it appear in an infinite loop.
|
// Beware: float64Array makes it appear in an infinite loop.
|
||||||
let arrayGen = () =>
|
let arrayGen = () =>
|
||||||
fc.float32Array({
|
fc
|
||||||
|
.float32Array({
|
||||||
minLength: 10,
|
minLength: 10,
|
||||||
maxLength: 10000,
|
maxLength: 10000,
|
||||||
noDefaultInfinity: true,
|
noDefaultInfinity: true,
|
||||||
noNaN: true,
|
noNaN: true,
|
||||||
});
|
})
|
||||||
|
.filter(
|
||||||
|
(xs_) => Math.min(...Array.from(xs_)) != Math.max(...Array.from(xs_))
|
||||||
|
);
|
||||||
describe("cumulative density function", () => {
|
describe("cumulative density function", () => {
|
||||||
let n = 10000;
|
let n = 10000;
|
||||||
|
|
||||||
|
@ -119,11 +122,7 @@ describe("cumulative density function", () => {
|
||||||
{ sampleCount: n, xyPointLength: 100 }
|
{ sampleCount: n, xyPointLength: 100 }
|
||||||
);
|
);
|
||||||
let cdfValue = dist.cdf(x).value;
|
let cdfValue = dist.cdf(x).value;
|
||||||
if (x < Math.min(...xs)) {
|
expect(cdfValue).toBeGreaterThanOrEqual(0);
|
||||||
expect(cdfValue).toEqual(0);
|
|
||||||
} else {
|
|
||||||
expect(cdfValue).toBeGreaterThan(0);
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,15 +5,11 @@ import * as fc from "fast-check";
|
||||||
describe("Scalar manipulation is well-modeled by javascript math", () => {
|
describe("Scalar manipulation is well-modeled by javascript math", () => {
|
||||||
test("in the case of natural logarithms", () => {
|
test("in the case of natural logarithms", () => {
|
||||||
fc.assert(
|
fc.assert(
|
||||||
fc.property(fc.float(), (x) => {
|
fc.property(fc.integer(), (x) => {
|
||||||
let squiggleString = `log(${x})`;
|
let squiggleString = `log(${x})`;
|
||||||
let squiggleResult = testRun(squiggleString);
|
let squiggleResult = testRun(squiggleString);
|
||||||
if (x == 0) {
|
if (x == 0) {
|
||||||
expect(squiggleResult.value).toEqual(-Infinity);
|
expect(squiggleResult.value).toEqual(-Infinity);
|
||||||
} else if (x < 0) {
|
|
||||||
expect(squiggleResult.value).toEqual(
|
|
||||||
"somemessage (confused why a test case hasn't pointed out to me that this message is bogus)"
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
expect(squiggleResult.value).toEqual(Math.log(x));
|
expect(squiggleResult.value).toEqual(Math.log(x));
|
||||||
}
|
}
|
||||||
|
@ -23,7 +19,7 @@ describe("Scalar manipulation is well-modeled by javascript math", () => {
|
||||||
|
|
||||||
test("in the case of addition (with assignment)", () => {
|
test("in the case of addition (with assignment)", () => {
|
||||||
fc.assert(
|
fc.assert(
|
||||||
fc.property(fc.float(), fc.float(), fc.float(), (x, y, z) => {
|
fc.property(fc.integer(), fc.integer(), fc.integer(), (x, y, z) => {
|
||||||
let squiggleString = `x = ${x}; y = ${y}; z = ${z}; x + y + z`;
|
let squiggleString = `x = ${x}; y = ${y}; z = ${z}; x + y + z`;
|
||||||
let squiggleResult = testRun(squiggleString);
|
let squiggleResult = testRun(squiggleString);
|
||||||
expect(squiggleResult.value).toBeCloseTo(x + y + z);
|
expect(squiggleResult.value).toBeCloseTo(x + y + z);
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
import { errorValueToString } from "../../src/js/index";
|
|
||||||
import { testRun } from "./TestHelpers";
|
import { testRun } from "./TestHelpers";
|
||||||
import * as fc from "fast-check";
|
import * as fc from "fast-check";
|
||||||
|
|
||||||
describe("Symbolic mean", () => {
|
describe("Symbolic mean", () => {
|
||||||
test("mean(triangular(x,y,z))", () => {
|
test("mean(triangular(x,y,z))", () => {
|
||||||
fc.assert(
|
fc.assert(
|
||||||
fc.property(fc.float(), fc.float(), fc.float(), (x, y, z) => {
|
fc.property(fc.integer(), fc.integer(), fc.integer(), (x, y, z) => {
|
||||||
if (!(x < y && y < z)) {
|
if (!(x < y && y < z)) {
|
||||||
try {
|
try {
|
||||||
let squiggleResult = testRun(`mean(triangular(${x},${y},${z}))`);
|
let squiggleResult = testRun(`mean(triangular(${x},${y},${z}))`);
|
||||||
|
|
|
@ -19,7 +19,7 @@ do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
files=`ls src/rescript/**/**/*.resi src/rescript/**/*.resi` # src/rescript/*/resi
|
files=`ls src/rescript/**/*.resi` # src/rescript/*/resi
|
||||||
for file in $files
|
for file in $files
|
||||||
do
|
do
|
||||||
current=`cat $file`
|
current=`cat $file`
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
"bisect_ppx": "^2.7.1",
|
"bisect_ppx": "^2.7.1",
|
||||||
"chalk": "^5.0.1",
|
"chalk": "^5.0.1",
|
||||||
"codecov": "^3.8.3",
|
"codecov": "^3.8.3",
|
||||||
"fast-check": "^2.25.0",
|
"fast-check": "^3.0.0",
|
||||||
"gentype": "^4.4.0",
|
"gentype": "^4.4.0",
|
||||||
"jest": "^27.5.1",
|
"jest": "^27.5.1",
|
||||||
"moduleserve": "^0.9.1",
|
"moduleserve": "^0.9.1",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user