1// +build debug 2 3package stun 4 5import "testing" 6 7func TestAttrOverflowErr_Error(t *testing.T) { 8 err := AttrOverflowErr{ 9 Got: 100, 10 Max: 50, 11 Type: AttrLifetime, 12 } 13 if err.Error() != "incorrect length of LIFETIME attribute: 100 exceeds maximum 50" { 14 t.Error("bad error string", err) 15 } 16} 17 18func TestAttrLengthErr_Error(t *testing.T) { 19 err := AttrLengthErr{ 20 Attr: AttrErrorCode, 21 Expected: 15, 22 Got: 99, 23 } 24 if err.Error() != "incorrect length of ERROR-CODE attribute: got 99, expected 15" { 25 t.Errorf("bad error string: %s", err) 26 } 27} 28