factored into TestHelpers.ts file

This commit is contained in:
Quinn Dougherty 2022-04-19 23:42:24 -04:00
parent 1395a36c63
commit 4f5a1ff946
10 changed files with 30 additions and 53 deletions

View File

@ -81,6 +81,7 @@ jobs:
run: yarn coverage:rescript:ci
- name: Upload typescript coverage report
run: yarn coverage:ts:ci
components-lint:
name: Components lint
runs-on: ubuntu-latest

View File

@ -20,3 +20,4 @@ dist
*.coverage
_coverage
coverage
.nyc_output/

View File

@ -1,19 +1,6 @@
import {
run,
Distribution,
squiggleExpression,
errorValueToString,
errorValue,
result,
} from "../../src/js/index";
import { errorValueToString } from "../../src/js/index";
import * as fc from "fast-check";
let testRun = (x: string): any => {
//result<squiggleExpression, errorValue> => {
return run(x, { sampleCount: 1000, xyPointLength: 100 });
};
let failDefault = () => expect("codepath should never").toBe("be reached");
import { testRun } from "./TestHelpers";
describe("Jstat: cumulative density function", () => {
test("of a normal distribution at 3 stdevs to the right of the mean is within epsilon of 1", () => {

View File

@ -4,12 +4,9 @@ import {
errorValue,
result,
} from "../../src/js/index";
import { testRun } from "./TestHelpers";
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", () => {
test("when assigning a distribution to a name and calling that name", () => {
/*

View File

@ -1,19 +1,6 @@
import {
run,
Distribution,
squiggleExpression,
errorValueToString,
errorValue,
result,
} from "../../src/js/index";
import { Distribution } from "../../src/js/index";
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.
let arrayGen = () =>
fc.float32Array({

View File

@ -1,18 +1,7 @@
import {
run,
Distribution,
resultMap,
squiggleExpression,
errorValueToString,
errorValue,
result,
} from "../../src/js/index";
import { errorValueToString } from "../../src/js/index";
import { testRun } from "./TestHelpers";
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", () => {
test("in the case of logarithms (with assignment)", () => {
fc.assert(

View File

@ -5,12 +5,9 @@ import {
errorValue,
result,
} from "../../src/js/index";
import { testRun } from "./TestHelpers";
import * as fc from "fast-check";
let testRun = (x: string): result<squiggleExpression, errorValue> => {
return run(x, { sampleCount: 100, xyPointLength: 100 });
};
describe("Symbolic mean", () => {
let triangularInputError = {
tag: "Error",

View 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");
}

View File

@ -9,5 +9,6 @@ module.exports = {
".*Fixtures.bs.js",
"/node_modules/",
".*Helpers.bs.js",
".*Helpers.ts",
],
};

View File

@ -14,9 +14,9 @@
"test:reducer": "jest __tests__/Reducer*/",
"test:watch": "jest --watchAll",
"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:rescript:ci": "yarn clean; BISECT_ENABLE=yes yarn build; yarn test; bisect-ppx-report send-to Codecov",
"coverage:ts:ci": "nyc --reporter=lcov yarn test:ts && codecov",
"coverage:ts": "nyc --reporter=lcov yarn test:ts",
"coverage:rescript:ci": "yarn clean; BISECT_ENABLE=yes yarn build; yarn test:rescript; bisect-ppx-report send-to Codecov",
"coverage:ts:ci": "yarn coverage:ts && codecov",
"lint:rescript": "./lint.sh",
"lint:prettier": "prettier --check .",
"lint": "yarn lint:rescript && yarn lint:prettier",