#[cfg(test)]
mod tests {
    use crate::compression_engine::CompressionType;
    use std::str::FromStr;

    #[test]
    fn test_compression_type_display() {
        assert_eq!(format!("{}", CompressionType::LZ4), "lz4");
        assert_eq!(format!("{}", CompressionType::GZip), "gzip");
        assert_eq!(format!("{}", CompressionType::None), "none");
    }

    #[test]
    fn test_compression_type_from_str() {
        assert_eq!(
            CompressionType::from_str("lz4").unwrap(),
            CompressionType::LZ4
        );
        assert_eq!(
            CompressionType::from_str("gzip").unwrap(),
            CompressionType::GZip
        );
        assert_eq!(
            CompressionType::from_str("none").unwrap(),
            CompressionType::None
        );
        // Test case insensitivity
        assert_eq!(
            CompressionType::from_str("LZ4").unwrap(),
            CompressionType::LZ4
        );
        assert_eq!(
            CompressionType::from_str("GZIP").unwrap(),
            CompressionType::GZip
        );
        assert_eq!(
            CompressionType::from_str("NONE").unwrap(),
            CompressionType::None
        );
    }

    #[test]
    fn test_compression_type_from_str_invalid() {
        assert!(CompressionType::from_str("invalid").is_err());
        assert!(CompressionType::from_str("").is_err());
        // "xz" is actually a valid compression type, so it should not error
        assert!(CompressionType::from_str("xz").is_ok());
    }
}
