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

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

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
RsiPacketTest.java | 100% (1/1) | 100% (5/5) | 94% (250/266) | 98% (55,9/57)

### COVERAGE BREAKDOWN BY CLASS AND METHOD

name | class, % | method, % | block, % | line, %
--- | --- | --- | --- | ---
class RsiPacketTest | 100% (1/1) | 100% (5/5) | 94% (250/266) | 98% (55,9/57)
generateAndParse (int): void |  | 100% (1/1) | 91% (124/136) | 96% (21,1/22)
generateAndParseWithSubReportBlock (int): void |  | 100% (1/1) | 95% (60/63) | 99% (13,8/14)
getGenericBlockJitter (): GenericBlock |  | 100% (1/1) | 98% (46/47) | 100% (14/14)
RsiPacketTest (): void |  | 100% (1/1) | 100% (7/7) | 100% (2/2)
testAll (): void |  | 100% (1/1) | 100% (13/13) | 100% (5/5)

1 | package cz.vutbr.feec.packets.rsi;
2 |
3 | import junit.framework.Assert;
4 |
5 | import org.junit.Test;
6 |
7 | import cz.vutbr.feec.packets.PacketException;
8 | import cz.vutbr.feec.packets.rsi.RSIPacket;
9 |
10 |
11 | public class RsiPacketTest {
12 | byte[] buf = new byte[100];
13 |
14 | @Test
15 | public void testAll() throws PacketException {
16 | generateAndParseWithSubReportBlock(0);
17 | generateAndParseWithSubReportBlock(5);
18 | generateAndParse(0);
19 | generateAndParse(5);
20 | }
21 |
22 | private static final long MAX32 = 0x10000000l;
23 |
24 | public void generateAndParse(int offset ) throws PacketException {
25 | // generate
26 | RSIPacket g = new RSIPacket();
27 | // read
28 | RSIPacket r = new RSIPacket();
29 |
30 | g.setPadding(0);
31 | Assert.assertTrue(g.getVersion() == 2);
32 | g.setNTPTimeStampLeastSignificant(MAX32);
33 | g.setNTPTimeStampMostSignificant(MAX32);
34 | g.setSSRC(MAX32);
35 | g.setSSRCSummarized(MAX32);
36 | int pktLength = g.generate(buf, offset);
37 |
38 | int res = r.parse(buf, offset, pktLength);
39 | Assert.assertTrue(pktLength == res);
40 | Assert.assertTrue(r.getSSRC() == MAX32);
41 | Assert.assertTrue(r.getSSRCSummarized() == MAX32);
42 | Assert.assertTrue(r.getNTPTimeStampLeastSignificant() == MAX32);
43 | Assert.assertTrue(r.getNTPTimeStampMostSignificant() == MAX32);
44 | Assert.assertTrue(r.getLength() == g.getLength());
45 | Assert.assertTrue(g.getLength() == 4*(5-1));
46 | Assert.assertTrue(r.getLength() == 4*(5-1));
47 | Assert.assertTrue(r.getPadding() == 0);
48 | Assert.assertTrue(r.getVersion() == 2);
49 | Assert.assertTrue(r.getPayloadType() == 208);
50 | }
51 |
52 | public void generateAndParseWithSubReportBlock(int offset ) throws PacketException {
53 | // generate
54 | RSIPacket g = new RSIPacket();
55 | // read
56 | RSIPacket r = new RSIPacket();
57 |
58 |
59 | g.setPadding(0);
60 | Assert.assertTrue(g.getVersion() == 2);
61 | g.setNTPTimeStampLeastSignificant(MAX32);
62 | g.setNTPTimeStampMostSignificant(MAX32);
63 | g.setSSRC(MAX32);
64 | g.setSSRCSummarized(MAX32);
65 | g.addReportBlock(getGenericBlockJitter());
66 | int pktLength = g.generate(buf, offset);
67 |
68 | int res = r.parse(buf, offset, pktLength);
69 | Assert.assertTrue(pktLength == res);
70 | Assert.assertTrue(pktLength == 20+4*4);
71 | }
72 |
73 | private GenericBlock getGenericBlockJitter() {
74 | GenericBlock g = new GenericBlockJitter();
75 | g.setMultiplicativeFactor(1<<3);
76 | g.setMaximumDistributionValue(MAX32);
77 | g.setMinimumDistributionValue(MAX32);
78 | g.addBucket(1);
79 | Assert.assertTrue(g.getNumberOfDistributionBuckets() == 1);
80 | g.addBucket(2);
81 | g.addBucket(3);
82 | g.addBucket(4);
83 | g.addBucket(5);
84 | g.addBucket(6);
85 | g.addBucket(7);
86 | g.addBucket(8);
87 | return g;
88 | }
89 | }

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