Add test coverage for VectorUtils module #164
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses code review feedback requesting test coverage for the VectorUtils module (
magnitude,inner,normalize,normalizeNumberArray).Test Coverage Added
52 test cases covering:
magnitude()- L2 norm calculation across Float16/32/64Array, Int8/16Array, Uint8/16Array, number arrays; zero vectors, negative values, large vectorsinner()- Dot product for all typed array types; orthogonal vectors, zero vectorsnormalize()- Unit length normalization with type preservation; Float16Array → Float32Array conversion; zero vector handling viathrowOnZeroparameternormalizeNumberArray()- Number array normalization; immutability verification; zero vector handlingEdge cases tested: zero vectors, single elements, negative/mixed values, already normalized inputs, large vectors (1000 elements).
Tests follow repository's vitest patterns. CI will validate execution.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.