EMMA Coverage Report (generated Tue Dec 18 20:38:46 CET 2007)
[all classes][cz.vutbr.feec.packets.rtcp]

## COVERAGE SUMMARY FOR SOURCE FILE [SenderReportPacketTest.java]

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
SenderReportPacketTest.java | 100% (1/1) | 100% (2/2) | 96% (333/347) | 99% (88,2/89)

### COVERAGE BREAKDOWN BY CLASS AND METHOD

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
class SenderReportPacketTest | 100% (1/1) | 100% (2/2) | 96% (333/347) | 99% (88,2/89)
testSRPacket (): void |  | 100% (1/1) | 96% (326/340) | 99% (86,2/87)
SenderReportPacketTest (): void |  | 100% (1/1) | 100% (7/7) | 100% (2/2)

1 | package cz.vutbr.feec.packets.rtcp;
2 |
3 | import org.junit.Assert;
4 | import org.junit.Test;
5 |
6 | import cz.vutbr.feec.packets.PacketGenerateException;
7 | import cz.vutbr.feec.packets.PacketParseException;
8 |
9 | public class SenderReportPacketTest {
10 |
11 | private byte[] buffer = new byte[500];
12 |
13 | @Test
14 | public void testSRPacket() throws PacketGenerateException,
15 | PacketParseException {
16 |
17 | SenderReportPacket generateSRPacket = new SenderReportPacket();
18 |
19 | generateSRPacket.setVersion(2);
20 | generateSRPacket.setPadding(1);
21 | generateSRPacket.setPayloadtype(RTCPConstants.RTCP_SR);
22 | generateSRPacket.setSSRC(545454);
23 |
24 | generateSRPacket.setNTP_timestamp_MSW(16843009);
25 | generateSRPacket.setNTP_timestamp_LSW(16843009);
26 | generateSRPacket.setRTP_timestamp(16843009);
27 | generateSRPacket.setSenderPacketCount(16843009);
28 | generateSRPacket.setSenderOctetCount(1000);
29 |
30 | ReportBlock block1 = new ReportBlock();
31 | ReportBlock block2 = new ReportBlock();
32 | ReportBlock block3 = new ReportBlock();
33 | ReportBlock block4 = new ReportBlock();
34 | ReportBlock block5 = new ReportBlock();
35 |
36 | block1.setSSRC(16843009);
37 | block2.setSSRC(2);
38 | block3.setSSRC(3);
39 | block4.setSSRC(4);
40 | block5.setSSRC(5);
41 |
42 | block1.setFractionLost(10);
43 | block2.setFractionLost(50);
44 | block3.setFractionLost(51);
45 | block4.setFractionLost(52);
46 | block5.setFractionLost(53);
47 |
48 | block1.setCumulativeNumofPackLost(65793);
49 | block2.setCumulativeNumofPackLost(200);
50 | block3.setCumulativeNumofPackLost(300);
51 | block4.setCumulativeNumofPackLost(400);
52 | block5.setCumulativeNumofPackLost(500);
53 |
54 | block1.setExHIseqNumRec(16843009);
55 | block2.setExHIseqNumRec(1000);
56 | block3.setExHIseqNumRec(1001);
57 | block4.setExHIseqNumRec(1002);
58 | block5.setExHIseqNumRec(1003);
59 |
60 | block1.setInterArrJitter(16843009);
61 | block2.setInterArrJitter(555);
62 | block3.setInterArrJitter(556);
63 | block4.setInterArrJitter(557);
64 | block5.setInterArrJitter(558);
65 |
66 | block1.setLSR(16843009);
67 | block2.setLSR(2);
68 | block3.setLSR(3);
69 | block4.setLSR(4);
70 | block5.setLSR(5);
71 |
72 | block1.setDLSR(16843009);
73 | block2.setDLSR(20);
74 | block3.setDLSR(8);
75 | block4.setDLSR(9);
76 | block5.setDLSR(11);
77 |
78 | generateSRPacket.addReportBlock(block1);
79 | generateSRPacket.addReportBlock(block2);
80 | generateSRPacket.addReportBlock(block3);
81 | generateSRPacket.addReportBlock(block4);
82 | generateSRPacket.addReportBlock(block5);
83 |
84 | Assert.assertTrue(generateSRPacket.getReportCount() == 5);
85 | // tato delka se nastavuje sama dle poctu vlozenych bloku
86 | // generateSRPacket.setReportCount(generateSRPacket.getReportCount());
87 |
88 | int length = generateSRPacket.generate(buffer, 0);
89 |
90 | SenderReportPacket parseSRpacket = new SenderReportPacket();
91 |
92 | int length2 = parseSRpacket.parse(buffer, 0, length);
93 |
94 | Assert.assertTrue(length == length2);
95 | Assert.assertTrue("Musi byt zarovnano na 4 byty", length % 4 == 0);
96 | Assert.assertTrue(generateSRPacket.getPadding() == parseSRpacket
97 | .getPadding());
98 | Assert.assertTrue(generateSRPacket.getVersion() == parseSRpacket
99 | .getVersion());
100 | Assert.assertTrue(generateSRPacket.getReportCount() == parseSRpacket
101 | .getReportCount());
102 | Assert.assertTrue(generateSRPacket.getPayloadtype() == parseSRpacket
103 | .getPayloadtype());
104 | Assert.assertTrue(generateSRPacket.getLength() == parseSRpacket
105 | .getLength());
106 | Assert
107 | .assertTrue(generateSRPacket.getSSRC() == parseSRpacket
108 | .getSSRC());
109 | Assert
110 | .assertTrue(generateSRPacket.getNTP_timestamp_MSW() == parseSRpacket
111 | .getNTP_timestamp_MSW());
112 | Assert
113 | .assertTrue(generateSRPacket.getNTP_timestamp_LSW() == parseSRpacket
114 | .getNTP_timestamp_LSW());
115 | Assert.assertTrue(generateSRPacket.getRTP_timestamp() == parseSRpacket
116 | .getRTP_timestamp());
117 | Assert
118 | .assertTrue(generateSRPacket.getSenderOctetCount() == parseSRpacket
119 | .getSenderOctetCount());
120 | Assert
121 | .assertTrue(generateSRPacket.getSenderPacketCount() == parseSRpacket
122 | .getSenderPacketCount());
123 |
124 | for (int i = 0; i < 5; i++) {
125 | Assert.assertTrue("ITER:"+i,generateSRPacket.getReportBlock(i).equals(
126 | parseSRpacket.getReportBlock(i)));
127 | }
128 | }
129 | }

[all classes][cz.vutbr.feec.packets.rtcp]
EMMA 2.0.5312 EclEmma Fix 1 (C) Vladimir Roubtsov