From 9126244a2c1d46d7bba98c3c0dcad604a5a750df Mon Sep 17 00:00:00 2001 From: Andrew Harvey Date: Thu, 15 Aug 2024 15:06:23 +1000 Subject: [PATCH] add test --- test/test.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test/test.js b/test/test.js index 5fb0510..a2c4fe8 100644 --- a/test/test.js +++ b/test/test.js @@ -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); +});