@@ -188,6 +188,7 @@ func TestOpenReader(t *testing.T) {
188
188
189
189
t .Run (table .name , func (t * testing.T ) {
190
190
t .Parallel ()
191
+
191
192
r , err := sevenzip .OpenReader (filepath .Join ("testdata" , table .file ))
192
193
if err != nil {
193
194
assert .ErrorIs (t , err , table .err )
@@ -243,6 +244,7 @@ func TestOpenReaderWithPassword(t *testing.T) {
243
244
244
245
t .Run (table .name , func (t * testing.T ) {
245
246
t .Parallel ()
247
+
246
248
r , err := sevenzip .OpenReaderWithPassword (filepath .Join ("testdata" , table .file ), table .password )
247
249
if err != nil {
248
250
t .Fatal (err )
@@ -362,13 +364,13 @@ func benchmarkArchiveNaiveParallel(b *testing.B, file string, workers int) {
362
364
}
363
365
}
364
366
365
- func benchmarkArchive (b * testing.B , file string , optimised bool ) {
367
+ func benchmarkArchive (b * testing.B , file , password string , optimised bool ) {
366
368
b .Helper ()
367
369
368
370
h := crc32 .NewIEEE ()
369
371
370
372
for n := 0 ; n < b .N ; n ++ {
371
- r , err := sevenzip .OpenReader (filepath .Join ("testdata" , file ))
373
+ r , err := sevenzip .OpenReaderWithPassword (filepath .Join ("testdata" , file ), password )
372
374
if err != nil {
373
375
b .Fatal (err )
374
376
}
@@ -382,56 +384,60 @@ func benchmarkArchive(b *testing.B, file string, optimised bool) {
382
384
}
383
385
}
384
386
387
+ func BenchmarkAES7z (b * testing.B ) {
388
+ benchmarkArchive (b , "aes7z.7z" , "password" , true )
389
+ }
390
+
385
391
func BenchmarkBzip2 (b * testing.B ) {
386
- benchmarkArchive (b , "bzip2.7z" , true )
392
+ benchmarkArchive (b , "bzip2.7z" , "" , true )
387
393
}
388
394
389
395
func BenchmarkCopy (b * testing.B ) {
390
- benchmarkArchive (b , "copy.7z" , true )
396
+ benchmarkArchive (b , "copy.7z" , "" , true )
391
397
}
392
398
393
399
func BenchmarkDeflate (b * testing.B ) {
394
- benchmarkArchive (b , "deflate.7z" , true )
400
+ benchmarkArchive (b , "deflate.7z" , "" , true )
395
401
}
396
402
397
403
func BenchmarkDelta (b * testing.B ) {
398
- benchmarkArchive (b , "delta.7z" , true )
404
+ benchmarkArchive (b , "delta.7z" , "" , true )
399
405
}
400
406
401
407
func BenchmarkLZMA (b * testing.B ) {
402
- benchmarkArchive (b , "lzma.7z" , true )
408
+ benchmarkArchive (b , "lzma.7z" , "" , true )
403
409
}
404
410
405
411
func BenchmarkLZMA2 (b * testing.B ) {
406
- benchmarkArchive (b , "lzma2.7z" , true )
412
+ benchmarkArchive (b , "lzma2.7z" , "" , true )
407
413
}
408
414
409
415
func BenchmarkBCJ2 (b * testing.B ) {
410
- benchmarkArchive (b , "bcj2.7z" , true )
416
+ benchmarkArchive (b , "bcj2.7z" , "" , true )
411
417
}
412
418
413
419
func BenchmarkComplex (b * testing.B ) {
414
- benchmarkArchive (b , "lzma1900.7z" , true )
420
+ benchmarkArchive (b , "lzma1900.7z" , "" , true )
415
421
}
416
422
417
423
func BenchmarkLZ4 (b * testing.B ) {
418
- benchmarkArchive (b , "lz4.7z" , true )
424
+ benchmarkArchive (b , "lz4.7z" , "" , true )
419
425
}
420
426
421
427
func BenchmarkBrotli (b * testing.B ) {
422
- benchmarkArchive (b , "brotli.7z" , true )
428
+ benchmarkArchive (b , "brotli.7z" , "" , true )
423
429
}
424
430
425
431
func BenchmarkZstandard (b * testing.B ) {
426
- benchmarkArchive (b , "zstd.7z" , true )
432
+ benchmarkArchive (b , "zstd.7z" , "" , true )
427
433
}
428
434
429
435
func BenchmarkNaiveReader (b * testing.B ) {
430
- benchmarkArchive (b , "lzma1900.7z" , false )
436
+ benchmarkArchive (b , "lzma1900.7z" , "" , false )
431
437
}
432
438
433
439
func BenchmarkOptimisedReader (b * testing.B ) {
434
- benchmarkArchive (b , "lzma1900.7z" , true )
440
+ benchmarkArchive (b , "lzma1900.7z" , "" , true )
435
441
}
436
442
437
443
func BenchmarkNaiveParallelReader (b * testing.B ) {
@@ -447,17 +453,17 @@ func BenchmarkParallelReader(b *testing.B) {
447
453
}
448
454
449
455
func BenchmarkBCJ (b * testing.B ) {
450
- benchmarkArchive (b , "bcj.7z" , true )
456
+ benchmarkArchive (b , "bcj.7z" , "" , true )
451
457
}
452
458
453
459
func BenchmarkPPC (b * testing.B ) {
454
- benchmarkArchive (b , "ppc.7z" , true )
460
+ benchmarkArchive (b , "ppc.7z" , "" , true )
455
461
}
456
462
457
463
func BenchmarkARM (b * testing.B ) {
458
- benchmarkArchive (b , "arm.7z" , true )
464
+ benchmarkArchive (b , "arm.7z" , "" , true )
459
465
}
460
466
461
467
func BenchmarkSPARC (b * testing.B ) {
462
- benchmarkArchive (b , "sparc.7z" , true )
468
+ benchmarkArchive (b , "sparc.7z" , "" , true )
463
469
}
0 commit comments