Repository navigation
[R45-T020] Strengthen regression tests for Autokey.encrypt - #60
Open
shyamlibakale1001-alt wants to merge 1 commit into
Open
shyamlibakale1001-alt wants to merge 1 commit into
shyamlibakale1001-alt wants to merge 1 commit into
Conversation
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.
Description
Documents the protected input-sanitization, autokey-extension, loop-bound, and modulo-26 conditions on
Autokey.encrypt(String, String)insrc/main/java/com/thealgorithms/ciphers/Autokey.java, adds a mutation-resistant regression test tosrc/test/java/com/thealgorithms/ciphers/AutokeyTest.java, and addswork/R45-T020/check.pyto execute and record the checks. All existing behavior and public interfaces are preserved, with no deliberate mutant left in the final source.Related Issue
Fixes: #20
Type of Change
Changes Made
Autokey.encrypt(String, String)insrc/main/java/com/thealgorithms/ciphers/Autokey.java(lines 14–29) documenting the protected conditions (toUpperCase().replaceAll("[^A-Z]", ""), autokey stream extension over0 <= i < plaintext.length(), and modulo-26 wrap-around). No executable code or public API was modified.encryptSmallestOrdinaryAndBoundaryInputsDetectMutants()tosrc/test/java/com/thealgorithms/ciphers/AutokeyTest.java(lines 38–98) with literal expected values and source-line citations:("", "A")→"",("123!", "A")→"",("A", "B")→"B".("Z", "B")→"A".("BC", "D")→"ED".("attack at dawn", "queen")→"QNXEPKTMDCGN", verifying fresh equivalent input("ATTACKATDAWN", "QUEEN"), input immutability, and round-tripdecrypt.work/R45-T020/check.py(with evidence files inwork/R45-T020/), runningmvn testforAutokeyCipherTest, enforcing a nonzero test count, savingcomparisons.txt,result.txt,mvn_output.txt, andtool_versions.txt, and exiting non-zero on failure.Screenshots / Recordings
Not applicable (no UI changes).
Testing
Command:
python3 work/R45-T020/check.py(runs
mvn -B test -Dtest=AutokeyCipherTest -Dsurefire.failIfNoSpecifiedTests=false)Result:
tests=3 failures/errors=0 skipped=0 records=6 mvn_exit=0,status=PASSMutant checks (tested on temporary copies and reverted):
.toUpperCase()onplaintext(line 16 before Javadoc): existing tests (autokeyEncryptTest,autokeyDecryptTest) passed, whileencryptSmallestOrdinaryAndBoundaryInputsDetectMutantsfailed on("attack at dawn", "queen")(status=FAIL,tests=3 failures/errors=1 skipped=0 mvn_exit=1).i < plaintext.length() - 1(line 24 before Javadoc): failed withstatus=FAIL(tests=3 failures/errors=2 skipped=0 mvn_exit=1), caught on("A", "B")(""vs"B").Style:
mvn -B checkstyle:checkreports0 Checkstyle violations(BUILD SUCCESS).Tool versions and check records are saved in
work/R45-T020/tool_versions.txtandwork/R45-T020/comparisons.txt.Checklist
Additional Notes
No deliberate mutant or test-only branch remains in
Autokey.java.The
work/R45-T020/evidence folder is for coursework review only and should not go into any later upstream PR.I have read CONTRIBUTING.md.
This pull request is all my own work -- I have not plagiarized it.
All filenames are in PascalCase.
All functions and variable names follow Java naming conventions.
All new algorithms have a URL in their comments that points to Wikipedia or other similar explanations.
All new algorithms include a corresponding test class that validates their functionality.
All new code is formatted with
clang-format -i --style=file path/to/your/file.java