1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-02-20 23:47:21 -05:00

28 lines
489 B
Go
Raw Normal View History

package protocol_test
2016-01-20 16:45:50 +00:00
import (
2016-01-21 12:05:16 +00:00
"testing"
2016-01-20 16:45:50 +00:00
2018-07-12 23:38:10 +02:00
"v2ray.com/core/common/compare"
2016-08-20 20:55:45 +02:00
. "v2ray.com/core/common/protocol"
"v2ray.com/core/common/uuid"
2017-10-24 16:15:35 +02:00
. "v2ray.com/ext/assert"
2016-01-20 16:45:50 +00:00
)
func TestCmdKey(t *testing.T) {
2017-10-24 16:15:35 +02:00
assert := With(t)
2016-01-20 16:45:50 +00:00
2016-01-21 12:05:16 +00:00
id := NewID(uuid.New())
2018-07-12 23:38:10 +02:00
assert(compare.BytesAll(id.CmdKey(), 0), IsFalse)
2016-01-20 16:45:50 +00:00
}
2017-12-18 00:07:50 +01:00
func TestIdEquals(t *testing.T) {
assert := With(t)
id1 := NewID(uuid.New())
id2 := NewID(id1.UUID())
assert(id1.Equals(id2), IsTrue)
assert(id1.String(), Equals, id2.String())
}