Title: test(maths): strengthen armstrongNumber tests against mutation (R50-T050) by aniruddha-bongale · Pull Request #98 · S-AI-Projects/TheAlgorithms-JavaScript · GitHub
Open Graph Title: test(maths): strengthen armstrongNumber tests against mutation (R50-T050) by aniruddha-bongale · Pull Request #98 · S-AI-Projects/TheAlgorithms-JavaScript
X Title: test(maths): strengthen armstrongNumber tests against mutation (R50-T050) by aniruddha-bongale · Pull Request #98 · S-AI-Projects/TheAlgorithms-JavaScript
Description: Description Strengthen unit test coverage for armstrongNumber in Maths/ArmstrongNumber.js to build a mutation-resistant regression test suite. Prove that the regression tests detect plausible one-line mistakes (such as off-by-one boundary errors rejecting the smallest valid input 0 and hardcoded cube power mutations failing multi-digit Armstrong numbers like 1634) while preserving documented public behavior. Provide an automated check runner work/R50-T050/check.py saving verification results to work/R50-T050/results.json. Related Issue Fixes: #50 Type of Change Documentation update Tests (adding missing tests or fixing existing tests) Changes Made Added comprehensive JSDoc documentation to Maths/ArmstrongNumber.js identifying protected semantic conditions and preconditions: Line 24: Boundary guard num < 0 permits the smallest valid input 0 ($0^1 = 0$), protecting against an off-by-one mutation num <= 0. Line 27: Dynamic exponentiation ** numStr.length dynamically scales with digit count, protecting against hardcoded cube mutations (** 3) for 4-digit Armstrong numbers (e.g. 1634). Added regression tests in Maths/test/ArmstrongNumber.test.js: Smallest valid input 0 and single-digit numbers 1, 5, 9. Ordinary 3-digit Armstrong numbers (370, 371, 153, 407). Multi-digit Armstrong numbers (1634, 8208). Ordinary non-Armstrong numbers (10, 100, 1633). Negative values and non-number types. Implemented work/R50-T050/check.py executing native tests, validating original behavior against all fixtures, and demonstrating that deliberate one-line mutants fail the named assertions for semantic reasons while the original passes. Screenshots / Recordings All 9 unit tests for ArmstrongNumber passed cleanly. Both mutant detection proofs passed. Testing Ran npm test -- Maths/test/ArmstrongNumber.test.js - all 9 tests passed. Executed python3 work/R50-T050/check.py - original assertions verified and mutants caught. Confirmed Prettier code style check passes. Checklist My code follows the style guidelines of this project I have performed a self-review of my code I have commented my code, particularly in hard-to-understand areas I have added tests that prove my fix is effective or that my feature works New and existing unit tests pass locally with my changes Additional Notes Student: Aniruddha Bongale (Enrollment: E26B07F0827) Task ID: R50-T050
Open Graph Description: Description Strengthen unit test coverage for armstrongNumber in Maths/ArmstrongNumber.js to build a mutation-resistant regression test suite. Prove that the regression tests detect plausible one-l...
X Description: Description Strengthen unit test coverage for armstrongNumber in Maths/ArmstrongNumber.js to build a mutation-resistant regression test suite. Prove that the regression tests detect plausible one-l...
Opengraph URL: https://github.com/S-AI-Projects/TheAlgorithms-JavaScript/pull/98
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:4ecc34da-9e66-ec9b-3cb1-c9642a71d421 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E22A:1D2D33:2EA1BED:3E7FC78:6B06DACD |
| html-safe-nonce | 916cb42e7ad6db3ea1ec7cbcc2f0025d42fdb7699db3fa9dca0daa4523bb8b62 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMjJBOjFEMkQzMzoyRUExQkVEOjNFN0ZDNzg6NkIwNkRBQ0QiLCJ2aXNpdG9yX2lkIjoiNDcxOTM5OTEwMTMxMjQ1NzQyMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 80604f4ae30cb063c4f64b66f4cde69f29f8b39f19f891a3de914ffeba298736 |
| hovercard-subject-tag | pull_request:5437033873 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/S-AI-Projects/TheAlgorithms-JavaScript/pull/98/files |
| twitter:image | https://avatars.githubusercontent.com/u/322111215?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/322111215?s=400&v=4 |
| og:image:alt | Description Strengthen unit test coverage for armstrongNumber in Maths/ArmstrongNumber.js to build a mutation-resistant regression test suite. Prove that the regression tests detect plausible one-l... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06cadd0061c549662a50be90eb5baba7608f00f521574931eec01db0deb9e636 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/S-AI-Projects/TheAlgorithms-JavaScript git https://github.com/S-AI-Projects/TheAlgorithms-JavaScript.git |
| octolytics-dimension-user_id | 351892385 |
| octolytics-dimension-user_login | S-AI-Projects |
| octolytics-dimension-repository_id | 1444142713 |
| octolytics-dimension-repository_nwo | S-AI-Projects/TheAlgorithms-JavaScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | true |
| octolytics-dimension-repository_parent_id | 97086543 |
| octolytics-dimension-repository_parent_nwo | TheAlgorithms/JavaScript |
| octolytics-dimension-repository_network_root_id | 97086543 |
| octolytics-dimension-repository_network_root_nwo | TheAlgorithms/JavaScript |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 6953c712585a8d7406b7695e48fffcb670fd241d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width