Skip to content

Commit

Permalink
add unit tests for available slice count
Browse files Browse the repository at this point in the history
  • Loading branch information
JesseCoretta committed Aug 20, 2023
1 parent 1cc1182 commit 77dae6b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions stack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,24 @@ func TestBasic_withCapacity(t *testing.T) {
}
}

func TestBasic_availableCapacity(t *testing.T) {
b := Basic(2)
b.Push(
float64(3.14159),
float64(-9.378),
float64(139.104),
)

if b.Avail() != 0 {
t.Errorf("%s failed: unexpected available slice count; want len:%d, got len:%d", t.Name(), 2, b.Avail())
}

b = Basic(5)
if b.Avail() != 5 {
t.Errorf("%s failed: unexpected available slice count; want len:%d, got len:%d", t.Name(), 5, b.Avail())
}
}

func TestReset(t *testing.T) {
b := Basic()
b.Push(
Expand Down

0 comments on commit 77dae6b

Please sign in to comment.