mycodee_enigma/lib.rs
1pub mod enigma;
2pub mod rotor;
3
4#[cfg(test)]
5mod tests {
6 #[test]
7 fn test_algorithm() {
8 let rotors = vec![crate::rotor::Rotor::new(10, 1, 1), crate::rotor::Rotor::new(10, 1, 1)];
9 let mut enigma = crate::enigma::Enigma::new(rotors);
10 let encrypted = enigma.encrypt("Test".to_string());
11 let decrypted = enigma.decrypt(encrypted.clone());
12
13 assert_eq!(decrypted, "Test".to_string())
14 }
15}