diff options
author | Valery Piashchynski <[email protected]> | 2021-09-11 11:57:37 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-09-11 11:57:37 +0300 |
commit | b9521e41aab0b085f9922c535998b6e6a503d723 (patch) | |
tree | 1b8becf283e160daa4a30e10bbfa72ccf5033afb /pkg | |
parent | 0c4dd160a3eec4d76b9b82799c55eea4c5f50629 (diff) |
Update codecov
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/priority_queue/binary_heap_test.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/pkg/priority_queue/binary_heap_test.go b/pkg/priority_queue/binary_heap_test.go index fb5b83de..456fc27e 100644 --- a/pkg/priority_queue/binary_heap_test.go +++ b/pkg/priority_queue/binary_heap_test.go @@ -61,6 +61,28 @@ func TestBinHeap_Init(t *testing.T) { require.Equal(t, expected, res) } +func TestBinHeap_MaxLen(t *testing.T) { + a := []Item{Test(2), Test(23), Test(33), Test(44), Test(1), Test(2), Test(2), Test(2), Test(4), Test(6), Test(99)} + + bh := NewBinHeap(1) + + go func() { + expected := []Item{Test(1), Test(2), Test(2), Test(2), Test(2), Test(4), Test(6), Test(23), Test(33), Test(44), Test(99)} + + res := make([]Item, 0, 12) + + for i := 0; i < 11; i++ { + item := bh.ExtractMin() + res = append(res, item) + } + require.Equal(t, expected, res) + }() + + for i := 0; i < len(a); i++ { + bh.Insert(a[i]) + } +} + func TestNewPriorityQueue(t *testing.T) { insertsPerSec := uint64(0) getPerSec := uint64(0) |