TestIntSetMsgsize tests Msgsize for IntSet
(t *testing.T)
| 361 | |
| 362 | // TestIntSetMsgsize tests Msgsize for IntSet |
| 363 | func 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 |
| 399 | func TestMsgpSortedBehavior(t *testing.T) { |
nothing calls this directly
no test coverage detected