github.com/xtls/xray-core@v1.8.12-0.20240518155711-3168d27b0bdb/common/protocol/id_test.go (about) 1 package protocol_test 2 3 import ( 4 "testing" 5 6 . "github.com/xtls/xray-core/common/protocol" 7 "github.com/xtls/xray-core/common/uuid" 8 ) 9 10 func TestIdEquals(t *testing.T) { 11 id1 := NewID(uuid.New()) 12 id2 := NewID(id1.UUID()) 13 14 if !id1.Equals(id2) { 15 t.Error("expected id1 to equal id2, but actually not") 16 } 17 18 if id1.String() != id2.String() { 19 t.Error(id1.String(), " != ", id2.String()) 20 } 21 }