Skip to content

feat(hashmap): lock down contract and add regression tests for MainCu… - #41

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

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

Conversation

@Sapna2007-sst

Copy link
Copy Markdown

Description

This pull request locks down the input/output contract for MainCuckooHashing and introduces focused contract regression tests covering the smallest valid input, ordinary workflow input, domain boundaries (repeated key insertion and invalid choice), and observable mutation.

Related Issue

Fixes: #1

Type of Change

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

Changes Made

  • Added concise input/output and precondition contract Javadoc beside MainCuckooHashing in src/main/java/com/thealgorithms/datastructures/hashmap/hashing/MainCuckooHashing.java.
  • Added JUnit 5 regression test suite src/test/java/com/thealgorithms/datastructures/hashmap/hashing/MainCuckooHashingTest.java verifying:
    • Smallest valid input (4\n Exit directly).
    • Ordinary input workflow (1 42 5 42 6 4\n Add, Find, Load Factor, Exit).
    • Domain boundary on duplicate key insertion (1 10 1 10\n throws IllegalArgumentException).
    • Domain boundary on unexpected menu option (8\n throws IllegalArgumentException).
    • Observable mutation via table display verification (1 5 3 4\n).
    • Private constructor reflection contract.
  • Added automated verification check runner work/R45-T001/check.py and saved execution evidence in work/R45-T001/results.json and work/R45-T001/evidence.md.

Screenshots / Recordings

N/A (backend CLI driver and unit test changes only; non-UI)

Testing

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

  • mvn test -Dtest=MainCuckooHashingTest (Tests run: 6, Failures: 0, Errors: 0, Skipped: 0)
  • mvn checkstyle:check (0 Checkstyle violations)
  • python3 work/R45-T001/check.py (All checks and 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 algorithms include a corresponding test class that validates their functionality.
  • 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-T001/evidence.md.
  • Automated check runner can be verified anytime with python3 work/R45-T001/check.py.

…ckooHashing (R45-T001)

- Add input/output contract Javadoc to MainCuckooHashing
- Add regression test suite MainCuckooHashingTest covering smallest valid input, ordinary input workflow, duplicate key boundary, unexpected menu choice, and observable mutation
- Add automated verification check runner work/R45-T001/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

1 participant