MCPcopy Index your code
hub / github.com/0xAX/go-algorithms / TestStack

Function TestStack

stack/stack_test.go:5–21  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3import "testing"
4
5func TestStack(t *testing.T) {
6 var stack *Stack = New()
7
8 stack.Push(1)
9 stack.Push(2)
10 stack.Push(3)
11 stack.Push(4)
12 stack.Push(5)
13
14 for i := 5; i > 0; i-- {
15 item := stack.Pop()
16
17 if item != i {
18 t.Error("TestStack failed...", i)
19 }
20 }
21}

Callers

nothing calls this directly

Calls 3

PushMethod · 0.95
PopMethod · 0.95
NewFunction · 0.70

Tested by

no test coverage detected