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

Function TestDecoderDictDeleteMultiple

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

Source from the content-addressed store, hash-verified

2312}
2313
2314func TestDecoderDictDeleteMultiple(t *testing.T) {
2315 dictContent := []byte("test dictionary content")
2316
2317 dec, err := NewReader(nil,
2318 WithDecoderDictRaw(100, dictContent),
2319 WithDecoderDictRaw(200, dictContent),
2320 WithDecoderDictRaw(300, dictContent))
2321 if err != nil {
2322 t.Fatal(err)
2323 }
2324 defer dec.Close()
2325
2326 if len(dec.o.dicts) != 3 {
2327 t.Fatalf("expected 3 dicts, got %d", len(dec.o.dicts))
2328 }
2329
2330 // Delete multiple dicts in one call
2331 err = dec.ResetWithOptions(nil, WithDecoderDictDelete(100, 300))
2332 if err != nil {
2333 t.Fatal(err)
2334 }
2335 if len(dec.o.dicts) != 1 {
2336 t.Errorf("expected 1 dict after delete, got %d", len(dec.o.dicts))
2337 }
2338 if _, ok := dec.o.dicts[200]; !ok {
2339 t.Error("dict 200 should still exist")
2340 }
2341}

Callers

nothing calls this directly

Calls 7

CloseMethod · 0.95
WithDecoderDictRawFunction · 0.85
WithDecoderDictDeleteFunction · 0.85
FatalMethod · 0.80
NewReaderFunction · 0.70
ResetWithOptionsMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…