Simplify test code of compression

This commit is contained in:
Mathijs van de Nes 2019-04-06 17:58:12 +02:00
parent 256da313b4
commit 57c8444d8e

View file

@ -65,25 +65,14 @@ mod test {
}
}
#[cfg(all(not(feature = "bzip2"), feature = "deflate"))]
fn methods() -> Vec<CompressionMethod> {
vec![CompressionMethod::Stored, CompressionMethod::Deflated]
let mut methods = Vec::new();
methods.push(CompressionMethod::Stored);
#[cfg(feature="deflate")] methods.push(CompressionMethod::Deflated);
#[cfg(feature="bzip2")] methods.push(CompressionMethod::Bzip2);
methods
}
#[cfg(all(not(feature = "deflate"), feature = "bzip2"))]
fn methods() -> Vec<CompressionMethod> {
vec![CompressionMethod::Stored, CompressionMethod::Bzip2]
}
#[cfg(all(feature = "bzip2", feature = "deflate"))]
fn methods() -> Vec<CompressionMethod> {
vec![CompressionMethod::Stored, CompressionMethod::Deflated, CompressionMethod::Bzip2]
}
#[cfg(all(not(feature = "bzip2"), not(feature = "deflate")))]
fn methods() -> Vec<CompressionMethod> {
vec![CompressionMethod::Stored]
}
#[test]
fn to_eq_from() {