Rust
Rust copied to clipboard
Refactor Caesar Algorithm Implementation
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 warningsjust before my last commit and fixed any issue that was found. - [x] I ran
cargo fmtjust before my last commit. - [x] I ran
cargo testjust before my last commit and all tests passed. - [x] I added my algorithm to the corresponding
mod.rsfile within its own folder, and in any parent folder(s). - [x] I added my algorithm to
DIRECTORY.mdwith the correct link. - [x] I checked
COUNTRIBUTING.mdand my code follows its guidelines.
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.
What do you think about defining the
26as some constant. It could be computed as a difference betweenaandz(plus 1, I think).
That's a good idea. I defined it as:
const ALPHABET_LENGTH: u8 = b'z' - b'a' + 1;