2016-02-03 05:58:42 -05:00
|
|
|
package protocol_test
|
2016-01-20 11:45:50 -05:00
|
|
|
|
|
|
|
import (
|
2016-01-21 07:05:16 -05:00
|
|
|
"testing"
|
2016-01-20 11:45:50 -05:00
|
|
|
|
2016-08-20 14:55:45 -04:00
|
|
|
"v2ray.com/core/common/predicate"
|
|
|
|
. "v2ray.com/core/common/protocol"
|
|
|
|
"v2ray.com/core/common/uuid"
|
2017-10-24 10:15:35 -04:00
|
|
|
. "v2ray.com/ext/assert"
|
2016-01-20 11:45:50 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestCmdKey(t *testing.T) {
|
2017-10-24 10:15:35 -04:00
|
|
|
assert := With(t)
|
2016-01-20 11:45:50 -05:00
|
|
|
|
2016-01-21 07:05:16 -05:00
|
|
|
id := NewID(uuid.New())
|
2017-10-24 10:15:35 -04:00
|
|
|
assert(predicate.BytesAll(id.CmdKey(), 0), IsFalse)
|
2016-01-20 11:45:50 -05:00
|
|
|
}
|
2017-12-17 18:07:50 -05: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())
|
|
|
|
}
|