From 19e1bb59a36e7151b0fccf1f3c1b62b914b1a739 Mon Sep 17 00:00:00 2001 From: bandl <1658002533@qq.com> Date: Mon, 29 Nov 2021 00:16:17 +0800 Subject: [PATCH] test(channelx): add channelx test --- pkg/structure/channelx/channelx_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 pkg/structure/channelx/channelx_test.go diff --git a/pkg/structure/channelx/channelx_test.go b/pkg/structure/channelx/channelx_test.go new file mode 100644 index 0000000..7fffdf9 --- /dev/null +++ b/pkg/structure/channelx/channelx_test.go @@ -0,0 +1,19 @@ +package channelx + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestChannelX_Push(t *testing.T) { + c := MakeChannelX(10) + require.Equal(t, c.Length(), 0) + + up := c.Push("111") + require.Equal(t, 24, int(up)) + + res, up := c.Pop() + require.Equal(t, 24, int(up)) + require.Equal(t, res, "111") +}