Skip to content

feat(strings): cross-check Isomorphic against independent reference o… - #43

Open
Sapna2007-sst wants to merge 1 commit into
S-AI-Projects:masterfrom
Sapna2007-sst:R45-T003
Open

Sapna2007-sst wants to merge 1 commit into
S-AI-Projects:masterfrom
Sapna2007-sst:R45-T003

Conversation

@Sapna2007-sst

Copy link
Copy Markdown

Description

This pull request cross-checks Isomorphic against an independent reference oracle based on canonical first-occurrence index pattern encoding, documents representative isomorphic behavior in source Javadoc, and adds focused regression and cross-check tests across more than 20 distinct input pairs.

Related Issue

Fixes: #3

Type of Change

  • Tests
  • Documentation
  • Bug Fix
  • New Feature
  • UI/UX Improvement
  • Performance Improvement
  • Refactoring / Maintenance
  • CI/CD

Changes Made

  • Documented representative isomorphic positive and negative examples in src/main/java/com/thealgorithms/strings/Isomorphic.java.
  • Implemented an independent reference oracle in src/test/java/com/thealgorithms/strings/IsomorphicTest.java using first-occurrence index comparisons without utilizing Map or Set.
  • Added tests asserting explicit expected values across:
    • Smallest valid input (("", "") returning true).
    • Ordinary input workflow (("egg", "add") returning true).
    • Parameterized cross-checks comparing implementation results and oracle results over 23 diverse test pairs.
    • Domain boundary length mismatch (("abcdef", "abc") returning false).
    • Private constructor reflection contract.
  • Added automated verification check runner work/R45-T003/check.py and saved verification evidence in work/R45-T003/results.json and work/R45-T003/evidence.md.

Screenshots / Recordings

N/A (string algorithm utility and unit tests; non-UI)

Testing

All changes have been validated locally using JDK 21 and Maven:

  • mvn test -Dtest=IsomorphicTest (Tests run: 34, Failures: 0, Errors: 0, Skipped: 0)
  • mvn checkstyle:check (0 Checkstyle violations)
  • python3 work/R45-T003/check.py (All checks and cross-check assertions passed successfully)

Checklist

  • I have tested my changes locally.
  • I have added or updated tests, if needed.
  • I have updated documentation, if needed.
  • I have followed the project's coding guidelines.
  • I have run the relevant tests and checks.
  • I have addressed previous review feedback, if applicable.
  • 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 code adheres to repository style conventions and passes mvn checkstyle:check.

Additional Notes

  • Precondition lines establishing input requirements are explicitly cited in both the test methods and work/R45-T003/evidence.md.
  • Automated check runner can be verified anytime with python3 work/R45-T003/check.py.

…racle (R45-T003)

- Explain representative isomorphic example in Isomorphic.java documentation
- Implement independent reference oracle in IsomorphicTest using canonical first-occurrence index pattern encoding
- Add parameterized cross-check tests over 22 distinct input pairs asserting consistency, symmetry, and explicit expected values
- Cover smallest valid input (empty strings), ordinary input (egg/add), length mismatch domain boundary, and reflection instantiation
- Add automated verification check runner work/R45-T003/check.py and verification evidence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sapna Shankar Talke — R45-T003: Cross-check Isomorphic (Isomorphic.java) [src/main/java/com/thealgorithms/strings/Isomorphic.java]

1 participant