github.com/moqsien/xraycore@v1.8.5/common/protocol/id_test.go (about)

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