Skip to main content

klirr_core/models/
pdf.rs

1use crate::prelude::*;
2
3/// Bytes represents a PDF document in memory.
4#[derive(Clone, Debug, From, AsRef, PartialEq, Eq, Hash)]
5pub struct Pdf(pub Vec<u8>);
6
7impl HasSample for Pdf {
8    fn sample() -> Self {
9        Self(vec![0xde, 0xad, 0xbe, 0xef]) // Sample PDF data
10    }
11
12    fn sample_other() -> Self {
13        Self(vec![0xca, 0xfe, 0xba, 0xbe]) // Another sample PDF data
14    }
15}
16
17#[cfg(test)]
18mod tests {
19    use super::*;
20
21    type Sut = Pdf;
22
23    #[test]
24    fn equality() {
25        assert_eq!(Sut::sample(), Sut::sample());
26        assert_eq!(Sut::sample_other(), Sut::sample_other());
27    }
28
29    #[test]
30    fn inequality() {
31        assert_ne!(Sut::sample(), Sut::sample_other());
32    }
33}