use crate::decoders::StreamDecoder;
use crate::error::Result;
pub struct CcittFaxDecoder;
impl StreamDecoder for CcittFaxDecoder {
fn decode(&self, input: &[u8]) -> Result<Vec<u8>> {
log::debug!("CCITTFaxDecode: Pass-through {} bytes", input.len());
Ok(input.to_vec())
}
fn name(&self) -> &str {
"CCITTFaxDecode"
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_ccitt_decode_passthrough() {
let decoder = CcittFaxDecoder;
let ccitt_data = b"\x00\x01\x02\x03"; let output = decoder.decode(ccitt_data).unwrap();
assert_eq!(output, ccitt_data);
}
#[test]
fn test_ccitt_decode_empty() {
let decoder = CcittFaxDecoder;
let input = b"";
let output = decoder.decode(input).unwrap();
assert_eq!(output, b"");
}
#[test]
fn test_ccitt_decoder_name() {
let decoder = CcittFaxDecoder;
assert_eq!(decoder.name(), "CCITTFaxDecode");
}
}