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

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

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
ReportBlockTest.java | 100% (1/1) | 75% (3/4) | 50% (72/145) | 54% (18,9/35)

### COVERAGE BREAKDOWN BY CLASS AND METHOD

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
class ReportBlockTest | 100% (1/1) | 75% (3/4) | 50% (72/145) | 54% (18,9/35)
testFraction (int): void |  | 0% (0/1) | 0% (0/71) | 0% (0/16)
testByePacket (int): void |  | 100% (1/1) | 97% (58/60) | 99% (13,9/14)
ReportBlockTest (): void |  | 100% (1/1) | 100% (7/7) | 100% (2/2)
testByePacket (): void |  | 100% (1/1) | 100% (7/7) | 100% (3/3)

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 ReportBlockTest {
10 |
11 | byte[] buffer = new byte[100];
12 |
13 | @Test
14 | public void testByePacket() throws PacketParseException,
15 | PacketGenerateException {
16 | testByePacket(5);
17 | testByePacket(0);
18 | }
19 | public void testByePacket(int offset) throws PacketParseException,
20 | PacketGenerateException {
21 | ReportBlock gen = new ReportBlock();
22 | gen.setFractionLost(50);
23 | gen.setSSRC(1);
24 | gen.setDLSR(3L << 30);
25 | gen.setExHIseqNumRec(7L << 29);
26 | gen.setInterArrJitter(15L << 15);
27 | gen.setLSR(31L<<13);
28 |
29 |
30 | int len1 = gen.generate(buffer, offset);
31 | ReportBlock parsed = new ReportBlock();
32 | int len2 = parsed.parse(buffer, offset, len1);
33 |
34 | Assert.assertTrue("Musi byt zarovnano na 4 byty", len1 % 4 == 0);
35 | Assert.assertTrue(len1 == len2);
36 | Assert.assertTrue(gen.equals(parsed));
37 | }
38 | public void testFraction(int offset) throws PacketParseException,
39 | PacketGenerateException {
40 | ReportBlock gen = new ReportBlock();
41 | gen.setSSRC(1);
42 | gen.setDLSR(3L << 30);
43 | gen.setExHIseqNumRec(7L << 29);
44 | gen.setInterArrJitter(15L << 15);
45 | gen.setLSR(31L<<13);
46 |
47 | double fraction = 0.25;
48 | gen.setFractionLost(fraction);
49 |
50 | int len1 = gen.generate(buffer, offset);
51 | ReportBlock parsed = new ReportBlock();
52 | int len2 = parsed.parse(buffer, offset, len1);
53 |
54 | Assert.assertEquals(0.25, parsed.getFractionLost()/256.0);
55 |
56 | Assert.assertTrue("Musi byt zarovnano na 4 byty", len1 % 4 == 0);
57 | Assert.assertTrue(len1 == len2);
58 | Assert.assertTrue(gen.equals(parsed));
59 | }
60 | }

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