Adds tests (4)
This commit is contained in:
parent
f553fb742e
commit
822a803d01
|
@ -60,4 +60,13 @@ describe("Functions", () => {
|
|||
expect(Functions.min([|(-1.), (-2.), 0., 20., (-2.2)|]))
|
||||
|> toEqual(-2.2)
|
||||
});
|
||||
test("max#1", () => {
|
||||
expect(Functions.max([|1., 2., 3.|])) |> toEqual(3.)
|
||||
});
|
||||
test("max#2", () => {
|
||||
expect(Functions.max([|(-1.), (-2.), 0., 20.|])) |> toEqual(20.)
|
||||
});
|
||||
test("max#3", () => {
|
||||
expect(Functions.max([|(-1.), (-2.), 0., (-2.2)|])) |> toEqual(0.)
|
||||
});
|
||||
});
|
||||
|
|
|
@ -12,7 +12,7 @@ let interpolate =
|
|||
let sum = Belt.Array.reduce(_, 0., (i, j) => i +. j);
|
||||
let mean = a => sum(a) /. (Array.length(a) |> float_of_int);
|
||||
let min = a => Belt.Array.reduce(a, a[0], (i, j) => i < j ? i : j);
|
||||
let max = Belt.Array.reduce(_, 0., (i, j) => i > j ? i : j);
|
||||
let max = a => Belt.Array.reduce(a, a[0], (i, j) => i > j ? i : j);
|
||||
let up = (a, b) => Array.make(b - a, a) |> Array.mapi((i, c) => c + i);
|
||||
let down = (a, b) => Array.make(a - b, a) |> Array.mapi((i, c) => c - i);
|
||||
let range = (min: float, max: float, n: int): array(float) => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user