Skip to content

Instantly share code, notes, and snippets.

@sausheong
Created May 16, 2022 06:37
Show Gist options
  • Save sausheong/6a050fdc6cd33ab599c010d652867399 to your computer and use it in GitHub Desktop.
Save sausheong/6a050fdc6cd33ab599c010d652867399 to your computer and use it in GitHub Desktop.
generics
func TestTStackInt(t *testing.T) {
stack := &TStack[int]{}
stack.Push(100)
stack.Push(200)
stack.Push(300)
stack.Push(400)
if stack.Peek() != 400 {
t.Error(stack.Peek())
}
if i := stack.Pop(); i != 400 {
t.Error(i)
}
if i := stack.Pop(); i != 300 {
t.Error(i)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment