github.com/whoyao/protocol@v0.0.0-20230519045905-2d8ace718ca5/utils/id_test.go (about)

     1  package utils
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  
     8  	"github.com/whoyao/protocol/livekit"
     9  )
    10  
    11  func TestMarshalUnmarshalGuid(t *testing.T) {
    12  	id0 := livekit.TrackID(NewGuid(TrackPrefix))
    13  	b0 := MarshalGuid(id0)
    14  	id1 := UnmarshalGuid[livekit.TrackID](b0)
    15  	b1 := MarshalGuid(id1)
    16  	require.EqualValues(t, id0, id1)
    17  	require.EqualValues(t, b0, b1)
    18  }