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

bernoulli_distribution.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
/* eslint no-shadow: 0 */
const test = require("tap").test;const ss = require("../");
test("bernoulliDistribution", function (t) { t.test( "can return generate probability and cumulative probability distributions for p = 0.3", function (t) { t.ok(Array.isArray(ss.bernoulliDistribution(0.3))); t.equal(ss.bernoulliDistribution(0.3)[0], 0.7, ss.epsilon); t.equal(ss.bernoulliDistribution(0.3)[1], 0.3, ss.epsilon); t.end(); } ); t.test("can return null when p is not a valid probability", function (t) { t.throws(function () { ss.bernoulliDistribution(-0.01); }, "p should be greater than 0.0"); t.throws(function () { ss.bernoulliDistribution(1.5); }, "p should be less than 1.0"); t.end(); }); t.end();});
simplestatistic

Version Info

Tagged at
2 years ago