summaryrefslogtreecommitdiff
path: root/modules/KDTree.test.js
blob: 4e2657b794bba849389b2a51fcfef2e72554e078 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import { test, assert } from './test-assert.js';

import { KDTree, NodeType } from './KDTree.js';

test('single point does not split tree', () => {
	let tree = new KDTree();
	tree.insert({x: 0.5, y: 0.5 });
	assert.deepEqual(tree.root.type, NodeType.Leaf);
	assert.ok(tree.root.point);
	assert(tree.root.point.x = 0.5);
	assert(tree.root.point.y = 0.5);
});