Repository navigation
test(math): strengthen CoPrimeCheck regression tests (R50-T040) - #78
Open
nishadaniket174 wants to merge 1 commit into
Open
nishadaniket174 wants to merge 1 commit into
nishadaniket174 wants to merge 1 commit into
Conversation
nishadaniket174
force-pushed
the
student/e26b07f0789/R50-T040
branch
from
November 21, 2026 14:37
20a0b68 to
12379e3
Compare
4 tasks
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.
Summary
This PR strengthens the regression tests for
CoPrimeCheckinMaths/CoPrimeCheck.jsto 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
CoPrimeCheck, including its inputs, return value, preconditions, and coprimality invariant.Maths/test/CoPrimeCheck.test.jswith 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).(0, 0)to catch an incorrect boundary condition such as changingGCD === 1toGCD <= 1.work/R50-T040/WORK_LOG.mdto document the analysis, fixtures, mutation experiment, and verification results.work/R50-T040/check.pyto automate focused tests, deliberate mutation verification, and the full repository test suite.Mutation Testing
A plausible one-line mutation was introduced temporarily:
The regression tests correctly detect this mistake because
GCD(0, 0) = 0, which must returnfalse, nottrue.The deliberate mutation is used only for verification and is not included in the final implementation.
Testing and Verification
The following checks passed:
npx vitest run Maths/test/CoPrimeCheck.test.js(18 tests passed).npm test(347 test files passed, 12,031 tests passed).npm run check-stylepassed.Run the complete task-specific verification using:
Related Issue
Closes #40
Task: R50-T040
Target file:
Maths/CoPrimeCheck.jsFunction:
CoPrimeCheckAll task-specific verification evidence is maintained under
work/R50-T040/.