1
0
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:
Darien Raymond 2017-07-25 22:28:48 +02:00
parent 21284fbd61
commit 6bbc3a6945
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

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