2016-02-03 10:58:42 +00:00
|
|
|
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
|
|
|
|
2016-08-20 18:55:45 +00:00
|
|
|
. "v2ray.com/core/common/protocol"
|
|
|
|
"v2ray.com/core/common/uuid"
|
2016-01-20 16:45:50 +00:00
|
|
|
)
|
|
|
|
|
2017-12-17 23:07:50 +00:00
|
|
|
func TestIdEquals(t *testing.T) {
|
|
|
|
id1 := NewID(uuid.New())
|
|
|
|
id2 := NewID(id1.UUID())
|
|
|
|
|
2019-01-08 22:27:02 +00:00
|
|
|
if !id1.Equals(id2) {
|
|
|
|
t.Error("expected id1 to equal id2, but actually not")
|
|
|
|
}
|
|
|
|
|
2019-01-08 22:41:34 +00:00
|
|
|
if id1.String() != id2.String() {
|
2019-01-08 22:27:02 +00:00
|
|
|
t.Error(id1.String(), " != ", id2.String())
|
|
|
|
}
|
2017-12-17 23:07:50 +00:00
|
|
|
}
|