Adds bandwidth tests

This commit is contained in:
Roman Galochkin 2020-04-03 13:25:42 +03:00
parent 88358470e3
commit 2dca2d5dd9
3 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,19 @@
open Jest;
open Expect;
[@bs.val] [@bs.module "science"] [@bs.scope ("stats", "bandwidth")]
external nrd0: array(float) => float = "nrd0";
[@bs.val] [@bs.module "science"] [@bs.scope ("stats", "bandwidth")]
external nrd: array(float) => float = "nrd";
describe("Bandwidth", () => {
test("nrd0 1", () => {
let data = [|1., 4., 3., 2.|];
expect(nrd0(data)) |> toEqual(0.7635139420854616);
});
test("nrd0 2", () => {
let data = [|1., 4., 3., 2.|];
expect(nrd(data)) |> toEqual(0.899249754011766);
});
});

View File

@ -60,7 +60,8 @@
"react-use": "^13.27.0",
"reason-react": ">=0.7.0",
"reschema": "1.3.0",
"tailwindcss": "1.2.0"
"tailwindcss": "1.2.0",
"science": "1.9.3"
},
"alias": {
"react": "./node_modules/react",

View File

@ -8579,6 +8579,11 @@ scheduler@^0.19.0:
loose-envify "^1.1.0"
object-assign "^4.1.1"
science@1.9.3:
version "1.9.3"
resolved "https://registry.yarnpkg.com/science/-/science-1.9.3.tgz#ec89bac44aeff2e5a2d749aa496f377089903dd4"
integrity sha1-7Im6xErv8uWi10mqSW83cImQPdQ=
screenfull@^5.0.0:
version "5.0.2"
resolved "https://registry.yarnpkg.com/screenfull/-/screenfull-5.0.2.tgz#b9acdcf1ec676a948674df5cd0ff66b902b0bed7"