1 Star 0 Fork 16

mitslyj/SIP协议

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
cseq_test.go 624 Bytes
一键复制 编辑 原始数据 按行查看 历史
shallot 提交于 2020-04-05 12:24 +08:00 . 添加SIP协议的解析代码。
package sip
import (
"fmt"
"testing"
)
func TestCSeq(t *testing.T) {
tests := []struct {
item string
wantResult CSeq
wantErr bool
}{
{"609 REGISTER", CSeq{609, "REGISTER"}, false},
{"REGISTER", CSeq{}, true},
{"609", CSeq{}, true},
}
for i, tt := range tests {
t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
m, err := parseCSeq(tt.item)
if (err != nil) != tt.wantErr {
t.Errorf("CSeq error = %v, wantErr %v", err, tt.wantErr)
}
if !tt.wantErr {
str := m.String()
if str != tt.item {
t.Errorf("CSeq string = %v, wantString %v", str, tt.item)
}
}
})
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/mitslyj/sip.git
git@gitee.com:mitslyj/sip.git
mitslyj
sip
SIP协议
master

搜索帮助