From c2b67d7fb916d7dfb2e869212449cf14a27e0972 Mon Sep 17 00:00:00 2001 From: Saxon Date: Fri, 5 Apr 2019 15:23:00 +1030 Subject: [PATCH] protocol/rtp: wrote TestCsrcCount Wrote test TestCsrcCount to check behaviour of csrcCount is expected. --- protocol/rtp/parse_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/protocol/rtp/parse_test.go b/protocol/rtp/parse_test.go index 01de123d..be521a3b 100644 --- a/protocol/rtp/parse_test.go +++ b/protocol/rtp/parse_test.go @@ -40,3 +40,18 @@ func TestVersion(t *testing.T) { t.Errorf("unexpected version for RTP packet. Got: %v\n Want: %v\n", got, expect) } } + +// TestCsrcCount checks that we can correctly obtain the csrc count from an +// RTP packet. +func TestCsrcCount(t *testing.T) { + const ver, expect = 2, 2 + pkt := (&Pkt{ + V: ver, + CC: expect, + CSRC: make([][4]byte, expect), + }).Bytes(nil) + got := csrcCount(pkt) + if got != expect { + t.Errorf("unexpected csrc count for RTP packet. Got: %v\n Want: %v\n", got, expect) + } +}