diff --git a/samples/samplepptx.pptx b/samples/samplepptx.pptx new file mode 100644 index 0000000..ea72794 Binary files /dev/null and b/samples/samplepptx.pptx differ diff --git a/tests/end_to_end.rs b/tests/end_to_end.rs index 4e90a61..020f0df 100644 --- a/tests/end_to_end.rs +++ b/tests/end_to_end.rs @@ -10,7 +10,9 @@ use std::path::Path; use std::{mem, ptr}; use libdeflate_sys::{libdeflate_alloc_compressor, libdeflate_deflate_compress}; -use preflate_rs::{decompress_deflate_stream, recompress_deflate_stream}; +use preflate_rs::{ + compress_zstd, decompress_deflate_stream, decompress_zstd, recompress_deflate_stream, +}; #[cfg(test)] pub fn read_file(filename: &str) -> Vec { @@ -48,31 +50,39 @@ fn test_pptxplaintext() { } #[test] -#[ignore = "chain length too long"] -fn test_dumpout() { - verifyresult(&read_file("dumpout-29473.deflate")); +fn test_nomatch() { + test_file("sample2.bin"); } #[test] -#[ignore = "chain length too long"] -fn test_dumpout2() { - verifyresult(&read_file("dumpout-355865.deflate")); +fn test_sample1() { + test_file("sample1.bin"); } #[test] -fn test_nomatch() { - test_file("sample2.bin"); +fn test_samplezip() { + test_container("samplezip.zip"); } #[test] -#[ignore = "chain length too long"] -fn test_treedeflate() { - verifyresult(&read_file("treepng.deflate")); +fn test_docx() { + test_container("samplepptx.pptx"); } -#[test] -fn test_sample1() { - test_file("sample1.bin"); +fn test_container(filename: &str) { + let v = read_file(filename); + let c = compress_zstd(&v).unwrap(); + + let r = decompress_zstd(&c, 1024 * 1024 * 128).unwrap(); + assert!(v == r); + + println!( + "file {} original size: {}, compressed size: {} (plaintext={})", + filename, + v.len(), + c.len(), + r.len() + ); } #[test]