[23/N] Add unit tests for algo util helpers (PriorityQueue, SkipListHeads, GraphValues) - #114
Open
karkir0003 wants to merge 23 commits into
Open
karkir0003 wants to merge 23 commits into
karkir0003 wants to merge 23 commits into
Conversation
…de, and AnimatedCircularlyLinkedListNode
This was referenced Oct 3, 2026
Open
This was referenced Oct 3, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🥞 Stack
Addresses #93
Context
Adds unit test coverage for the standalone utility modules located in
src/algo/util/, which power data structures and graph algorithms throughout the visualizer:PriorityQueue.js: Min-priority queue implementation used in Dijkstra's, Prim's, and Huffman coding animations.SkipListHeads.js: Seed head-count sequence used for reproducible SkipList tower animations.GraphValues.js: Graph topology definitions, logical coordinates, curve layouts, color palettes, and adjacency matrices for BFS/DFS, Dijkstra's, Floyd-Warshall, Prim's, and Kruskal's algorithms.Changes Made
• Introduced
src/algo/util/__tests__/PriorityQueue.test.jscovering:• Queue initialization (
backingArray,size(),getIDs()).• Priority sorting ascending (lower priority dequeued first).
• Tie-breaking logic:
• Scalar data comparison.
• Array-based data comparison on first index (
a[0][0] - b[0][0]).• Array-based data comparison on secondary index (
a[0][1] - b[0][1]).• Dequeue payload formatting (
[data, id]) and dynamic size tracking.• Introduced
src/algo/util/__tests__/SkipListHeads.test.jscovering:• Array structure and length validation (1000 items).
• Value bounding (
[0, 4]range validation).• Introduced
src/algo/util/__tests__/GraphValues.test.jscovering:• Small graph (8 vertices) and large graph (18 vertices) logical coordinate arrays (
SMALL_X_POS_LOGICAL,SMALL_Y_POS_LOGICAL,LARGE_X_POS_LOGICAL,LARGE_Y_POS_LOGICAL).• Allowance boolean matrices and curve matrices (
SMALL_ALLLOWED,LARGE_ALLOWED,SMALL_CURVE,LARGE_CURVE).• Adjacency list matrices (
BFS_DFS_ADJ_LIST,DIJKSTRAS_ADJ_LIST,FLOYD_ADJ_LIST,PRIMS_KRUSKALS_ADJ_LIST,LARGE_ADJ_LIST).• Disjoint set color palette verification (
KRUSKALS_DS_COLORS).Test Plan
• Ran
npm test -- --watchAll=false(all 32 test suites pass).• Ran
npm run lintandnpm run prettier.• Verified 100% statement, function, and branch coverage on all files in
src/algo/util/.