Created
May 16, 2022 06:34
-
-
Save sausheong/452f5b15252df5549e2c6c6b378fef43 to your computer and use it in GitHub Desktop.
generics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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