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