use caesar_cipher_enc_dec::caesar_cipher::CipherError;
#[test]
fn test_cipher_error_display_empty_text() {
let error = CipherError::EmptyText;
let message = error.to_string();
assert_eq!(message, "Input text cannot be empty or whitespace-only");
}
#[test]
fn test_cipher_error_display_invalid_shift() {
let error = CipherError::InvalidShift("test message".to_string());
let message = error.to_string();
assert_eq!(message, "Invalid shift value: test message");
}
#[test]
fn test_cipher_error_clone() {
let original = CipherError::EmptyText;
let cloned = original.clone();
assert_eq!(original, cloned);
}
#[test]
fn test_cipher_error_clone_invalid_shift() {
let original = CipherError::InvalidShift("test".to_string());
let cloned = original.clone();
assert_eq!(original, cloned);
}
#[test]
fn test_cipher_error_partial_eq_same() {
let error1 = CipherError::EmptyText;
let error2 = CipherError::EmptyText;
assert_eq!(error1, error2);
}
#[test]
fn test_cipher_error_partial_eq_different_variants() {
let error1 = CipherError::EmptyText;
let error2 = CipherError::InvalidShift("test".to_string());
assert_ne!(error1, error2);
}
#[test]
fn test_cipher_error_partial_eq_different_messages() {
let error1 = CipherError::InvalidShift("message1".to_string());
let error2 = CipherError::InvalidShift("message2".to_string());
assert_ne!(error1, error2);
}
#[test]
fn test_cipher_error_debug() {
let error = CipherError::EmptyText;
let debug_str = format!("{:?}", error);
assert!(debug_str.contains("EmptyText"));
}
#[test]
fn test_cipher_error_is_std_error() {
let error: Box<dyn std::error::Error> = Box::new(CipherError::EmptyText);
assert!(!error.to_string().is_empty());
}