-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from anatawa12/fix-err-with-some-archive
Fix err with some archive
- Loading branch information
Showing
6 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use deflate64::InflaterManaged; | ||
|
||
static ZIP_FILE_DATA: &[u8] = include_bytes!("../test-assets/issue-13/unitwf-1.5.0.minimized.zip"); | ||
static BINARY_DATA: &[u8] = include_bytes!("../test-assets/issue-13/logo.png"); | ||
|
||
fn deflate64_data() -> &'static [u8] { | ||
&ZIP_FILE_DATA[1182..][..34919] | ||
} | ||
|
||
#[test] | ||
fn issue_13() { | ||
let compressed_data = deflate64_data(); | ||
|
||
let mut uncompressed_data = vec![0u8; BINARY_DATA.len()]; | ||
|
||
let mut inflater = Box::new(InflaterManaged::new()); | ||
let output = inflater.inflate(compressed_data, &mut uncompressed_data); | ||
|
||
assert_eq!(output.bytes_consumed, compressed_data.len()); | ||
assert_eq!(output.bytes_written, uncompressed_data.len()); | ||
assert!(!output.data_error, "unexpected error"); | ||
|
||
assert_eq!(uncompressed_data.as_slice(), BINARY_DATA); | ||
} |