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

Function Test_seqdec_execute

zstd/seqdec_test.go:304–355  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

302}
303
304func Test_seqdec_execute(t *testing.T) {
305 zr := testCreateZipReader("testdata/seqs.zip", t)
306 tb := t
307 for _, tt := range zr.File {
308 var ref testSequence
309 if !ref.parse(tt.Name) {
310 tb.Skip("unable to parse:", tt.Name)
311 }
312 r, err := tt.Open()
313 if err != nil {
314 tb.Error(err)
315 return
316 }
317
318 seqData, err := io.ReadAll(r)
319 if err != nil {
320 tb.Error(err)
321 return
322 }
323 var buf = bytes.NewBuffer(seqData)
324 s := readDecoders(tb, buf, ref)
325 seqs := make([]seqVals, ref.n)
326
327 fatalIf := func(err error) {
328 if err != nil {
329 tb.Fatal(err)
330 }
331 }
332 fatalIf(s.br.init(buf.Bytes()))
333 fatalIf(s.litLengths.init(s.br))
334 fatalIf(s.offsets.init(s.br))
335 fatalIf(s.matchLengths.init(s.br))
336
337 fatalIf(s.decode(seqs))
338 hist := make([]byte, ref.win)
339 lits := s.literals
340
341 t.Run(tt.Name, func(t *testing.T) {
342 s.literals = lits
343 if len(s.out) > 0 {
344 s.out = s.out[:0]
345 }
346 err := s.execute(seqs, hist)
347 if err != nil {
348 t.Fatal(err)
349 }
350 if len(s.out) != s.seqSize {
351 t.Errorf("want %d != got %d", s.seqSize, len(s.out))
352 }
353 })
354 }
355}
356
357func Test_seqdec_decodeSync(t *testing.T) {
358 zr := testCreateZipReader("testdata/seqs.zip", t)

Callers

nothing calls this directly

Calls 11

parseMethod · 0.95
testCreateZipReaderFunction · 0.85
readDecodersFunction · 0.85
SkipMethod · 0.80
FatalMethod · 0.80
executeMethod · 0.80
BytesMethod · 0.65
OpenMethod · 0.45
ErrorMethod · 0.45
initMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…