(ch <-chan T, count int, timeout time.Duration)
| 9 | ) |
| 10 | |
| 11 | func collectItems[T any](ch <-chan T, count int, timeout time.Duration) []T { |
| 12 | result := make([]T, 0, count) |
| 13 | timer := time.NewTimer(timeout) |
| 14 | defer timer.Stop() |
| 15 | |
| 16 | for i := 0; i < count; i++ { |
| 17 | select { |
| 18 | case item := <-ch: |
| 19 | result = append(result, item) |
| 20 | case <-timer.C: |
| 21 | return result |
| 22 | } |
| 23 | } |
| 24 | return result |
| 25 | } |
| 26 | |
| 27 | func TestQuickReorderQueue_InOrder(t *testing.T) { |
| 28 | q := MakeQuickReorderQueue[string](10, 100*time.Millisecond) |
no test coverage detected