Created
May 16, 2022 06:37
-
-
Save sausheong/6a050fdc6cd33ab599c010d652867399 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 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