Fixed tests
This commit is contained in:
parent
ec5dc4667f
commit
c94a70b93a
|
@ -1,4 +1,4 @@
|
|||
import { run, GenericDist, resultMap } from "../src/js/index";
|
||||
import { run, GenericDist, resultMap, makeSampleSetDist } from "../src/js/index";
|
||||
|
||||
let testRun = (x: string) => {
|
||||
let result = run(x);
|
||||
|
@ -41,6 +41,7 @@ describe("Multimodal too many weights error", () => {
|
|||
describe("GenericDist", () => {
|
||||
|
||||
//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.
|
||||
let env = { sampleCount: 8, xyPointLength: 100 };
|
||||
let dist = new GenericDist(
|
||||
{ tag: "SampleSet", value: [3, 4, 5, 6, 6, 7, 10, 15, 30] },
|
||||
|
|
|
@ -14,6 +14,7 @@ import {
|
|||
resultFloat,
|
||||
resultString,
|
||||
} from "../rescript/TypescriptInterface.gen";
|
||||
export {makeSampleSetDist} from "../rescript/TypescriptInterface.gen";
|
||||
import {
|
||||
Constructors_mean,
|
||||
Constructors_sample,
|
||||
|
@ -79,6 +80,10 @@ export function resultMap(r: result, mapFn: any): result {
|
|||
}
|
||||
}
|
||||
|
||||
export function resultExn(r: result): any {
|
||||
r.value
|
||||
}
|
||||
|
||||
export class GenericDist {
|
||||
t: genericDist;
|
||||
env: env;
|
||||
|
|
|
@ -4,8 +4,10 @@ this constructor.
|
|||
https://stackoverflow.com/questions/66909578/how-to-make-a-type-constructor-private-in-rescript-except-in-current-module
|
||||
*/
|
||||
module T: {
|
||||
//This really should be hidden (remove the array<float>). The reason it isn't is to act as an escape hatch in JS__Test.ts.
|
||||
//When we get a good functional library in TS, we could refactor that out.
|
||||
@genType
|
||||
type t
|
||||
type t = array<float>
|
||||
let make: array<float> => result<t, string>
|
||||
let get: t => array<float>
|
||||
} = {
|
||||
|
|
|
@ -22,3 +22,6 @@ type resultDist = result<genericDist, error>
|
|||
type resultFloat = result<float, error>
|
||||
@genType
|
||||
type resultString = result<string, error>
|
||||
|
||||
@genType
|
||||
let makeSampleSetDist = SampleSetDist.make
|
Loading…
Reference in New Issue
Block a user