Skip to content

Commit

Permalink
lazychunks pop test
Browse files Browse the repository at this point in the history
  • Loading branch information
owen-d committed Aug 5, 2020
1 parent 40988f3 commit 2b8ab0a
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions pkg/storage/lazy_chunk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,36 @@ func TestLazyChunkIterator(t *testing.T) {
}
}

func TestLazyChunksPop(t *testing.T) {
for i, tc := range []struct {
initial int
n int
expectedLn int
rem int
}{
{1, 1, 1, 0},
{2, 1, 1, 1},
{3, 4, 3, 0},
} {

t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
lc := &lazyChunks{}
for i := 0; i < tc.initial; i++ {
lc.chunks = append(lc.chunks, &LazyChunk{})
}
out := lc.pop(tc.n)

for i := 0; i < tc.expectedLn; i++ {
require.NotNil(t, out[i])
}

for i := 0; i < tc.rem; i++ {
require.NotNil(t, lc.chunks[i])
}
})
}
}

func TestIsOverlapping(t *testing.T) {
tests := []struct {
name string
Expand Down

0 comments on commit 2b8ab0a

Please sign in to comment.