(t *testing.T)
| 13 | } |
| 14 | |
| 15 | func TestReorder(t *testing.T) { |
| 16 | t.Run(t.Name(), func(t *testing.T) { |
| 17 | var recoder RTPReorder[*stuff] |
| 18 | for i := (uint16)(0); i < 25; i++ { |
| 19 | recoder.Push(i*2, &stuff{seq: i * 2}) |
| 20 | } |
| 21 | if recoder.Pop() != nil { |
| 22 | t.Error("pop nil") |
| 23 | } |
| 24 | for i := (uint16)(0); i < 25; i++ { |
| 25 | x := recoder.Push(i*2+1, &stuff{seq: i*2 + 1}) |
| 26 | if x != nil { |
| 27 | t.Logf("%d", x.seq) |
| 28 | } |
| 29 | for { |
| 30 | if x = recoder.Pop(); x == nil { |
| 31 | break |
| 32 | } else { |
| 33 | t.Logf("%d", x.seq) |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | }) |
| 38 | } |