Run prettier + add missing pointWiseAdd signature

This commit is contained in:
Sam Nolan 2022-04-11 11:08:34 +10:00
parent 8f49b64083
commit d6c541036f
2 changed files with 9 additions and 11 deletions

View File

@ -1,8 +1,4 @@
import {
run,
Distribution,
resultMap,
} from "../src/js/index";
import { run, Distribution, resultMap } from "../src/js/index";
let testRun = (x: string) => {
let result = run(x);
@ -14,7 +10,7 @@ let testRun = (x: string) => {
};
function Ok<b>(x: b) {
return { tag: "Ok", value: x}
return { tag: "Ok", value: x };
}
describe("Simple calculations and results", () => {
@ -81,14 +77,16 @@ describe("Distribution", () => {
});
test("algebraicAdd", () => {
expect(
resultMap(dist.algebraicAdd(dist2), (r: Distribution) => r.toSparkline(20))
.value
resultMap(dist.algebraicAdd(dist2), (r: Distribution) =>
r.toSparkline(20)
).value
).toEqual(Ok("▁▁▂▄▆████▇▆▄▄▃▃▃▂▁▁▁"));
});
test("pointwiseAdd", () => {
expect(
resultMap(dist.pointwiseAdd(dist2), (r: Distribution) => r.toSparkline(20))
.value
resultMap(dist.pointwiseAdd(dist2), (r: Distribution) =>
r.toSparkline(20)
).value
).toEqual(Ok("▁▂▅██▅▅▅▆▇█▆▅▃▃▂▂▁▁▁"));
});
});

View File

@ -185,7 +185,7 @@ export class Distribution {
);
}
pointwiseAdd(d2: Distribution) {
pointwiseAdd(d2: Distribution): result<Distribution, error> {
return this.mapResultDist(
Constructors_pointwiseAdd({ env: this.env }, this.t, d2.t)
);