Title: test(math): strengthen CoPrimeCheck regression tests (R50-T040) by nishadaniket174 · Pull Request #78 · S-AI-Projects/TheAlgorithms-JavaScript · GitHub
Open Graph Title: test(math): strengthen CoPrimeCheck regression tests (R50-T040) by nishadaniket174 · Pull Request #78 · S-AI-Projects/TheAlgorithms-JavaScript
X Title: test(math): strengthen CoPrimeCheck regression tests (R50-T040) by nishadaniket174 · Pull Request #78 · S-AI-Projects/TheAlgorithms-JavaScript
Description: Summary This PR strengthens the regression tests for CoPrimeCheck in Maths/CoPrimeCheck.js to protect its coprimality condition against plausible one-line logic mutations. The function determines whether two integers are coprime by checking whether their greatest common divisor (GCD) is exactly 1. Changes Made Improved the JSDoc documentation for CoPrimeCheck, including its inputs, return value, preconditions, and coprimality invariant. Clarified the mathematical definition of coprime numbers and corrected the existing documentation. Expanded Maths/test/CoPrimeCheck.test.js with explicit regression fixtures: (1, 1) → true (smallest valid coprime fixture). (2, 9) → true (prime and composite numbers with no common divisor). (9, 11) → true (composite and prime numbers that are coprime). (9, 12) → false (shared divisor 3). (9, 3) → false (composite 9 has divisor 3). Added checks for symmetry, repeatability, determinism, and input non-mutation. Added a regression assertion for (0, 0) to catch an incorrect boundary condition such as changing GCD === 1 to GCD <= 1. Added work/R50-T040/WORK_LOG.md to document the analysis, fixtures, mutation experiment, and verification results. Added work/R50-T040/check.py to automate focused tests, deliberate mutation verification, and the full repository test suite. Mutation Testing A plausible one-line mutation was introduced temporarily: GetEuclidGCD(firstNumber, secondNumber) <= 1 The regression tests correctly detect this mistake because GCD(0, 0) = 0, which must return false, not true. The deliberate mutation is used only for verification and is not included in the final implementation. Testing and Verification The following checks passed: Focused tests: npx vitest run Maths/test/CoPrimeCheck.test.js (18 tests passed). Mutation verification: confirmed that the deliberate boundary-condition mutation causes the regression tests to fail. Full repository test suite: npm test (347 test files passed, 12,031 tests passed). Code style: npm run check-style passed. Run the complete task-specific verification using: python3 work/R50-T040/check.py Related Issue Closes #40 Task: R50-T040 Target file: Maths/CoPrimeCheck.js Function: CoPrimeCheck All task-specific verification evidence is maintained under work/R50-T040/.
Open Graph Description: Summary This PR strengthens the regression tests for CoPrimeCheck in Maths/CoPrimeCheck.js to protect its coprimality condition against plausible one-line logic mutations. The function determines w...
X Description: Summary This PR strengthens the regression tests for CoPrimeCheck in Maths/CoPrimeCheck.js to protect its coprimality condition against plausible one-line logic mutations. The function determines w...
Opengraph URL: https://github.com/S-AI-Projects/TheAlgorithms-JavaScript/pull/78
X: @github
Domain: github.com
| 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:dea539ba-7ee5-cc48-2722-697f2daf6722 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 8B6C:B53AF:2E22403:3D7B3C2:6B01D76A |
| html-safe-nonce | 9aa611dfbd17e876d4b00a500aa9ab9a019b384c17e36595097569eceb30b1c7 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QjZDOkI1M0FGOjJFMjI0MDM6M0Q3QjNDMjo2QjAxRDc2QSIsInZpc2l0b3JfaWQiOiIzOTYzMzkxNTI3NTc2Nzg2Nzk0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | b5130afc94d8307c2ad336ac92afe845b0624a7c88762dfb421ac0d5591dd0d7 |
| hovercard-subject-tag | pull_request:5343613299 |
| 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/78/files |
| twitter:image | https://avatars.githubusercontent.com/u/334835973?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/334835973?s=400&v=4 |
| og:image:alt | Summary This PR strengthens the regression tests for CoPrimeCheck in Maths/CoPrimeCheck.js to protect its coprimality condition against plausible one-line logic mutations. The function determines w... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width