Skip to content

Commit

Permalink
test: usearch-js expected results
Browse files Browse the repository at this point in the history
  • Loading branch information
jlarmstrongiv committed Nov 9, 2023
1 parent 76f20a3 commit cf1b58f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions javascript/usearch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,21 @@ test('Batch operations', () => {
assert.deepEqual(results.distances, new Float32Array([45, 130]), 'distances should be 45 and 130');
});

test("Expected results", () => {
var index = new usearch.Index({
metric: "cos",
connectivity: 16,
dimensions: 3,
});
index.add(42n, new Float32Array([0.2, 0.6, 0.4]));
var results = index.search(new Float32Array([0.2, 0.6, 0.4]), 10);

assert.equal(index.size(), 1);
assert.deepEqual(results.keys, new BigUint64Array([42n]));
assert.deepEqual(results.distances, new Float32Array([0]));
});



test('Operations with invalid values', () => {
const indexBatch = new usearch.Index(2, 'l2sq');
Expand Down

0 comments on commit cf1b58f

Please sign in to comment.