10 Star 42 Fork 16

北京小程科技有限公司 / SIP协议

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
request_line_test.go 628 Bytes
一键复制 编辑 原始数据 按行查看 历史
shallot 提交于 2020-04-05 12:24 . 添加SIP协议的解析代码。
package sip
import "testing"
func TestRequestLine(t *testing.T) {
tests := []struct {
name string
item string
wantErr bool
}{
{"reg", "REGISTER sip:192.168.0.2:5060 SIP/2.0", false},
{"ivt", "INVITE sip:1010@192.168.0.2 SIP/2.0", false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
rl, err := NewRequestLine(tt.item)
if (err != nil) != tt.wantErr {
t.Errorf("RequestLine error = %v, wantErr %v", err, tt.wantErr)
}
if !tt.wantErr {
if str := rl.String(); str != tt.item {
t.Errorf("RequestLine string = %v, wantString %v", str, tt.item)
}
}
})
}
}
Go
1
https://gitee.com/xiaochengtech/sip.git
git@gitee.com:xiaochengtech/sip.git
xiaochengtech
sip
SIP协议
master

搜索帮助