array_stack_test
array_stack_test.go 源码
package array_stack
import (
"fmt"
"testing"
)
func TestArrayStack(t *testing.T) {
stack := Default()
stack.Push(1)
stack.Push(23)
stack.Push(3)
stack.Push("jack")
peek, _ := stack.Peek()
fmt.Println(peek)
fmt.Println(len(stack.data))
fmt.Println(cap(stack.data))
fmt.Println(stack.Size())
stack.PrintData()
pop, _ := stack.Pop()
pop, _ = stack.Pop()
pop, _ = stack.Pop()
fmt.Println(pop)
fmt.Println(stack.Size())
stack.PrintData()
pop, _ = stack.Pop()
fmt.Println(pop)
fmt.Println(stack.Size())
fmt.Println(stack.Empty())
}
你可能感兴趣的文章
0
赞
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦