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") +}