Skip to content

Instantly share code, notes, and snippets.

@sausheong
Created May 16, 2022 06:34
Show Gist options
  • Save sausheong/452f5b15252df5549e2c6c6b378fef43 to your computer and use it in GitHub Desktop.
Save sausheong/452f5b15252df5549e2c6c6b378fef43 to your computer and use it in GitHub Desktop.
generics
func TestTStack(t *testing.T) {
stack := &TStack[string]{}
stack.Push("the")
stack.Push("quick")
stack.Push("brown")
stack.Push("fox")
if stack.Peek() != "fox" {
t.Error(stack.Peek())
}
if str := stack.Pop(); str != "fox" {
t.Error(str)
}
if str := stack.Pop(); str != "brown" {
t.Error(str)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment