mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 12:58:42 +08:00
fix(Go): Update array_queue.go and array_deque.go (#1362)
* 🐞 fix: 队列为空时不应该操作指向 * 🧪 test: 添加pop测试用例 * 🔧 build: 修改testify依赖包 * 🐞 fix: 双向队列为空时,pop不操作指向 * 🔧 build: Remove third-party packages * Delete codes/go/go.sum --------- Co-authored-by: Yudong Jin <krahets@163.com>
This commit is contained in:
@ -46,9 +46,13 @@ func TestQueue(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestArrayQueue(t *testing.T) {
|
||||
|
||||
// 初始化队列,使用队列的通用接口
|
||||
capacity := 10
|
||||
queue := newArrayQueue(capacity)
|
||||
if queue.pop() != nil {
|
||||
t.Errorf("want:%v,got:%v", nil, queue.pop())
|
||||
}
|
||||
|
||||
// 元素入队
|
||||
queue.push(1)
|
||||
|
||||
Reference in New Issue
Block a user