Fix failing lang tests due to rename
This commit is contained in:
parent
e5baf23950
commit
8f49b64083
|
@ -1,8 +1,7 @@
|
||||||
import {
|
import {
|
||||||
run,
|
run,
|
||||||
GenericDist,
|
Distribution,
|
||||||
resultMap,
|
resultMap,
|
||||||
makeSampleSetDist,
|
|
||||||
} from "../src/js/index";
|
} from "../src/js/index";
|
||||||
|
|
||||||
let testRun = (x: string) => {
|
let testRun = (x: string) => {
|
||||||
|
@ -14,6 +13,10 @@ let testRun = (x: string) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function Ok<b>(x: b) {
|
||||||
|
return { tag: "Ok", value: x}
|
||||||
|
}
|
||||||
|
|
||||||
describe("Simple calculations and results", () => {
|
describe("Simple calculations and results", () => {
|
||||||
test("mean(normal(5,2))", () => {
|
test("mean(normal(5,2))", () => {
|
||||||
expect(testRun("mean(normal(5,2))")).toEqual({
|
expect(testRun("mean(normal(5,2))")).toEqual({
|
||||||
|
@ -43,15 +46,15 @@ describe("Multimodal too many weights error", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("GenericDist", () => {
|
describe("Distribution", () => {
|
||||||
//It's important that sampleCount is less than 9. If it's more, than that will create randomness
|
//It's important that sampleCount is less than 9. If it's more, than that will create randomness
|
||||||
//Also, note, the value should be created using makeSampleSetDist() later on.
|
//Also, note, the value should be created using makeSampleSetDist() later on.
|
||||||
let env = { sampleCount: 8, xyPointLength: 100 };
|
let env = { sampleCount: 8, xyPointLength: 100 };
|
||||||
let dist = new GenericDist(
|
let dist = new Distribution(
|
||||||
{ tag: "SampleSet", value: [3, 4, 5, 6, 6, 7, 10, 15, 30] },
|
{ tag: "SampleSet", value: [3, 4, 5, 6, 6, 7, 10, 15, 30] },
|
||||||
env
|
env
|
||||||
);
|
);
|
||||||
let dist2 = new GenericDist(
|
let dist2 = new Distribution(
|
||||||
{ tag: "SampleSet", value: [20, 22, 24, 29, 30, 35, 38, 44, 52] },
|
{ tag: "SampleSet", value: [20, 22, 24, 29, 30, 35, 38, 44, 52] },
|
||||||
env
|
env
|
||||||
);
|
);
|
||||||
|
@ -70,22 +73,22 @@ describe("GenericDist", () => {
|
||||||
});
|
});
|
||||||
test("toPointSet", () => {
|
test("toPointSet", () => {
|
||||||
expect(
|
expect(
|
||||||
resultMap(dist.toPointSet(), (r: GenericDist) => r.toString()).value.value
|
resultMap(dist.toPointSet(), (r: Distribution) => r.toString()).value
|
||||||
).toBe("Point Set Distribution");
|
).toEqual(Ok("Point Set Distribution"));
|
||||||
});
|
});
|
||||||
test("toSparkline", () => {
|
test("toSparkline", () => {
|
||||||
expect(dist.toSparkline(20).value).toBe("▁▁▃▅███▆▄▃▂▁▁▂▂▃▂▁▁▁");
|
expect(dist.toSparkline(20).value).toEqual("▁▁▃▅███▆▄▃▂▁▁▂▂▃▂▁▁▁");
|
||||||
});
|
});
|
||||||
test("algebraicAdd", () => {
|
test("algebraicAdd", () => {
|
||||||
expect(
|
expect(
|
||||||
resultMap(dist.algebraicAdd(dist2), (r: GenericDist) => r.toSparkline(20))
|
resultMap(dist.algebraicAdd(dist2), (r: Distribution) => r.toSparkline(20))
|
||||||
.value.value
|
.value
|
||||||
).toBe("▁▁▂▄▆████▇▆▄▄▃▃▃▂▁▁▁");
|
).toEqual(Ok("▁▁▂▄▆████▇▆▄▄▃▃▃▂▁▁▁"));
|
||||||
});
|
});
|
||||||
test("pointwiseAdd", () => {
|
test("pointwiseAdd", () => {
|
||||||
expect(
|
expect(
|
||||||
resultMap(dist.pointwiseAdd(dist2), (r: GenericDist) => r.toSparkline(20))
|
resultMap(dist.pointwiseAdd(dist2), (r: Distribution) => r.toSparkline(20))
|
||||||
.value.value
|
.value
|
||||||
).toBe("▁▂▅██▅▅▅▆▇█▆▅▃▃▂▂▁▁▁");
|
).toEqual(Ok("▁▂▅██▅▅▅▆▇█▆▅▃▃▂▂▁▁▁"));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user