Merge pull request #190 from QURIresearch/testing-discipline-one
rescript coverage reports
This commit is contained in:
commit
a6b9b03941
2
packages/squiggle-lang/.gitignore
vendored
2
packages/squiggle-lang/.gitignore
vendored
|
@ -17,3 +17,5 @@ yarn-error.log
|
|||
*.gen.tsx
|
||||
*.gen.js
|
||||
dist
|
||||
*.coverage
|
||||
_coverage
|
||||
|
|
|
@ -6,7 +6,7 @@ let env: DistributionOperation.env = {
|
|||
xyPointLength: 100,
|
||||
}
|
||||
|
||||
let normalDist: GenericDist_Types.genericDist = Symbolic(#Normal({mean: 5.0, stdev: 2.0}))
|
||||
let normalDist5: GenericDist_Types.genericDist = Symbolic(#Normal({mean: 5.0, stdev: 2.0}))
|
||||
let normalDist10: GenericDist_Types.genericDist = Symbolic(#Normal({mean: 10.0, stdev: 2.0}))
|
||||
let normalDist20: GenericDist_Types.genericDist = Symbolic(#Normal({mean: 20.0, stdev: 2.0}))
|
||||
let uniformDist: GenericDist_Types.genericDist = Symbolic(#Uniform({low: 9.0, high: 10.0}))
|
||||
|
@ -22,14 +22,14 @@ let toExt: option<'a> => 'a = E.O.toExt(
|
|||
|
||||
describe("normalize", () => {
|
||||
test("has no impact on normal dist", () => {
|
||||
let result = run(FromDist(ToDist(Normalize), normalDist))
|
||||
expect(result)->toEqual(Dist(normalDist))
|
||||
let result = run(FromDist(ToDist(Normalize), normalDist5))
|
||||
expect(result)->toEqual(Dist(normalDist5))
|
||||
})
|
||||
})
|
||||
|
||||
describe("mean", () => {
|
||||
test("for a normal distribution", () => {
|
||||
let result = DistributionOperation.run(~env, FromDist(ToFloat(#Mean), normalDist))
|
||||
let result = DistributionOperation.run(~env, FromDist(ToFloat(#Mean), normalDist5))
|
||||
expect(result)->toEqual(Float(5.0))
|
||||
})
|
||||
})
|
||||
|
@ -48,7 +48,7 @@ describe("mixture", () => {
|
|||
describe("toPointSet", () => {
|
||||
test("on symbolic normal distribution", () => {
|
||||
let result =
|
||||
run(FromDist(ToDist(ToPointSet), normalDist))
|
||||
run(FromDist(ToDist(ToPointSet), normalDist5))
|
||||
->outputMap(FromDist(ToFloat(#Mean)))
|
||||
->toFloat
|
||||
->toExt
|
||||
|
@ -65,7 +65,7 @@ describe("toPointSet", () => {
|
|||
|
||||
Skip.test("on sample set", () => {
|
||||
let result =
|
||||
run(FromDist(ToDist(ToPointSet), normalDist))
|
||||
run(FromDist(ToDist(ToPointSet), normalDist5))
|
||||
->outputMap(FromDist(ToDist(ToSampleSet(1000))))
|
||||
->outputMap(FromDist(ToDist(ToPointSet)))
|
||||
->outputMap(FromDist(ToFloat(#Mean)))
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
{
|
||||
"name": "@quri/squiggle-lang",
|
||||
"reason": {},
|
||||
"sources": [
|
||||
{
|
||||
"dir": "src/rescript",
|
||||
|
@ -28,7 +27,8 @@
|
|||
"bs-dependencies": [
|
||||
"@glennsl/rescript-jest",
|
||||
"@glennsl/bs-json",
|
||||
"rationale"
|
||||
"rationale",
|
||||
"bisect_ppx"
|
||||
],
|
||||
"gentypeconfig": {
|
||||
"language": "typescript",
|
||||
|
@ -43,5 +43,11 @@
|
|||
"warnings": {
|
||||
"number": "+A-42-48-9-30-4-102-20-27-41"
|
||||
},
|
||||
"ppx-flags": []
|
||||
"ppx-flags": [
|
||||
[
|
||||
"../../node_modules/bisect_ppx/ppx",
|
||||
"--exclude-files",
|
||||
".*_Test\\.res$$"
|
||||
]
|
||||
]
|
||||
}
|
||||
|
|
|
@ -2,4 +2,7 @@
|
|||
module.exports = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
setupFilesAfterEnv: [
|
||||
"<rootdir>/../../node_modules/bisect_ppx/src/runtime/js/jest.bs.js"
|
||||
],
|
||||
};
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
"test:reducer": "jest --testPathPattern '.*__tests__/Reducer.*'",
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watchAll",
|
||||
"coverage": "rm -f *.coverage; yarn clean; BISECT_ENABLE=yes yarn build; yarn test; ./node_modules/.bin/bisect-ppx-report html",
|
||||
"all": "yarn build && yarn bundle && yarn test"
|
||||
},
|
||||
"keywords": [
|
||||
|
@ -24,7 +25,8 @@
|
|||
"mathjs": "10.4.1",
|
||||
"pdfast": "^0.2.0",
|
||||
"rationale": "0.2.0",
|
||||
"rescript": "^9.1.4"
|
||||
"rescript": "^9.1.4",
|
||||
"bisect_ppx": "^2.7.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@glennsl/rescript-jest": "^0.9.0",
|
||||
|
|
Loading…
Reference in New Issue
Block a user