You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-algorithms/stack/stack_test.go

26 lines
368 B
Go

package stack
import "testing"
func Test_Stack(t *testing.T) {
7 years ago
stack := New()
7 years ago
stack.Push(5)
stack.Push(6)
stack.Push(7)
7 years ago
if stack.Length() != 3 {
t.Error("[Error] stack length is wrong")
}
7 years ago
stack.Pop()
if stack.Length() != 2 {
t.Error("[Error] stack length is wrong after pop")
}
if stack.Peek() != 6 {
t.Error("[Error] stack Peek is wrong")
}
}