Skip to content

Commit

Permalink
check error
Browse files Browse the repository at this point in the history
  • Loading branch information
DarienRaymond committed Jul 25, 2017
1 parent 21284fb commit 6bbc3a6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions proxy/vmess/encoding/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"crypto/rand"
"testing"

"v2ray.com/core/common"
. "v2ray.com/core/proxy/vmess/encoding"
"v2ray.com/core/testing/assert"
)
Expand All @@ -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)
Expand Down

0 comments on commit 6bbc3a6

Please sign in to comment.