MCPcopy
hub / github.com/klauspost/compress / TestDecoder_SmallDict

Function TestDecoder_SmallDict

zstd/dict_test.go:14–48  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

12)
13
14func TestDecoder_SmallDict(t *testing.T) {
15 // All files have CRC
16 zr := testCreateZipReader("testdata/dict-tests-small.zip", t)
17 dicts := readDicts(t, zr)
18 dec, err := NewReader(nil, WithDecoderConcurrency(1), WithDecoderDicts(dicts...))
19 if err != nil {
20 t.Fatal(err)
21 return
22 }
23 defer dec.Close()
24 for _, tt := range zr.File {
25 if !strings.HasSuffix(tt.Name, ".zst") {
26 continue
27 }
28 t.Run("decodeall-"+tt.Name, func(t *testing.T) {
29 r, err := tt.Open()
30 if err != nil {
31 t.Fatal(err)
32 }
33 defer r.Close()
34 in, err := io.ReadAll(r)
35 if err != nil {
36 t.Fatal(err)
37 }
38 got, err := dec.DecodeAll(in, nil)
39 if err != nil {
40 t.Fatal(err)
41 }
42 _, err = dec.DecodeAll(in, got[:0])
43 if err != nil {
44 t.Fatal(err)
45 }
46 })
47 }
48}
49
50func buildDictLevelPathFixture() (samples [][]byte, history, src []byte) {
51 history = bytes.Repeat([]byte("build dict common phrase alpha beta gamma delta "), 16)

Callers

nothing calls this directly

Calls 10

CloseMethod · 0.95
testCreateZipReaderFunction · 0.85
readDictsFunction · 0.85
WithDecoderConcurrencyFunction · 0.85
WithDecoderDictsFunction · 0.85
FatalMethod · 0.80
DecodeAllMethod · 0.80
NewReaderFunction · 0.70
CloseMethod · 0.65
OpenMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…