factored into TestHelpers.ts file
This commit is contained in:
parent
1395a36c63
commit
4f5a1ff946
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
|
@ -81,6 +81,7 @@ jobs:
|
||||||
run: yarn coverage:rescript:ci
|
run: yarn coverage:rescript:ci
|
||||||
- name: Upload typescript coverage report
|
- name: Upload typescript coverage report
|
||||||
run: yarn coverage:ts:ci
|
run: yarn coverage:ts:ci
|
||||||
|
|
||||||
components-lint:
|
components-lint:
|
||||||
name: Components lint
|
name: Components lint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
1
packages/squiggle-lang/.gitignore
vendored
1
packages/squiggle-lang/.gitignore
vendored
|
@ -20,3 +20,4 @@ dist
|
||||||
*.coverage
|
*.coverage
|
||||||
_coverage
|
_coverage
|
||||||
coverage
|
coverage
|
||||||
|
.nyc_output/
|
||||||
|
|
|
@ -1,19 +1,6 @@
|
||||||
import {
|
import { errorValueToString } from "../../src/js/index";
|
||||||
run,
|
|
||||||
Distribution,
|
|
||||||
squiggleExpression,
|
|
||||||
errorValueToString,
|
|
||||||
errorValue,
|
|
||||||
result,
|
|
||||||
} from "../../src/js/index";
|
|
||||||
import * as fc from "fast-check";
|
import * as fc from "fast-check";
|
||||||
|
import { testRun } from "./TestHelpers";
|
||||||
let testRun = (x: string): any => {
|
|
||||||
//result<squiggleExpression, errorValue> => {
|
|
||||||
return run(x, { sampleCount: 1000, xyPointLength: 100 });
|
|
||||||
};
|
|
||||||
|
|
||||||
let failDefault = () => expect("codepath should never").toBe("be reached");
|
|
||||||
|
|
||||||
describe("Jstat: cumulative density function", () => {
|
describe("Jstat: cumulative density function", () => {
|
||||||
test("of a normal distribution at 3 stdevs to the right of the mean is within epsilon of 1", () => {
|
test("of a normal distribution at 3 stdevs to the right of the mean is within epsilon of 1", () => {
|
||||||
|
|
|
@ -4,12 +4,9 @@ import {
|
||||||
errorValue,
|
errorValue,
|
||||||
result,
|
result,
|
||||||
} from "../../src/js/index";
|
} from "../../src/js/index";
|
||||||
|
import { testRun } from "./TestHelpers";
|
||||||
import * as fc from "fast-check";
|
import * as fc from "fast-check";
|
||||||
|
|
||||||
let testRun = (x: string): result<squiggleExpression, errorValue> => {
|
|
||||||
return run(x, { sampleCount: 1000, xyPointLength: 100 });
|
|
||||||
};
|
|
||||||
|
|
||||||
describe("Squiggle is whitespace insensitive", () => {
|
describe("Squiggle is whitespace insensitive", () => {
|
||||||
test("when assigning a distribution to a name and calling that name", () => {
|
test("when assigning a distribution to a name and calling that name", () => {
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,19 +1,6 @@
|
||||||
import {
|
import { Distribution } from "../../src/js/index";
|
||||||
run,
|
|
||||||
Distribution,
|
|
||||||
squiggleExpression,
|
|
||||||
errorValueToString,
|
|
||||||
errorValue,
|
|
||||||
result,
|
|
||||||
} from "../../src/js/index";
|
|
||||||
import * as fc from "fast-check";
|
import * as fc from "fast-check";
|
||||||
|
|
||||||
let testRun = (x: string): result<squiggleExpression, errorValue> => {
|
|
||||||
return run(x, { sampleCount: 1000, xyPointLength: 100 });
|
|
||||||
};
|
|
||||||
|
|
||||||
let failDefault = () => expect("codepath should never").toBe("be reached");
|
|
||||||
|
|
||||||
// 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({
|
||||||
|
|
|
@ -1,18 +1,7 @@
|
||||||
import {
|
import { errorValueToString } from "../../src/js/index";
|
||||||
run,
|
import { testRun } from "./TestHelpers";
|
||||||
Distribution,
|
|
||||||
resultMap,
|
|
||||||
squiggleExpression,
|
|
||||||
errorValueToString,
|
|
||||||
errorValue,
|
|
||||||
result,
|
|
||||||
} from "../../src/js/index";
|
|
||||||
import * as fc from "fast-check";
|
import * as fc from "fast-check";
|
||||||
|
|
||||||
let testRun = (x: string): result<squiggleExpression, errorValue> => {
|
|
||||||
return run(x, { sampleCount: 100, xyPointLength: 100 });
|
|
||||||
};
|
|
||||||
|
|
||||||
describe("Scalar manipulation is well-modeled by javascript math", () => {
|
describe("Scalar manipulation is well-modeled by javascript math", () => {
|
||||||
test("in the case of logarithms (with assignment)", () => {
|
test("in the case of logarithms (with assignment)", () => {
|
||||||
fc.assert(
|
fc.assert(
|
||||||
|
|
|
@ -5,12 +5,9 @@ import {
|
||||||
errorValue,
|
errorValue,
|
||||||
result,
|
result,
|
||||||
} from "../../src/js/index";
|
} from "../../src/js/index";
|
||||||
|
import { testRun } from "./TestHelpers";
|
||||||
import * as fc from "fast-check";
|
import * as fc from "fast-check";
|
||||||
|
|
||||||
let testRun = (x: string): result<squiggleExpression, errorValue> => {
|
|
||||||
return run(x, { sampleCount: 100, xyPointLength: 100 });
|
|
||||||
};
|
|
||||||
|
|
||||||
describe("Symbolic mean", () => {
|
describe("Symbolic mean", () => {
|
||||||
let triangularInputError = {
|
let triangularInputError = {
|
||||||
tag: "Error",
|
tag: "Error",
|
||||||
|
|
17
packages/squiggle-lang/__tests__/TS/TestHelpers.ts
Normal file
17
packages/squiggle-lang/__tests__/TS/TestHelpers.ts
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import {
|
||||||
|
run,
|
||||||
|
Distribution,
|
||||||
|
squiggleExpression,
|
||||||
|
errorValueToString,
|
||||||
|
errorValue,
|
||||||
|
result,
|
||||||
|
} from "../../src/js/index";
|
||||||
|
|
||||||
|
export function testRun(x: string): any {
|
||||||
|
//: result<squiggleExpression, errorValue> => {
|
||||||
|
return run(x, { sampleCount: 1000, xyPointLength: 100 });
|
||||||
|
}
|
||||||
|
|
||||||
|
export function failDefault() {
|
||||||
|
expect("be reached").toBe("codepath should never be");
|
||||||
|
}
|
|
@ -9,5 +9,6 @@ module.exports = {
|
||||||
".*Fixtures.bs.js",
|
".*Fixtures.bs.js",
|
||||||
"/node_modules/",
|
"/node_modules/",
|
||||||
".*Helpers.bs.js",
|
".*Helpers.bs.js",
|
||||||
|
".*Helpers.ts",
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
"test:reducer": "jest __tests__/Reducer*/",
|
"test:reducer": "jest __tests__/Reducer*/",
|
||||||
"test:watch": "jest --watchAll",
|
"test:watch": "jest --watchAll",
|
||||||
"coverage:rescript": "rm -f *.coverage; yarn clean; BISECT_ENABLE=yes yarn build; yarn test:rescript; bisect-ppx-report html",
|
"coverage:rescript": "rm -f *.coverage; yarn clean; BISECT_ENABLE=yes yarn build; yarn test:rescript; bisect-ppx-report html",
|
||||||
"coverage:ts": "nyc yarn test:ts",
|
"coverage:ts": "nyc --reporter=lcov yarn test:ts",
|
||||||
"coverage:rescript:ci": "yarn clean; BISECT_ENABLE=yes yarn build; yarn test; bisect-ppx-report send-to Codecov",
|
"coverage:rescript:ci": "yarn clean; BISECT_ENABLE=yes yarn build; yarn test:rescript; bisect-ppx-report send-to Codecov",
|
||||||
"coverage:ts:ci": "nyc --reporter=lcov yarn test:ts && codecov",
|
"coverage:ts:ci": "yarn coverage:ts && codecov",
|
||||||
"lint:rescript": "./lint.sh",
|
"lint:rescript": "./lint.sh",
|
||||||
"lint:prettier": "prettier --check .",
|
"lint:prettier": "prettier --check .",
|
||||||
"lint": "yarn lint:rescript && yarn lint:prettier",
|
"lint": "yarn lint:rescript && yarn lint:prettier",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user