Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewharvey committed Aug 15, 2024
1 parent a96bbae commit 9126244
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,31 @@ test('does not throw on zero items', () => {
assert.deepEqual(index.getClusters([-180, -85, 180, 85], 0), []);
});
});

test('very close points which shouldn\'t cluster, are clustered when using Float32Array', () => {
const index = new Supercluster({
maxZoom: 22,
extent: 8192,
radius: 4,
arrayType: Float32Array
}).load([
{type: 'Feature', geometry: {type: 'Point', coordinates: [-1.426798, 53.943034]}},
{type: 'Feature', geometry: {type: 'Point', coordinates: [-1.426799, 53.943034]}}
]);

assert.equal(index.trees[22].ids.length, 1);
});

test('very close points which shouldn\'t cluster, are not clustered when using Float64Array', () => {
const index = new Supercluster({
maxZoom: 22,
extent: 8192,
radius: 4,
arrayType: Float64Array
}).load([
{type: 'Feature', geometry: {type: 'Point', coordinates: [-1.426798, 53.943034]}},
{type: 'Feature', geometry: {type: 'Point', coordinates: [-1.426799, 53.943034]}}
]);

assert.equal(index.trees[22].ids.length, 2);
});

0 comments on commit 9126244

Please sign in to comment.