mirror of https://bitbucket.org/ausocean/av.git
protocol/rtp: added TestExtHeaderLen
Added test TestExtHeaderLen which checks that extHeaderLen returns the correct len for an RTP packet with an extension header.
This commit is contained in:
parent
3dc6d7733b
commit
275b86285e
|
@ -82,3 +82,20 @@ func TestHasExt(t *testing.T) {
|
||||||
t.Error("did not expect to have extension indicator as true")
|
t.Error("did not expect to have extension indicator as true")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TestExtHeaderLen checks for a correct extension header len for an RTP packet.
|
||||||
|
func TestExtHeaderLen(t *testing.T) {
|
||||||
|
const ver, expect = 2, 3
|
||||||
|
pkt := (&Pkt{
|
||||||
|
V: ver,
|
||||||
|
X: true,
|
||||||
|
Extension: ExtensionHeader{
|
||||||
|
ID: 0,
|
||||||
|
Header: make([][4]byte, expect),
|
||||||
|
},
|
||||||
|
}).Bytes(nil)
|
||||||
|
got := extHeaderLen(pkt)
|
||||||
|
if got != expect {
|
||||||
|
t.Errorf("Unexpected extension header len. Got: %v\n Want: %v\n", got, expect)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue