You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
579 B
Go
28 lines
579 B
Go
1 year ago
|
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)
|
||
|
}
|