Apply item 0xa95f32ea for issue #2

Squash of the patch of item 0xa95f32ea03bfe95df656140edb88432fac22efa32917418f73d0f29ce155ecd0, final in the elffuss ledger.
Solver 0xeb104004d5d1c1f091d70119cbfe17b6370433f1; 2 approvals of round 0.

T2T-Item: 0xa95f32ea03bfe95df656140edb88432fac22efa32917418f73d0f29ce155ecd0
T2T-Issue: 0xc0ae452fd36bac337ec3f451e6383702e4d49a1fb1113ea26024dff8f4d296c1
T2T-Event: 0xb52e3d5f828c1af808612b98fd666596d74eba5a9b707c9b50edc4495e360024
This commit is contained in:
elffuss-bot
2026-10-03 08:40:21 +00:00
parent e4c6cf14da
commit f4ed249874
3 changed files with 32 additions and 1 deletions

View File

@@ -0,0 +1,18 @@
{
"schema": "elffuss-t2t/criteria@2",
"issue": 2,
"criteria": [
{
"index": 1,
"tests": [
"tests/acceptance/2/criteria.test.js::criterion 1"
]
},
{
"index": 2,
"tests": [
"tests/acceptance/2/criteria.test.js::criterion 2"
]
}
]
}

View File

@@ -0,0 +1,13 @@
import test from 'node:test';
import assert from 'node:assert/strict';
const mod = await import('../../../diarize.mjs');
test('criterion 1', () => {
assert.throws(() => mod.cosine([1, 2, 3], [1, 2]), (err) => err instanceof Error && err.message.startsWith('cosine:'));
assert.equal(mod.cosine([1, 0], [1, 0]), 1);
});
test('criterion 2', () => {
assert.throws(() => mod.cosine([1, 0], [1, 0, 5]), (err) => err instanceof Error && err.message.startsWith('cosine:'));
assert.equal(mod.cosine([0, 0], [0, 0]), 0);
});