github.com/xraypb/Xray-core@v1.8.1/transport/internet/headers/wechat/wechat_test.go (about) 1 package wechat_test 2 3 import ( 4 "context" 5 "testing" 6 7 "github.com/xraypb/Xray-core/common" 8 "github.com/xraypb/Xray-core/common/buf" 9 . "github.com/xraypb/Xray-core/transport/internet/headers/wechat" 10 ) 11 12 func TestUTPWrite(t *testing.T) { 13 videoRaw, err := NewVideoChat(context.Background(), &VideoConfig{}) 14 common.Must(err) 15 16 video := videoRaw.(*VideoChat) 17 18 payload := buf.New() 19 video.Serialize(payload.Extend(video.Size())) 20 21 if payload.Len() != video.Size() { 22 t.Error("expected payload size ", video.Size(), " but got ", payload.Len()) 23 } 24 }