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

Function TestIntSetMsgsize

pkg/set/msgp_test.go:363–396  ·  view source on GitHub ↗

TestIntSetMsgsize tests Msgsize for IntSet

(t *testing.T)

Source from the content-addressed store, hash-verified

361
362// TestIntSetMsgsize tests Msgsize for IntSet
363func TestIntSetMsgsize(t *testing.T) {
364 testCases := []struct {
365 name string
366 set IntSet
367 }{
368 {
369 name: "empty set",
370 set: NewIntSet(),
371 },
372 {
373 name: "small set",
374 set: CreateIntSet(1, 2),
375 },
376 {
377 name: "larger set",
378 set: CreateIntSet(1, 10, 100, 1000, 10000),
379 },
380 }
381
382 for _, tc := range testCases {
383 t.Run(tc.name, func(t *testing.T) {
384 size := tc.set.Msgsize()
385 data, err := tc.set.MarshalMsg(nil)
386 if err != nil {
387 t.Fatalf("MarshalMsg() error = %v", err)
388 }
389
390 // Msgsize should be >= actual size
391 if size < len(data) {
392 t.Errorf("Msgsize() = %d, but actual size = %d", size, len(data))
393 }
394 })
395 }
396}
397
398// TestMsgpSortedBehavior ensures that sorted variants maintain order
399func TestMsgpSortedBehavior(t *testing.T) {

Callers

nothing calls this directly

Calls 4

NewIntSetFunction · 0.85
CreateIntSetFunction · 0.85
MsgsizeMethod · 0.45
MarshalMsgMethod · 0.45

Tested by

no test coverage detected