@@ -188,6 +188,7 @@ func TestOpenReader(t *testing.T) {
188188
189189 t .Run (table .name , func (t * testing.T ) {
190190 t .Parallel ()
191+
191192 r , err := sevenzip .OpenReader (filepath .Join ("testdata" , table .file ))
192193 if err != nil {
193194 assert .ErrorIs (t , err , table .err )
@@ -243,6 +244,7 @@ func TestOpenReaderWithPassword(t *testing.T) {
243244
244245 t .Run (table .name , func (t * testing.T ) {
245246 t .Parallel ()
247+
246248 r , err := sevenzip .OpenReaderWithPassword (filepath .Join ("testdata" , table .file ), table .password )
247249 if err != nil {
248250 t .Fatal (err )
@@ -362,13 +364,13 @@ func benchmarkArchiveNaiveParallel(b *testing.B, file string, workers int) {
362364 }
363365}
364366
365- func benchmarkArchive (b * testing.B , file string , optimised bool ) {
367+ func benchmarkArchive (b * testing.B , file , password string , optimised bool ) {
366368 b .Helper ()
367369
368370 h := crc32 .NewIEEE ()
369371
370372 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 )
372374 if err != nil {
373375 b .Fatal (err )
374376 }
@@ -382,56 +384,60 @@ func benchmarkArchive(b *testing.B, file string, optimised bool) {
382384 }
383385}
384386
387+ func BenchmarkAES7z (b * testing.B ) {
388+ benchmarkArchive (b , "aes7z.7z" , "password" , true )
389+ }
390+
385391func BenchmarkBzip2 (b * testing.B ) {
386- benchmarkArchive (b , "bzip2.7z" , true )
392+ benchmarkArchive (b , "bzip2.7z" , "" , true )
387393}
388394
389395func BenchmarkCopy (b * testing.B ) {
390- benchmarkArchive (b , "copy.7z" , true )
396+ benchmarkArchive (b , "copy.7z" , "" , true )
391397}
392398
393399func BenchmarkDeflate (b * testing.B ) {
394- benchmarkArchive (b , "deflate.7z" , true )
400+ benchmarkArchive (b , "deflate.7z" , "" , true )
395401}
396402
397403func BenchmarkDelta (b * testing.B ) {
398- benchmarkArchive (b , "delta.7z" , true )
404+ benchmarkArchive (b , "delta.7z" , "" , true )
399405}
400406
401407func BenchmarkLZMA (b * testing.B ) {
402- benchmarkArchive (b , "lzma.7z" , true )
408+ benchmarkArchive (b , "lzma.7z" , "" , true )
403409}
404410
405411func BenchmarkLZMA2 (b * testing.B ) {
406- benchmarkArchive (b , "lzma2.7z" , true )
412+ benchmarkArchive (b , "lzma2.7z" , "" , true )
407413}
408414
409415func BenchmarkBCJ2 (b * testing.B ) {
410- benchmarkArchive (b , "bcj2.7z" , true )
416+ benchmarkArchive (b , "bcj2.7z" , "" , true )
411417}
412418
413419func BenchmarkComplex (b * testing.B ) {
414- benchmarkArchive (b , "lzma1900.7z" , true )
420+ benchmarkArchive (b , "lzma1900.7z" , "" , true )
415421}
416422
417423func BenchmarkLZ4 (b * testing.B ) {
418- benchmarkArchive (b , "lz4.7z" , true )
424+ benchmarkArchive (b , "lz4.7z" , "" , true )
419425}
420426
421427func BenchmarkBrotli (b * testing.B ) {
422- benchmarkArchive (b , "brotli.7z" , true )
428+ benchmarkArchive (b , "brotli.7z" , "" , true )
423429}
424430
425431func BenchmarkZstandard (b * testing.B ) {
426- benchmarkArchive (b , "zstd.7z" , true )
432+ benchmarkArchive (b , "zstd.7z" , "" , true )
427433}
428434
429435func BenchmarkNaiveReader (b * testing.B ) {
430- benchmarkArchive (b , "lzma1900.7z" , false )
436+ benchmarkArchive (b , "lzma1900.7z" , "" , false )
431437}
432438
433439func BenchmarkOptimisedReader (b * testing.B ) {
434- benchmarkArchive (b , "lzma1900.7z" , true )
440+ benchmarkArchive (b , "lzma1900.7z" , "" , true )
435441}
436442
437443func BenchmarkNaiveParallelReader (b * testing.B ) {
@@ -447,17 +453,17 @@ func BenchmarkParallelReader(b *testing.B) {
447453}
448454
449455func BenchmarkBCJ (b * testing.B ) {
450- benchmarkArchive (b , "bcj.7z" , true )
456+ benchmarkArchive (b , "bcj.7z" , "" , true )
451457}
452458
453459func BenchmarkPPC (b * testing.B ) {
454- benchmarkArchive (b , "ppc.7z" , true )
460+ benchmarkArchive (b , "ppc.7z" , "" , true )
455461}
456462
457463func BenchmarkARM (b * testing.B ) {
458- benchmarkArchive (b , "arm.7z" , true )
464+ benchmarkArchive (b , "arm.7z" , "" , true )
459465}
460466
461467func BenchmarkSPARC (b * testing.B ) {
462- benchmarkArchive (b , "sparc.7z" , true )
468+ benchmarkArchive (b , "sparc.7z" , "" , true )
463469}
0 commit comments