summaryrefslogtreecommitdiff
path: root/modules/Util.test.js
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-05-29 14:50:55 -0500
committersanine <sanine.not@pm.me>2022-05-29 14:50:55 -0500
commit3bc2838360627f78a91a7cad81f3bc97711410c2 (patch)
tree54d260b45895c1923a785efce817b94836660f35 /modules/Util.test.js
parentd35e02ecdcef6d4f120bd572f2aae36b467b7761 (diff)
refactor: move everything into src/ subdirectory
Diffstat (limited to 'modules/Util.test.js')
-rw-r--r--modules/Util.test.js23
1 files changed, 0 insertions, 23 deletions
diff --git a/modules/Util.test.js b/modules/Util.test.js
deleted file mode 100644
index 000d54e..0000000
--- a/modules/Util.test.js
+++ /dev/null
@@ -1,23 +0,0 @@
-import { test, assert} from './test-assert.js';
-import { useAverage } from './Util.js';
-
-
-test('Average correctly accumulates an average', () => {
- let [avg, avg_append] = useAverage();
- let data = [];
- for (let i=0; i<5000; i++) {
- let d = Math.random();
- data.push(d);
- avg_append(d);
- }
-
- let manual_average = 0;
- for (let d of data) manual_average += d;
- manual_average /= data.length;
-
- const precision = (decimalPlaces, num) => {
- const theta = 10**decimalPlaces;
- return Math.floor(num * theta) / theta;
- };
- assert.equal(precision(5, avg()), precision(5, manual_average));
-});