Repository navigation
test(bitmanipulation): strengthen Xs3Conversion tests with mutation r… - #50
Open
Sapna2007-sst wants to merge 1 commit into
Open
Sapna2007-sst wants to merge 1 commit into
Sapna2007-sst wants to merge 1 commit into
Conversation
…esistance (R45-T010)
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.
clang-format -i --style=file path/to/your/file.javaDescription
This pull request resolves task R45-T010 / Issue #10 by strengthening the test suite of
Xs3Conversion.javaagainst subtle semantic regressions and plausible one-line mistakes. It documents protected algorithmic invariants (nibble alignment and decimal base-10 weighting), adds dedicated mutation-resistant tests, validates smallest valid and ordinary fixtures, verifies bijective property round-trips, and implements an automated check runner inwork/R45-T010/check.pythat demonstrates the test suite reliably catches and rejects plausible one-line mutants.Related Issue
Closes #10
Related to: #10
Type of Change
Changes Made
Javadoc Documentation (
Xs3Conversion.java):xs3ToBinary: each 4-bit nibble represents an Excess-3 digit decoded by subtracting 3, and place value reconstruction relies on decimal base-10 multiplier accumulation (multiplier *= 10, line 42).binaryToXs3: decimal digits are biased by +3, and nibble positioning requires 4-bit alignment scaling (shift * 4, line 66) to prevent bit overlap and corruption across multi-digit numbers.Unit & Mutation-Resistant Regression Tests (
Xs3ConversionTest.java):testSmallestValidInputZeroFixture: Verifies boundary handling for zero input (xs3ToBinary(0) == 0,binaryToXs3(0) == 0x0).testSmallestValidPositiveSingleDigitFixture: Verifies smallest positive digit (binary = 1->0x4,xs3 = 0x4->1).testOrdinaryInputDocumentationFixture: Verifies documentation fixture (1234<->0x4567).testOrdinaryInputTwoDigitFixture: Verifies multi-digit fixture (25<->0x58).testMutationResistanceNibbleShiftAlignment: Directly guards against mutant alteringshift * 4toshift(line 66). On input 25, the mutant returns10(0xA) instead of expected88(0x58).testMutationResistanceMultiplierAccumulation: Directly guards against mutant alteringmultiplier *= 10tomultiplier *= 16(line 42). On input0x58, the mutant returns37instead of expected25.testBijectiveRoundTripAllDigitsAndMultiDigits: Property check assertingxs3ToBinary(binaryToXs3(i)) == iacross all integerstestPrivateConstructorContract: Reflection contract test verifying private constructor encapsulation.Automated Verification Harness (
work/R45-T010/):check.pyrunner logging environment metadata (Python 3.15, OpenJDK 21, Maven 3.10) and executingmvn test -Dtest=Xs3ConversionTestandmvn checkstyle:check.Xs3Conversion.javaasserting both mutants are rejected by the regression tests, and guarantees the working tree is restored cleanly.results.jsonandevidence.mdconfirming 14/14 tests passing on clean code with 0 checkstyle violations.Screenshots / Recordings