make it work with my version

This commit is contained in:
2026-07-05 23:52:34 +03:00
parent d9ea4356de
commit 65ce5d0771
3 changed files with 12 additions and 5 deletions
Generated
+1 -2
View File
@@ -231,8 +231,7 @@ checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd"
[[package]] [[package]]
name = "pklib" name = "pklib"
version = "0.2.0" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/fgRuslan/pklib-rs?branch=main#cedf169266d70f10cd1d6c9fd9d3fc38fccf6604"
checksum = "e88b72c1327d25f7c73e2ac5a565ae1f7703a310aea1edfb4ea57ac2243e28f2"
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 = "0.2.0" pklib = { git = "https://github.com/fgRuslan/pklib-rs", branch = "main" }
rawzip = "0.4.4" rawzip = "0.4.4"
[profile.release] [profile.release]
+10 -2
View File
@@ -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 pklib;
use rawzip::{ZipArchiveWriter, time::ZipDateTime}; use rawzip::{ZipArchiveWriter, time::ZipDateTime};
use clap::{Parser, Subcommand}; use clap::{Parser, Subcommand};
@@ -18,6 +18,14 @@ struct Args {
output_archive: String 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<dyn std::error::Error>> { fn implode_test(input_dir: String, output_archive: String) -> Result<(), Box<dyn std::error::Error>> {
let mut output = Vec::new(); let mut output = Vec::new();
let mut archive = rawzip::ZipArchiveWriter::new(&mut output); let mut archive = rawzip::ZipArchiveWriter::new(&mut output);
@@ -70,7 +78,7 @@ fn process_file(archive: &mut ZipArchiveWriter<&mut Vec<u8>>, filename: &str, mo
let (_, descriptor) = writer.finish()?; let (_, descriptor) = writer.finish()?;
let compressed = entry.finish(descriptor)?; let compressed = entry.finish(descriptor)?;
Ok::<(), Box<dyn std::error::Error>>(()) Ok::<(), Box<dyn std::error::Error>>(())
} }