package nbyte_test import ( "git.noahlan.cn/noahlan/ntool/nbyte" "git.noahlan.cn/noahlan/ntool/ntest/assert" "testing" ) func TestB64Encoder(t *testing.T) { src := []byte("abc1234566") dst := nbyte.B64Encoder.Encode(src) assert.NotEmpty(t, dst) decSrc, err := nbyte.B64Encoder.Decode(dst) assert.NoError(t, err) assert.Eq(t, src, decSrc) } func TestHexEncoder(t *testing.T) { src := []byte("abc1234566") dst := nbyte.HexEncoder.Encode(src) assert.NotEmpty(t, dst) decSrc, err := nbyte.HexEncoder.Decode(dst) assert.NoError(t, err) assert.Eq(t, src, decSrc) }