github.com/v2fly/v2ray-core/v5@v5.16.2-0.20240507031116-8191faa6e095/common/protocol/id_test.go (about)

     1  package protocol_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	. "github.com/v2fly/v2ray-core/v5/common/protocol"
     7  	"github.com/v2fly/v2ray-core/v5/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  }