MCPcopy Index your code
hub / github.com/klauspost/compress / TestNewDecoderBad

Function TestNewDecoderBad

zstd/decoder_test.go:409–455  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

407}
408
409func TestNewDecoderBad(t *testing.T) {
410 var errMap = make(map[string]string)
411 if true {
412 t.Run("Reader-4", func(t *testing.T) {
413 newFn := func() (*Decoder, error) {
414 return NewReader(nil, WithDecoderConcurrency(4), WithDecoderMaxMemory(1<<30))
415 }
416 testDecoderFileBad(t, "testdata/bad.zip", newFn, errMap)
417
418 })
419 t.Run("Reader-1", func(t *testing.T) {
420 newFn := func() (*Decoder, error) {
421 return NewReader(nil, WithDecoderConcurrency(1), WithDecoderMaxMemory(1<<30))
422 }
423 testDecoderFileBad(t, "testdata/bad.zip", newFn, errMap)
424 })
425 t.Run("Reader-4-bigmem", func(t *testing.T) {
426 newFn := func() (*Decoder, error) {
427 return NewReader(nil, WithDecoderConcurrency(4), WithDecoderMaxMemory(1<<30), WithDecoderLowmem(false))
428 }
429 testDecoderFileBad(t, "testdata/bad.zip", newFn, errMap)
430
431 })
432 t.Run("Reader-1-bigmem", func(t *testing.T) {
433 newFn := func() (*Decoder, error) {
434 return NewReader(nil, WithDecoderConcurrency(1), WithDecoderMaxMemory(1<<30), WithDecoderLowmem(false))
435 }
436 testDecoderFileBad(t, "testdata/bad.zip", newFn, errMap)
437 })
438 }
439 t.Run("DecodeAll", func(t *testing.T) {
440 defer timeout(10 * time.Second)()
441 dec, err := NewReader(nil, WithDecoderMaxMemory(1<<30))
442 if err != nil {
443 t.Fatal(err)
444 }
445 testDecoderDecodeAllError(t, "testdata/bad.zip", dec, errMap)
446 })
447 t.Run("DecodeAll-bigmem", func(t *testing.T) {
448 defer timeout(10 * time.Second)()
449 dec, err := NewReader(nil, WithDecoderMaxMemory(1<<30), WithDecoderLowmem(false))
450 if err != nil {
451 t.Fatal(err)
452 }
453 testDecoderDecodeAllError(t, "testdata/bad.zip", dec, errMap)
454 })
455}
456
457func TestNewDecoderLarge(t *testing.T) {
458 newFn := func() (*Decoder, error) {

Callers

nothing calls this directly

Calls 8

WithDecoderConcurrencyFunction · 0.85
WithDecoderMaxMemoryFunction · 0.85
testDecoderFileBadFunction · 0.85
WithDecoderLowmemFunction · 0.85
timeoutFunction · 0.85
FatalMethod · 0.80
NewReaderFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…