Skip to content

test(search): define supported boundaries of quickSelectSearch (R50-T042) - #90

Open
aniruddha-bongale wants to merge 1 commit into
S-AI-Projects:masterfrom
aniruddha-bongale:student/e26b07f0827/R50-T042
Open

aniruddha-bongale wants to merge 1 commit into
S-AI-Projects:masterfrom
aniruddha-bongale:student/e26b07f0827/R50-T042

Conversation

@aniruddha-bongale

Copy link
Copy Markdown

Description

This PR addresses task R50-T042 for quickSelectSearch. It documents the supported domain boundaries in Search/QuickSelectSearch.js citing the source preconditions established at Line 15 (if (!array || array.length <= k)), establishes a focused boundary test suite asserting both valid and explicitly unsupported sides of every boundary, and introduces an automated check runner work/R50-T042/check.py.

Related Issue

Fixes: #42

Type of Change

  • Tests
  • Documentation
  • Refactoring / Maintenance

Changes Made

  • Documented the supported boundary contract in Search/QuickSelectSearch.js citing precondition checks at Line 15 (if (!array || array.length <= k)) and error handling at Line 16 (throw new Error('Invalid arguments')).
  • Created Search/test/QuickSelectSearch.test.js covering:
    • Stated fixture with the smallest valid input ([42], k = 0) asserting expected value [42] and array identity.
    • Stated fixture with an ordinary unsorted 9-element input (k = 4, median) asserting partition guarantees.
    • Lower supported boundary ($k = 0$) and upper supported boundary ($k = array.length - 1$).
    • Two-element boundary cases and repeated elements boundary.
    • Explicitly unsupported boundaries on the invalid side: $k = array.length$, $k &gt; array.length$, empty array ([]), and falsy arrays (null, undefined) asserting Error('Invalid arguments').
  • Implemented automated check runner work/R50-T042/check.py and saved verifiable execution evidence in work/R50-T042/results.json.

Screenshots / Recordings

N/A (Algorithmic / unit testing suite)

Testing

  • Ran Prettier style checks: npx prettier --check Search/QuickSelectSearch.js Search/test/QuickSelectSearch.test.js work/R50-T042/results.json
  • Ran native Vitest suite: npm test -- Search/test/QuickSelectSearch.test.js (10 tests passed)
  • Ran full repository test suite via pre-commit hook (347 test files, 11,980 tests passed)
  • Ran automated check runner: python3 work/R50-T042/check.py (all checks and tool version captures passed)

Checklist

  • I have tested my changes locally.
  • I have added or updated tests, if needed.
  • I have updated documentation, if needed.
  • I have followed the project's coding guidelines.
  • I have run the relevant tests and checks.
  • I have addressed previous review feedback, if applicable.

Additional Notes

  • Precondition source line 15 is explicitly cited in code comments, test descriptions, and automated check results.
  • No arbitrary TypeError/RangeError policies are imposed across unrelated functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Aniruddha Bongale — R50-T042: Define the supported boundaries of quickSelectSearch (QuickSelectSearch.js) [Search/QuickSelectSearch.js]

1 participant