Adds tests (3)
This commit is contained in:
parent
fb4bc52324
commit
f553fb742e
|
@ -50,4 +50,14 @@ describe("Functions", () => {
|
|||
test("mean#3", () => {
|
||||
expect(Functions.mean([|1., 2., 3., (-2.), (-10.)|])) |> toEqual(-1.2)
|
||||
});
|
||||
test("min#1", () => {
|
||||
expect(Functions.min([|1., 2., 3.|])) |> toEqual(1.)
|
||||
});
|
||||
test("min#2", () => {
|
||||
expect(Functions.min([|(-1.), (-2.), 0., 20.|])) |> toEqual(-2.)
|
||||
});
|
||||
test("min#3", () => {
|
||||
expect(Functions.min([|(-1.), (-2.), 0., 20., (-2.2)|]))
|
||||
|> toEqual(-2.2)
|
||||
});
|
||||
});
|
||||
|
|
|
@ -11,7 +11,7 @@ let interpolate =
|
|||
// @todo: To test!
|
||||
let sum = Belt.Array.reduce(_, 0., (i, j) => i +. j);
|
||||
let mean = a => sum(a) /. (Array.length(a) |> float_of_int);
|
||||
let min = Belt.Array.reduce(_, 0., (i, j) => i < j ? i : j);
|
||||
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 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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user