MCPcopy Create free account
hub / github.com/allegro/bigcache / TestPushEntryAfterAllocateAdditionMemory

Function TestPushEntryAfterAllocateAdditionMemory

queue/bytes_queue_test.go:407–426  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

405}
406
407func TestPushEntryAfterAllocateAdditionMemory(t *testing.T) {
408 t.Parallel()
409
410 // given
411 queue := NewBytesQueue(9, 20, true)
412
413 // when
414 queue.Push([]byte("aaa"))
415 queue.Push([]byte("bb"))
416 queue.Pop()
417
418 // allocate more memory
419 assertEqual(t, 9, queue.Capacity())
420 queue.Push([]byte("c"))
421 assertEqual(t, 18, queue.Capacity())
422
423 // push after allocate
424 _, err := queue.Push([]byte("d"))
425 noError(t, err)
426}
427
428func TestPushEntryAfterAllocateAdditionMemoryInFull(t *testing.T) {
429 t.Parallel()

Callers

nothing calls this directly

Calls 6

PushMethod · 0.95
PopMethod · 0.95
CapacityMethod · 0.95
NewBytesQueueFunction · 0.85
assertEqualFunction · 0.70
noErrorFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…