MCPcopy Create free account
hub / github.com/HDT3213/rdb / TestLZFString

Function TestLZFString

core/string_test.go:121–146  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

119}
120
121func TestLZFString(t *testing.T) {
122 buf := bytes.NewBuffer(nil)
123 enc := NewEncoder(buf).EnableCompress()
124 var strList []string
125 for i := 0; i < 10; i++ {
126 strList = append(strList, strings.Repeat(RandString(128), 10))
127 }
128 for _, str := range strList {
129 err := enc.writeString(str)
130 if err != nil {
131 t.Error(err)
132 return
133 }
134 }
135 dec := NewDecoder(buf)
136 for _, expect := range strList {
137 actual, err := dec.readString()
138 if err != nil {
139 t.Error(err)
140 continue
141 }
142 if string(actual) != expect {
143 t.Errorf("expect %s, actual %s", expect, string(actual))
144 }
145 }
146}

Callers

nothing calls this directly

Calls 6

readStringMethod · 0.95
NewEncoderFunction · 0.85
NewDecoderFunction · 0.85
EnableCompressMethod · 0.80
writeStringMethod · 0.80
RandStringFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…