feat: add reversing

This commit is contained in:
John Doe 2025-02-27 20:18:30 +01:00 committed by John Doe
parent 424a5957d3
commit ff5d128399
2 changed files with 12 additions and 4 deletions

7
Cargo.lock generated Normal file
View File

@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "reve-rs"
version = "0.1.0"

View File

@ -1,14 +1,15 @@
pub fn add(left: u64, right: u64) -> u64 { pub fn reverse_string(input: &str) -> String {
left + right input.chars().rev().collect()
} }
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
#[test] #[test]
fn it_works() { fn it_works() {
let result = add(2, 2); let result = reverse_string("aezakmi");
assert_eq!(result, 4); assert_eq!(result, "imkazea");
} }
} }