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

Function getEncOpts

zstd/encoder_test.go:31–66  ·  view source on GitHub ↗
(cMax int)

Source from the content-addressed store, hash-verified

29}
30
31func getEncOpts(cMax int) []testEncOpt {
32 var o []testEncOpt
33 for level := speedNotSet + 1; level < speedLast; level++ {
34 if isRaceTest && level >= SpeedBestCompression {
35 break
36 }
37 for conc := 1; conc <= 4; conc *= 2 {
38 for _, wind := range testWindowSizes {
39 addOpt := func(name string, options ...EOption) {
40 opts := append([]EOption(nil), WithEncoderLevel(level), WithEncoderConcurrency(conc), WithWindowSize(wind))
41 name = fmt.Sprintf("%s-c%d-w%dk-%s", level.String(), conc, wind/1024, name)
42 o = append(o, testEncOpt{name: name, o: append(opts, options...)})
43 }
44 addOpt("default")
45 if testing.Short() {
46 break
47 }
48 addOpt("nocrc", WithEncoderCRC(false))
49 addOpt("lowmem", WithLowerEncoderMem(true))
50 addOpt("alllit", WithAllLitEntropyCompression(true))
51 addOpt("nolit", WithNoEntropyCompression(true))
52 addOpt("pad1k", WithEncoderPadding(1024))
53 addOpt("zerof", WithZeroFrames(true))
54 addOpt("1seg", WithSingleSegment(true))
55 addOpt("conc", WithConcurrentBlocks(true))
56 }
57 if testing.Short() && conc == 2 {
58 break
59 }
60 if conc >= cMax {
61 break
62 }
63 }
64 }
65 return o
66}
67
68func TestEncoder_EncodeAllSimple(t *testing.T) {
69 in, err := os.ReadFile("testdata/z000028")

Callers 5

TestEncoderRegressionFunction · 0.85
testEncoderRoundtripFunction · 0.85

Calls 12

WithEncoderLevelFunction · 0.85
WithEncoderConcurrencyFunction · 0.85
WithWindowSizeFunction · 0.85
WithEncoderCRCFunction · 0.85
WithLowerEncoderMemFunction · 0.85
WithNoEntropyCompressionFunction · 0.85
WithEncoderPaddingFunction · 0.85
WithZeroFramesFunction · 0.85
WithSingleSegmentFunction · 0.85
WithConcurrentBlocksFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…