Rust icon indicating copy to clipboard operation
Rust copied to clipboard

Refactor Caesar Algorithm Implementation

Open StPfeffer opened this issue 2 years ago • 2 comments

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

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

Checklist:

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

StPfeffer avatar May 17 '24 16:05 StPfeffer

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

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           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar May 17 '24 16:05 codecov-commenter

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 avatar May 21 '24 19:05 StPfeffer