update pklib-rs and add some tests

This commit is contained in:
2026-07-08 10:51:17 +03:00
parent 82a6faa78c
commit 610357e6c0
3 changed files with 17 additions and 3 deletions
Generated
+1 -1
View File
@@ -231,7 +231,7 @@ checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
[[package]] [[package]]
name = "pklib" name = "pklib"
version = "0.2.0" version = "0.2.0"
source = "git+https://github.com/fgRuslan/pklib-rs?branch=main#cedf169266d70f10cd1d6c9fd9d3fc38fccf6604" source = "git+https://github.com/fgRuslan/pklib-rs?rev=d94f5bef9461c9c964c18a56cb9821de464b818e#d94f5bef9461c9c964c18a56cb9821de464b818e"
dependencies = [ dependencies = [
"clap", "clap",
"indicatif", "indicatif",
+1 -1
View File
@@ -5,7 +5,7 @@ edition = "2024"
[dependencies] [dependencies]
clap = "4.6.1" clap = "4.6.1"
pklib = { git = "https://github.com/fgRuslan/pklib-rs", branch = "main" } pklib = { git = "https://github.com/fgRuslan/pklib-rs", rev = "d94f5bef9461c9c964c18a56cb9821de464b818e" }
rawzip = "0.4.4" rawzip = "0.4.4"
[profile.release] [profile.release]
+15 -1
View File
@@ -24,7 +24,7 @@ struct Args {
#[test] #[test]
fn test_large_file_implode() { fn test_large_file_implode() {
let data = vec![0u8; 50_000]; let data = vec![0u8; 10_000_000];
let compressed = pklib::implode_bytes( let compressed = pklib::implode_bytes(
&data, &data,
pklib::CompressionMode::Binary, pklib::CompressionMode::Binary,
@@ -33,6 +33,7 @@ fn test_large_file_implode() {
.unwrap(); .unwrap();
let decompressed = pklib::explode_bytes(&compressed).unwrap(); let decompressed = pklib::explode_bytes(&compressed).unwrap();
assert_eq!(data.len(), decompressed.len()); assert_eq!(data.len(), decompressed.len());
assert_eq!(data, decompressed);
} }
fn implode_test( fn implode_test(
@@ -105,6 +106,19 @@ fn process_file(
let (_, descriptor) = writer.finish()?; let (_, descriptor) = writer.finish()?;
let compressed = entry.finish(descriptor)?; let compressed = entry.finish(descriptor)?;
/*
let cmp2 = pklib::implode_bytes(data, pklib::CompressionMode::Binary, pklib::DictionarySize::Size4K).unwrap();
let dcmp2 = pklib::explode_bytes(&cmp2).unwrap();
let c = data.to_vec();
assert_eq!(data.eq(&c), true);
assert_eq!(data.eq(&dcmp2), true);
assert_eq!(data.len(), dcmp2.len());
assert_eq!(dcmp2, c);
*/
Ok::<(), Box<dyn std::error::Error>>(()) Ok::<(), Box<dyn std::error::Error>>(())
} }