diff --git a/Cargo.lock b/Cargo.lock index dc88b7b..7a78852 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -231,8 +231,7 @@ checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" [[package]] name = "pklib" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88b72c1327d25f7c73e2ac5a565ae1f7703a310aea1edfb4ea57ac2243e28f2" +source = "git+https://github.com/fgRuslan/pklib-rs?branch=main#cedf169266d70f10cd1d6c9fd9d3fc38fccf6604" dependencies = [ "clap", "indicatif", diff --git a/Cargo.toml b/Cargo.toml index d4e38c4..8c6da0d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ edition = "2024" [dependencies] clap = "4.6.1" -pklib = "0.2.0" +pklib = { git = "https://github.com/fgRuslan/pklib-rs", branch = "main" } rawzip = "0.4.4" [profile.release] diff --git a/src/main.rs b/src/main.rs index cc2a1a6..e7a78ab 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use std::{fs::{self, File}, io::{Read, Seek, Write}, time::UNIX_EPOCH}; +use std::{fs::{self, File}, io::{Read, Seek, Write}, process::exit, time::UNIX_EPOCH}; use pklib; use rawzip::{ZipArchiveWriter, time::ZipDateTime}; use clap::{Parser, Subcommand}; @@ -18,6 +18,14 @@ struct Args { output_archive: String } +#[test] +fn test_large_file_implode() { + let data = vec![0u8; 50_000]; + let compressed = pklib::implode_bytes(&data, pklib::CompressionMode::Binary, pklib::DictionarySize::Size4K).unwrap(); + let decompressed = pklib::explode_bytes(&compressed).unwrap(); + assert_eq!(data.len(), decompressed.len()); +} + fn implode_test(input_dir: String, output_archive: String) -> Result<(), Box> { let mut output = Vec::new(); let mut archive = rawzip::ZipArchiveWriter::new(&mut output); @@ -70,7 +78,7 @@ fn process_file(archive: &mut ZipArchiveWriter<&mut Vec>, filename: &str, mo let (_, descriptor) = writer.finish()?; let compressed = entry.finish(descriptor)?; - + Ok::<(), Box>(()) }