(t *testing.T)
| 358 | } |
| 359 | |
| 360 | func TestMergeTokens(t *testing.T) { |
| 361 | tests := map[string]struct { |
| 362 | input [][]uint32 |
| 363 | expected []uint32 |
| 364 | }{ |
| 365 | "empty input": { |
| 366 | input: nil, |
| 367 | expected: []uint32{}, |
| 368 | }, |
| 369 | "single instance in input": { |
| 370 | input: [][]uint32{ |
| 371 | {1, 3, 4, 8}, |
| 372 | }, |
| 373 | expected: []uint32{1, 3, 4, 8}, |
| 374 | }, |
| 375 | "multiple instances in input": { |
| 376 | input: [][]uint32{ |
| 377 | {1, 3, 4, 8}, |
| 378 | {0, 2, 6, 9}, |
| 379 | {5, 7, 10, 11}, |
| 380 | }, |
| 381 | expected: []uint32{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, |
| 382 | }, |
| 383 | "some instances have no tokens": { |
| 384 | input: [][]uint32{ |
| 385 | {1, 3, 4, 8}, |
| 386 | {}, |
| 387 | {0, 2, 6, 9}, |
| 388 | {}, |
| 389 | {5, 7, 10, 11}, |
| 390 | }, |
| 391 | expected: []uint32{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}, |
| 392 | }, |
| 393 | } |
| 394 | |
| 395 | for testName, testData := range tests { |
| 396 | t.Run(testName, func(t *testing.T) { |
| 397 | assert.Equal(t, testData.expected, MergeTokens(testData.input)) |
| 398 | }) |
| 399 | } |
| 400 | } |
| 401 | |
| 402 | func TestMergeTokensByZone(t *testing.T) { |
| 403 | tests := map[string]struct { |
nothing calls this directly
no test coverage detected