diff --git a/__tests__/Bandwidth__Test.re b/__tests__/Bandwidth__Test.re new file mode 100644 index 00000000..e8dfcf8f --- /dev/null +++ b/__tests__/Bandwidth__Test.re @@ -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); + }); +}); \ No newline at end of file diff --git a/package.json b/package.json index aab31893..6d5c6342 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/yarn.lock b/yarn.lock index 3f52b481..01e751af 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"