TheAlgorithms / Rust

All Algorithms implemented in Rust
MIT License
22.21k stars 2.17k forks source link

Refactor Caesar Algorithm Implementation #720

Closed StPfeffer closed 4 months ago

StPfeffer commented 4 months ago

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

Checklist:

codecov-commenter commented 4 months ago

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 ```diff @@ 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.

StPfeffer commented 4 months ago

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;