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

Function Test_sequenceDecs_decodeNoBMI

zstd/seqdec_amd64_test.go:29–154  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

27}
28
29func Test_sequenceDecs_decodeNoBMI(t *testing.T) {
30 if !cpuinfo.HasBMI2() {
31 t.Skip("Already tested, platform does not have bmi2")
32 return
33 }
34 defer cpuinfo.DisableBMI2()()
35
36 const writeWant = false
37 var buf bytes.Buffer
38 zw := zip.NewWriter(&buf)
39
40 want := map[string][]seqVals{}
41 var wantOffsets = map[string][3]int{}
42 if !writeWant {
43 fn := "testdata/seqs-want.zip"
44 data, err := os.ReadFile(fn)
45 tb := t
46 if err != nil {
47 tb.Fatal(err)
48 }
49 zr, err := zip.NewReader(bytes.NewReader(data), int64(len(data)))
50 if err != nil {
51 tb.Fatal(err)
52 }
53 for _, tt := range zr.File {
54 var ref testSequence
55 if !ref.parse(tt.Name) {
56 tb.Skip("unable to parse:", tt.Name)
57 }
58 o, err := tt.Open()
59 if err != nil {
60 t.Fatal(err)
61 }
62 r := csv.NewReader(o)
63 recs, err := r.ReadAll()
64 if err != nil {
65 t.Fatal(err)
66 }
67 for i, rec := range recs {
68 if i == 0 {
69 var o [3]int
70 o[0], _ = strconv.Atoi(rec[0])
71 o[1], _ = strconv.Atoi(rec[1])
72 o[2], _ = strconv.Atoi(rec[2])
73 wantOffsets[tt.Name] = o
74 continue
75 }
76 s := seqVals{}
77 s.mo, _ = strconv.Atoi(rec[0])
78 s.ml, _ = strconv.Atoi(rec[1])
79 s.ll, _ = strconv.Atoi(rec[2])
80 want[tt.Name] = append(want[tt.Name], s)
81 }
82 o.Close()
83 }
84 }
85 fn := "testdata/seqs.zip"
86 data, err := os.ReadFile(fn)

Callers

nothing calls this directly

Calls 15

parseMethod · 0.95
CreateMethod · 0.95
WriteMethod · 0.95
FlushMethod · 0.95
CloseMethod · 0.95
HasBMI2Function · 0.92
DisableBMI2Function · 0.92
NewWriterFunction · 0.92
NewReaderFunction · 0.92
readDecodersFunction · 0.85
SkipMethod · 0.80
FatalMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…