mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 01:57:12 -05:00
fix a flaky test
This commit is contained in:
parent
91109f3657
commit
1cf5225c0a
@ -6,21 +6,27 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"v2ray.com/core/common"
|
"v2ray.com/core/common"
|
||||||
|
"v2ray.com/core/common/compare"
|
||||||
. "v2ray.com/core/proxy/mtproto"
|
. "v2ray.com/core/proxy/mtproto"
|
||||||
. "v2ray.com/ext/assert"
|
. "v2ray.com/ext/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestInverse(t *testing.T) {
|
func TestInverse(t *testing.T) {
|
||||||
assert := With(t)
|
const size = 64
|
||||||
|
|
||||||
b := make([]byte, 64)
|
b := make([]byte, 64)
|
||||||
common.Must2(rand.Read(b))
|
for b[0] == b[size-1] {
|
||||||
|
common.Must2(rand.Read(b))
|
||||||
|
}
|
||||||
|
|
||||||
bi := Inverse(b)
|
bi := Inverse(b)
|
||||||
assert(b[0], NotEquals, bi[0])
|
if b[0] == bi[0] {
|
||||||
|
t.Fatal("seems bytes are not inversed: ", b[0], "vs", bi[0])
|
||||||
|
}
|
||||||
|
|
||||||
bii := Inverse(bi)
|
bii := Inverse(bi)
|
||||||
assert(bii, Equals, b)
|
if err := compare.BytesEqualWithDetail(bii, b); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAuthenticationReadWrite(t *testing.T) {
|
func TestAuthenticationReadWrite(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user