text-compression/src/test.rs

25 lines
490 B
Rust

#![allow(clippy::needless_pass_by_value)]
use crate::{CompressionScheme, Freq, Huffman, Id, Rle};
use quickcheck_macros::quickcheck;
#[quickcheck]
fn roundtrip_freq(src: Vec<u8>) -> bool {
Freq::idempotent_on(&src)
}
#[quickcheck]
fn roundtrip_rle(src: Vec<u8>) -> bool {
Rle::idempotent_on(&src)
}
#[quickcheck]
fn roundtrip_huffman(src: Vec<u8>) -> bool {
Huffman::idempotent_on(&src)
}
#[quickcheck]
fn roundtrip_id(src: Vec<u8>) -> bool {
Id::idempotent_on(&src)
}