1 Star 0 Fork 16

mitslyj/SIP协议

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
response_line_test.go 761 Bytes
一键复制 编辑 原始数据 按行查看 历史
shallot 提交于 2020-04-05 12:24 +08:00 . 添加SIP协议的解析代码。
package sip
import "testing"
func TestResponseLine(t *testing.T) {
tests := []struct {
name string
item string
wantErr bool
}{
{"200", "SIP/2.0 200 OK", false},
{"481", "SIP/2.0 481 Dialog/Transaction Does Not Exist", false},
{"NoSip", "200 OK", true},
{"NoCode", "SIP/2.0 OK", true},
{"NoReason", "SIP/2.0 200", true},
{"ErrorCode", "SIP/2.0 CODE OK", true},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
rl, err := NewResponseLine(tt.item)
if (err != nil) != tt.wantErr {
t.Errorf("ResponseLine error = %v, wantErr %v", err, tt.wantErr)
}
if !tt.wantErr {
if str := rl.String(); str != tt.item {
t.Errorf("ResponseLine 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

搜索帮助