MCPcopy
hub / github.com/minio/minio-go / TestStringSetMsgsize

Function TestStringSetMsgsize

pkg/set/msgp_test.go:176–209  ·  view source on GitHub ↗

TestStringSetMsgsize tests Msgsize for StringSet

(t *testing.T)

Source from the content-addressed store, hash-verified

174
175// TestStringSetMsgsize tests Msgsize for StringSet
176func TestStringSetMsgsize(t *testing.T) {
177 testCases := []struct {
178 name string
179 set StringSet
180 }{
181 {
182 name: "empty set",
183 set: NewStringSet(),
184 },
185 {
186 name: "small set",
187 set: CreateStringSet("a", "b"),
188 },
189 {
190 name: "larger set",
191 set: CreateStringSet("alpha", "beta", "gamma", "delta", "epsilon"),
192 },
193 }
194
195 for _, tc := range testCases {
196 t.Run(tc.name, func(t *testing.T) {
197 size := tc.set.Msgsize()
198 data, err := tc.set.MarshalMsg(nil)
199 if err != nil {
200 t.Fatalf("MarshalMsg() error = %v", err)
201 }
202
203 // Msgsize should be >= actual size
204 if size < len(data) {
205 t.Errorf("Msgsize() = %d, but actual size = %d", size, len(data))
206 }
207 })
208 }
209}
210
211// TestIntSetMsgpRoundtrip tests msgp serialization/deserialization for IntSet
212func TestIntSetMsgpRoundtrip(t *testing.T) {

Callers

nothing calls this directly

Calls 4

NewStringSetFunction · 0.85
CreateStringSetFunction · 0.85
MsgsizeMethod · 0.45
MarshalMsgMethod · 0.45

Tested by

no test coverage detected