summaryrefslogtreecommitdiff
path: root/modules/KDTree.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'modules/KDTree.test.js')
-rw-r--r--modules/KDTree.test.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/KDTree.test.js b/modules/KDTree.test.js
new file mode 100644
index 0000000..4e2657b
--- /dev/null
+++ b/modules/KDTree.test.js
@@ -0,0 +1,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);
+});