test(channelx): add channelx test

This commit is contained in:
bandl 2021-11-29 00:16:17 +08:00
parent c381c57374
commit 19e1bb59a3
1 changed files with 19 additions and 0 deletions

View File

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