This commit introduces a suite of tests for failure modes in the k-d tree library and resolves a persistent panic in the WebAssembly (WASM) smoke test.
Key changes:
- Adds `kdtree_failure_test.go` to test error conditions like empty inputs, dimension mismatches, and duplicate IDs.
- Fixes a `panic: ValueOf: invalid value` in the WASM module by ensuring Go slices are converted to `[]any` before being passed to JavaScript.
- Makes the JavaScript loader (`loader.js`) isomorphic, allowing it to run in both Node.js and browser environments.
- Updates the WASM `nearest` function and the corresponding JS loader to handle the "not found" case more gracefully.
- Corrects the smoke test (`smoke.mjs`) to align with the API changes and use the correct build process.
This commit introduces a comprehensive test suite for the `gonum` backend, which was previously untested. It also adds tests for the `kdtree_helpers` package, specifically for the `ComputeNormStats3D` and `BuildND` functions.
The new tests cover a wide range of scenarios, including:
- Basic functionality of `Nearest`, `KNearest`, and `Radius`
- Edge cases such as empty trees, zero/negative inputs, and mismatched dimensions
- Various data configurations, including collinear points and negative coordinates
This commit also includes minor fixes to the existing tests to improve their robustness and accuracy.
As a result of these changes, the overall test coverage of the project has been increased from 80% to over 90%.