537947358cdc3d46284007e472b6f7252fa6a3d8
[senf.git] / senf / Packets / DefaultBundle / RTPPacket.test.cc
1 // $Id$
2 //
3 // Copyright (C) 2008
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Philipp Batroff <pug@berlios.de>
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
23 /** \file
24     \brief RTPPacket unit tests */
25
26 // Custom includes
27 #include "RTPPacket.hh"
28
29 #include <senf/Utils/auto_unit_test.hh>
30 #include <boost/test/test_tools.hpp>
31
32
33 SENF_AUTO_UNIT_TEST(RTPPacket_packet)
34 {
35     unsigned char data[] = {0x80 , 0x08 , 0x1b , 0xbb , 0x02 , 0xcb , 0xad , 0x80 , 0x50 , 0x48 , 0xa7, 0x8c };
36
37     senf::RTPPacket p (senf::RTPPacket::create(data));
38
39     BOOST_CHECK_EQUAL( p->version(), 2u);
40     BOOST_CHECK_EQUAL( p->padding(), false);
41     BOOST_CHECK_EQUAL( p->extension(), false);
42     BOOST_CHECK_EQUAL( p->csrcCount(), 0u);
43     BOOST_CHECK_EQUAL( p->marker(), false);
44     BOOST_CHECK_EQUAL( p->payloadType(), 8u);
45     BOOST_CHECK_EQUAL( p->seqNumber(), 0x1bbbu);
46     BOOST_CHECK_EQUAL( p->timeStamp(), 0x2cbad80u);
47     BOOST_CHECK_EQUAL( p->synSourceId(), 0x5048a78cu);
48
49     std::ostringstream oss (std::ostringstream::out);
50     SENF_CHECK_NO_THROW( p.dump( oss));
51 }