Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Caesar Algorithm Implementation #720

Merged
merged 20 commits into from
May 22, 2024
Merged

Conversation

StPfeffer
Copy link
Contributor

Description

Refactored the Caesar algorithm to handle larger inputs and rotations while preserving the existing code structure. Included additional tests for improved coverage.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I ran bellow commands using the latest version of rust nightly.
  • I ran cargo clippy --all -- -D warnings just before my last commit and fixed any issue that was found.
  • I ran cargo fmt just before my last commit.
  • I ran cargo test just before my last commit and all tests passed.
  • I added my algorithm to the corresponding mod.rs file within its own folder, and in any parent folder(s).
  • I added my algorithm to DIRECTORY.md with the correct link.
  • I checked COUNTRIBUTING.md and my code follows its guidelines.

@codecov-commenter
Copy link

codecov-commenter commented May 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.86%. Comparing base (0aa3f8d) to head (327bafb).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #720   +/-   ##
=======================================
  Coverage   94.85%   94.86%           
=======================================
  Files         302      302           
  Lines       22575    22590   +15     
=======================================
+ Hits        21414    21429   +15     
  Misses       1161     1161           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/ciphers/caesar.rs Outdated Show resolved Hide resolved
src/ciphers/caesar.rs Outdated Show resolved Hide resolved
src/ciphers/caesar.rs Outdated Show resolved Hide resolved
@StPfeffer StPfeffer requested a review from vil02 May 19, 2024 17:54
src/ciphers/caesar.rs Outdated Show resolved Hide resolved
@StPfeffer StPfeffer requested a review from vil02 May 20, 2024 20:00
Copy link
Member

@vil02 vil02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about defining the 26 as some constant. It could be computed as a difference between a and z (plus 1, I think).

src/ciphers/caesar.rs Outdated Show resolved Hide resolved
src/ciphers/caesar.rs Outdated Show resolved Hide resolved
Defined the alphabet length as a constant: `b'z' - b'a' + 1`
@StPfeffer
Copy link
Contributor Author

What do you think about defining the 26 as some constant. It could be computed as a difference between a and z (plus 1, I think).

That's a good idea. I defined it as:

const ALPHABET_LENGTH: u8 = b'z' - b'a' + 1;

@StPfeffer StPfeffer requested a review from vil02 May 21, 2024 19:31
src/ciphers/caesar.rs Outdated Show resolved Hide resolved
src/ciphers/caesar.rs Outdated Show resolved Hide resolved
src/ciphers/caesar.rs Outdated Show resolved Hide resolved
src/ciphers/caesar.rs Outdated Show resolved Hide resolved
src/ciphers/caesar.rs Outdated Show resolved Hide resolved
@StPfeffer StPfeffer requested a review from vil02 May 22, 2024 16:35
@vil02 vil02 merged commit c16984f into TheAlgorithms:master May 22, 2024
4 checks passed
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.

None yet

3 participants