deno.land / x / simplestatistic@v7.7.1 / test / variance.test.js

variance.test.js
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* eslint no-shadow: 0 */
const test = require("tap").test;const ss = require("../");
function rnd(x) { return Math.round(x * 1000) / 1000;}
test("variance", function (t) { t.test("can get the variance of a six-sided die", function (t) { t.equal(rnd(ss.variance([1, 2, 3, 4, 5, 6])), 2.917); t.end(); });
t.test("the variance of one number is zero", function (t) { t.equal(rnd(ss.variance([1])), 0); t.end(); });
t.test("the variance of no numbers cannot be calculated", function (t) { t.throws(function () { ss.variance([]); }); t.end(); }); t.end();});
simplestatistic

Version Info

Tagged at
2 years ago