From 3854f6d255acf64987fcf49cfd7239cf3d4dd819 Mon Sep 17 00:00:00 2001 From: xiaok29 <1526783667@qq.com> Date: Tue, 14 May 2024 12:00:24 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20build:=20=E4=BF=AE=E6=94=B9testi?= =?UTF-8?q?fy=E4=BE=9D=E8=B5=96=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- codes/go/chapter_stack_and_queue/queue_test.go | 4 +++- codes/go/go.mod | 8 ++++++-- codes/go/go.sum | 14 ++++++++++---- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/codes/go/chapter_stack_and_queue/queue_test.go b/codes/go/chapter_stack_and_queue/queue_test.go index 8c0906bbe..fc43548b5 100644 --- a/codes/go/chapter_stack_and_queue/queue_test.go +++ b/codes/go/chapter_stack_and_queue/queue_test.go @@ -10,7 +10,7 @@ import ( "testing" . "github.com/krahets/hello-algo/pkg" - "gotest.tools/v3/assert" + "github.com/stretchr/testify/assert" ) func TestQueue(t *testing.T) { @@ -54,6 +54,8 @@ func TestArrayQueue(t *testing.T) { queue.push(1) queue.push(2) assert.Equal(t, 1, queue.pop()) + assert.Equal(t, 2, queue.pop()) + assert.Equal(t, []int{}, queue.toSlice()) }) // 初始化队列,使用队列的通用接口 diff --git a/codes/go/go.mod b/codes/go/go.mod index a62c29afd..e8853194a 100644 --- a/codes/go/go.mod +++ b/codes/go/go.mod @@ -2,6 +2,10 @@ module github.com/krahets/hello-algo go 1.19 -require gotest.tools/v3 v3.5.1 +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) -require github.com/google/go-cmp v0.5.9 // indirect +require github.com/stretchr/testify v1.9.0 diff --git a/codes/go/go.sum b/codes/go/go.sum index 7dd4ab56e..60ce688a0 100644 --- a/codes/go/go.sum +++ b/codes/go/go.sum @@ -1,4 +1,10 @@ -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= -gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=