/
githubmirror
/
LeetCode-Go
Обзор
Документация
Войти
/
githubmirror
/
LeetCode-Go
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
Special
structures/Stack_test.go
27 строк
510 B
YDZ
添加 structures
06 авг 2020, 18:29
06 авг 2020, 18:29
1934e38
Код
Авторство
О чём код?
package structures import ( "testing" "github.com/stretchr/testify/assert" ) func Test_Stack(t *testing.T) { ast := assert.New(t) s := NewStack() ast.True(s.IsEmpty(), "检查新建的 s 是否为空") start, end := 0, 100 for i := start; i < end; i++ { s.Push(i) ast.Equal(i-start+1, s.Len(), "Push 后检查 q 的长度。") } for i := end - 1; i >= start; i-- { ast.Equal(i, s.Pop(), "从 s 中 pop 出数来。") } ast.True(s.IsEmpty(), "检查 Pop 完毕后的 s 是否为空") }