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

bisect.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
/* eslint no-shadow: 0 */
const test = require("tap").test;const bisect = require("../").bisect;
test("bisect", function (t) { t.test("can find root of sin and cos", function (t) { t.equal(Number(bisect(Math.sin, 1, 4, 100, 0.003).toFixed(4)), 3.1416); t.equal(Number(bisect(Math.cos, 0, 4, 100, 0.003).toFixed(4)), 1.5723); t.throws(function () { t.equal( Number(bisect(Math.cos, 0, 4, 1, 0.003).toFixed(4)), 1.5723 ); }, "Throws if it exceeds the number of iterations allowed"); t.throws(function () { bisect(0); }, "Throws with syntax error f must be a function"); t.end(); }); t.end();});
simplestatistic

Version Info

Tagged at
2 years ago