diff --git a/packages/squiggle-lang/__tests__/Distributions/Invariants/AlgebraicCombination_test.res b/packages/squiggle-lang/__tests__/Distributions/Invariants/AlgebraicCombination_test.res index 440d1120..c7e0ac46 100644 --- a/packages/squiggle-lang/__tests__/Distributions/Invariants/AlgebraicCombination_test.res +++ b/packages/squiggle-lang/__tests__/Distributions/Invariants/AlgebraicCombination_test.res @@ -1,5 +1,8 @@ /* -This file was going to be too big and it will be factored into smaller files. +This file is like a half measure between one-off unit tests and proper invariant validation. +As such, I'm not that excited about it, though it does provide some structure and will alarm us +when things substantially change. +Also, there are some open comments in https://github.com/quantified-uncertainty/squiggle/pull/232 that haven't been addressed. */ open Jest diff --git a/packages/squiggle-lang/__tests__/Distributions/Invariants/Means_test.res b/packages/squiggle-lang/__tests__/Distributions/Invariants/Means_test.res index d0d64f91..7bb53110 100644 --- a/packages/squiggle-lang/__tests__/Distributions/Invariants/Means_test.res +++ b/packages/squiggle-lang/__tests__/Distributions/Invariants/Means_test.res @@ -1,3 +1,11 @@ +/* +This is the most basic file in our invariants family of tests. + +See document in https://github.com/quantified-uncertainty/squiggle/pull/238 for details + +Note: digits parameter should be higher than -4. +*/ + open Jest open Expect open TestHelpers @@ -45,7 +53,13 @@ describe("Mean", () => { let zipDistsDists = E.L.zip(distributions, distributions) let digits = -4 - let testOperationMean = (distOp, description, floatOp, dist1', dist2') => { + let testOperationMean = ( + distOp: (DistributionTypes.genericDist, DistributionTypes.genericDist) => result, + description: string, + floatOp: (float, float) => float, + dist1': result, + dist2': result + ) => { let dist1 = dist1'->E.R2.fmap(x=>DistributionTypes.Symbolic(x))->E.R2.fmap2(s=>DistributionTypes.Other(s)) let dist2 = dist2'->E.R2.fmap(x=>DistributionTypes.Symbolic(x))->E.R2.fmap2(s=>DistributionTypes.Other(s)) let received = @@ -72,12 +86,12 @@ describe("Mean", () => { testAdditionMean(dist1, dist2) }) - testAll("heterogeneoous addition (1)", combinations, dists => { + testAll("heterogeneous addition (1)", combinations, dists => { let (dist1, dist2) = dists testAdditionMean(dist1, dist2) }) - testAll("heterogeneoous addition (commuted of 1 (or; 2))", combinations, dists => { + testAll("heterogeneous addition (commuted of 1 (or; 2))", combinations, dists => { let (dist1, dist2) = dists testAdditionMean(dist2, dist1) }) @@ -91,12 +105,12 @@ describe("Mean", () => { testSubtractionMean(dist1, dist2) }) - testAll("heterogeneoous subtraction (1)", combinations, dists => { + testAll("heterogeneous subtraction (1)", combinations, dists => { let (dist1, dist2) = dists testSubtractionMean(dist1, dist2) }) - testAll("heterogeneoous subtraction (commuted of 1 (or; 2))", combinations, dists => { + testAll("heterogeneous subtraction (commuted of 1 (or; 2))", combinations, dists => { let (dist1, dist2) = dists testSubtractionMean(dist2, dist1) })