mirror of
https://github.com/pion/stun.git
synced 2025-10-09 17:50:07 +08:00
all: remove usage of constant errors
This commit is contained in:
@@ -212,6 +212,19 @@ func BenchmarkErrorCodeAttribute_AddTo(b *testing.B) {
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkErrorCodeAttribute_GetFrom(b *testing.B) {
|
||||
m := New()
|
||||
b.ReportAllocs()
|
||||
a := &ErrorCodeAttribute{
|
||||
Code: 404,
|
||||
Reason: []byte("not found!"),
|
||||
}
|
||||
a.AddTo(m)
|
||||
for i := 0; i < b.N; i++ {
|
||||
a.GetFrom(m)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMessage_AddErrorCode(t *testing.T) {
|
||||
m := New()
|
||||
transactionID, err := base64.StdEncoding.DecodeString("jxhBARZwX+rsC6er")
|
||||
@@ -243,3 +256,11 @@ func TestMessage_AddErrorCode(t *testing.T) {
|
||||
t.Error("bad reason", string(errCodeAttr.Reason))
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkMessage_GetNotFound(b *testing.B) {
|
||||
m := New()
|
||||
b.ReportAllocs()
|
||||
for i := 0; i < b.N; i++ {
|
||||
m.Get(AttrRealm)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user