MCPcopy Index your code
hub / github.com/HDT3213/rdb / TestRandomStringEncoding

Function TestRandomStringEncoding

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

Source from the content-addressed store, hash-verified

88}
89
90func TestRandomStringEncoding(t *testing.T) {
91 size := 1000
92 round := 2000
93 strList := make([]string, size)
94 for r := 0; r < round; r++ {
95 for i := 0; i < size; i++ {
96 strList[i] = RandString(rand.Intn(50))
97 }
98 buf := bytes.NewBuffer(nil)
99 enc := NewEncoder(buf)
100 for _, str := range strList {
101 err := enc.writeString(str)
102 if err != nil {
103 t.Error(err)
104 return
105 }
106 }
107 dec := NewDecoder(buf)
108 for _, expect := range strList {
109 actual, err := dec.readString()
110 if err != nil {
111 t.Error(err)
112 continue
113 }
114 if string(actual) != expect {
115 t.Errorf("expect %s, actual %s", expect, string(actual))
116 }
117 }
118 }
119}
120
121func TestLZFString(t *testing.T) {
122 buf := bytes.NewBuffer(nil)

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…