/* NAME parse_test.go DESCRIPTION parse_test.go provides testing for behaviour of functionality in parse.go. AUTHOR Saxon A. Nelson-Milton LICENSE Copyright (C) 2019 the Australian Ocean Lab (AusOcean) This is free software: you can redistribute it and/or modify them under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License in gpl.txt. If not, see [GNU licenses](http://www.gnu.org/licenses). */ package rtp import ( "testing" ) // TestVersion checks that we can correctly get the version from an RTP packet. func TestVersion(t *testing.T) { const expect = 1 pkt := (&Pkt{V: expect}).Bytes(nil) got := version(pkt) if got != expect { 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) } }