mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-30 14:06:58 -05:00
check error
This commit is contained in:
parent
21284fbd61
commit
6bbc3a6945
@ -4,6 +4,7 @@ import (
|
||||
"crypto/rand"
|
||||
"testing"
|
||||
|
||||
"v2ray.com/core/common"
|
||||
. "v2ray.com/core/proxy/vmess/encoding"
|
||||
"v2ray.com/core/testing/assert"
|
||||
)
|
||||
@ -13,11 +14,12 @@ func TestFnvAuth(t *testing.T) {
|
||||
fnvAuth := new(FnvAuthenticator)
|
||||
|
||||
expectedText := make([]byte, 256)
|
||||
rand.Read(expectedText)
|
||||
_, err := rand.Read(expectedText)
|
||||
common.Must(err)
|
||||
|
||||
buffer := make([]byte, 512)
|
||||
b := fnvAuth.Seal(buffer[:0], nil, expectedText, nil)
|
||||
b, err := fnvAuth.Open(buffer[:0], nil, b, nil)
|
||||
b, err = fnvAuth.Open(buffer[:0], nil, b, nil)
|
||||
assert.Error(err).IsNil()
|
||||
assert.Int(len(b)).Equals(256)
|
||||
assert.Bytes(b).Equals(expectedText)
|
||||
|
Loading…
Reference in New Issue
Block a user