(t *testing.T)
| 72 | } |
| 73 | |
| 74 | func TestResetFullQueue(t *testing.T) { |
| 75 | t.Parallel() |
| 76 | |
| 77 | // given |
| 78 | queue := NewBytesQueue(10, 20, false) |
| 79 | |
| 80 | // when |
| 81 | queue.Push(blob('a', 3)) |
| 82 | queue.Push(blob('b', 4)) |
| 83 | |
| 84 | // when |
| 85 | assertEqual(t, blob('a', 3), pop(queue)) // space freed at the beginning |
| 86 | _, err := queue.Push(blob('a', 3)) // will set q.full to true |
| 87 | |
| 88 | // then |
| 89 | assertEqual(t, err, nil) |
| 90 | |
| 91 | // when |
| 92 | queue.Reset() |
| 93 | queue.Push(blob('c', 8)) // should not trigger a re-allocation |
| 94 | |
| 95 | // then |
| 96 | assertEqual(t, blob('c', 8), pop(queue)) |
| 97 | assertEqual(t, queue.Capacity(), 10) |
| 98 | } |
| 99 | |
| 100 | func TestReset(t *testing.T) { |
| 101 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…