(t *testing.T)
| 39 | } |
| 40 | |
| 41 | func TestQueueLength(t *testing.T) { |
| 42 | q := New() |
| 43 | |
| 44 | if q.Length() != 0 { |
| 45 | t.Error("empty queue length not 0") |
| 46 | } |
| 47 | |
| 48 | for i := 0; i < 1000; i++ { |
| 49 | q.Add(i) |
| 50 | if q.Length() != i+1 { |
| 51 | t.Error("adding: queue with", i, "elements has length", q.Length()) |
| 52 | } |
| 53 | } |
| 54 | for i := 0; i < 1000; i++ { |
| 55 | q.Remove() |
| 56 | if q.Length() != 1000-i-1 { |
| 57 | t.Error("removing: queue with", 1000-i-i, "elements has length", q.Length()) |
| 58 | } |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | func TestQueueGet(t *testing.T) { |
| 63 | q := New() |