diff --git a/src/ciphers/morse_code.rs b/src/ciphers/morse_code.rs index 7efc204..6d5f88a 100644 --- a/src/ciphers/morse_code.rs +++ b/src/ciphers/morse_code.rs @@ -127,6 +127,10 @@ pub fn decrypt(text: &str) -> String { decrypted_text.push(*key); } } + + if *split == "/" { + decrypted_text.push(' '); + } } decrypted_text @@ -148,4 +152,12 @@ mod tests { let decrypted = decrypt(&encrypted); assert_eq!(text, decrypted); } + + #[test] + pub fn test_hello_world() { + let text = "hello world!"; + let encrypted = encrypt(text); + let decrypted = decrypt(&encrypted); + assert_eq!(text, decrypted); + } }